remove opkg-part

This commit is contained in:
Gerhard Hoffmann 2022-06-07 22:33:05 +02:00
parent 7a77d03c7e
commit cfce4ae53c

View File

@ -35,6 +35,9 @@ update_psa() {
exit $? exit $?
fi fi
rm -f "$OPKG_CMDS_TMP"
rm -f "$GIT_PULL_TMP"
update_psa_activated # message to ISMAS update_psa_activated # message to ISMAS
local try_update_count=0 local try_update_count=0
@ -73,63 +76,77 @@ update_psa() {
# no backup necessary as saved in git-repo # no backup necessary as saved in git-repo
local changed_files=$(changed_file_names) # local changed_files=$(changed_file_names)
if ! check_hardware_compatibility "$files_to_copy" ; then if [[ ! -z $GIT_PULL_TMP ]]; then
local __r=$? # TODO
log_error "$func:${LINENO}: json/ini-files not fit for PSA" if ! check_hardware_compatibility "$files_to_copy" ; then
revert_customer_repository local __r=$?
exit $__r log_error "$func:${LINENO}: json/ini-files not fit for PSA"
revert_customer_repository
exit $__r
fi
fi fi
# check if the opkg-command-file has been changed during 'git pull' if [[ ! -z "$OPKG_CMDS_TMP" ]]; then
if grep -qE ".*opkg_commands.*?" <<< $changed_files; then local commands="$(cat ${OPKG_CMDS_TMP} | tr '\n' '; ')"
# read opkg_cmds: each line respresents an opkg-command log_info "$func:${LINENO}: executed opkg commands"
readarray opkg_commands < <(cat $OPKG_CMDS_PSA_FILE) update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \
for opkg_c in "${opkg_commands[@]}"; do $RC_SUCCESS "$commands"
if grep -qE "^\s*[#]+.*$" <<< $opkg_c; then
continue # found comment line
fi
# package manipulation commands without package:
local cwp="update|upgrade|clean"
# informational commands without package:
cwp="${cwp}|list|list-installed|list-upgradable"
if grep -qE "^.*\s+($cwp)\s+.*$" <<< $opkg_c; then
local p=$(printf '%s' "$opkg_c" | awk '{ print $NF }')
local opkg_output=()
if ! exec_opkg_info "$p" opkg_output; then
log_error "$func:${LINENO}: opkg info $opkg_c failed"
revert_customer_repository ; exit 1
fi
if ! check_md5_for_opkg_packages opkg_output; then
log_error "$func:${LINENO}: "\
"wrong md5sum for opkg packages"
revert_customer_repository ; exit 1
fi
fi
# perform a dry-run and check if everything might work as expected.
if ! exec_opkg_noaction $opkg_c; then
log_error "$func:${LINENO}: "\
"opkg --noaction $opkg_c failed"
fi
# Actually execute the opkg command
if ! exec_opkg $opkg_c; then
log_error "$func:${LINENO}: exec_opkg $opkg_c failed"
fallback_to_previous_version
revert_customer_repository ; exit 1
fi
done
else else
log_info "$func:${LINENO}: no opkg commands to execute" log_info "$func:${LINENO}: no opkg commands to execute"
update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \ update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "no opkg commands to execute" $RC_SUCCESS "no opkg commands to execute"
fi fi
# check if the opkg-command-file has been changed during 'git pull'
#if grep -qE ".*opkg_commands.*?" <<< $changed_files; then
# # read opkg_cmds: each line respresents an opkg-command
# readarray opkg_commands < <(cat $OPKG_CMDS_PSA_FILE)
# for opkg_c in "${opkg_commands[@]}"; do
# if grep -qE "^\s*[#]+.*$" <<< $opkg_c; then
# continue # found comment line
# fi
# # package manipulation commands without package:
# local cwp="update|upgrade|clean"
# # informational commands without package:
# cwp="${cwp}|list|list-installed|list-upgradable"
# if grep -qE "^.*\s+($cwp)\s+.*$" <<< $opkg_c; then
# local p=$(printf '%s' "$opkg_c" | awk '{ print $NF }')
# local opkg_output=()
# if ! exec_opkg_info "$p" opkg_output; then
# log_error "$func:${LINENO}: opkg info $opkg_c failed"
# revert_customer_repository ; exit 1
# fi
# if ! check_md5_for_opkg_packages opkg_output; then
# log_error "$func:${LINENO}: "\
# "wrong md5sum for opkg packages"
# revert_customer_repository ; exit 1
# fi
# fi
#
# # perform a dry-run and check if everything might work as expected.
# if ! exec_opkg_noaction $opkg_c; then
# log_error "$func:${LINENO}: "\
# "opkg --noaction $opkg_c failed"
# fi
# # Actually execute the opkg command
# if ! exec_opkg $opkg_c; then
# log_error "$func:${LINENO}: exec_opkg $opkg_c failed"
# fallback_to_previous_version
# revert_customer_repository ; exit 1
# fi
# done
#else
# log_info "$func:${LINENO}: no opkg commands to execute"
# update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \
# $RC_SUCCESS "no opkg commands to execute"
#fi
# Cleanup. # Cleanup.
#if ! cleanup_previous_version; then #if ! cleanup_previous_version; then
# log_error "$func:${LINENO}: cleanup_previous_version failed" # log_error "$func:${LINENO}: cleanup_previous_version failed"