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 $?
fi
rm -f "$OPKG_CMDS_TMP"
rm -f "$GIT_PULL_TMP"
update_psa_activated # message to ISMAS
local try_update_count=0
@ -73,62 +76,76 @@ update_psa() {
# no backup necessary as saved in git-repo
local changed_files=$(changed_file_names)
if ! check_hardware_compatibility "$files_to_copy" ; then
local __r=$?
log_error "$func:${LINENO}: json/ini-files not fit for PSA"
revert_customer_repository
exit $__r
# local changed_files=$(changed_file_names)
if [[ ! -z $GIT_PULL_TMP ]]; then
# TODO
if ! check_hardware_compatibility "$files_to_copy" ; then
local __r=$?
log_error "$func:${LINENO}: json/ini-files not fit for PSA"
revert_customer_repository
exit $__r
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
if [[ ! -z "$OPKG_CMDS_TMP" ]]; then
local commands="$(cat ${OPKG_CMDS_TMP} | tr '\n' '; ')"
log_info "$func:${LINENO}: executed opkg commands"
update_psa_install_opkg_packages $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "$commands"
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"
$RC_SUCCESS "no opkg commands to execute"
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.
#if ! cleanup_previous_version; then