check for existence of opkg_commands-file

This commit is contained in:
Gerhard Hoffmann 2023-06-05 15:53:16 +02:00
parent 6edff44dc1
commit fa1512a716

View File

@ -27,16 +27,18 @@ write_log_file () {
echo "DOWNLOAD, /etc/psa_config/DC2C_print29.json, $now, N/A" >> $GIT_UPDATE_LOG echo "DOWNLOAD, /etc/psa_config/DC2C_print29.json, $now, N/A" >> $GIT_UPDATE_LOG
echo "DOWNLOAD, /etc/psa_config/DC2C_print32.json, $now, N/A" >> $GIT_UPDATE_LOG echo "DOWNLOAD, /etc/psa_config/DC2C_print32.json, $now, N/A" >> $GIT_UPDATE_LOG
if grep -qE . "${OPKG_COMMANDS_FILE}"; then if grep -qE . "${OPKG_COMMANDS_FILE}"; then
readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE) if [ -f "$OPKG_COMMANDS_FILE" ]; then
for opkg_c in "${opkg_commands[@]}"; do readarray opkg_commands < <(cat $OPKG_COMMANDS_FILE)
# check for lines longer than 'opkg ' for opkg_c in "${opkg_commands[@]}"; do
if [ "${#opkg_c}" -gt 4 ]; then # check for lines longer than 'opkg '
# comment: spaces, at least one '#' if [ "${#opkg_c}" -gt 4 ]; then
grep -qE '^[[:space:]]*#+.*$' <<< "$opkg_c" && continue # comment: spaces, at least one '#'
echo -n "EXECUTE, $opkg_c, $now, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1 grep -qE '^[[:space:]]*#+.*$' <<< "$opkg_c" && continue
echo "" >> $GIT_UPDATE_LOG 2>&1 echo -n "EXECUTE, $opkg_c, $now, N/A" | tr -d '\n\r' >> $GIT_UPDATE_LOG 2>&1
fi echo "" >> $GIT_UPDATE_LOG 2>&1
done fi
done
fi
fi fi
else else
echo "Found existing line: $line. Do nothing" echo "Found existing line: $line. Do nothing"