Compare commits

..

No commits in common. "cfce4ae53c7bb70de595d4e7d5f17d09e45e4837" and "103952bdb9ad9ac1e198835418f011b8daecd2f3" have entirely different histories.

2 changed files with 52 additions and 74 deletions

View File

@ -22,9 +22,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly UPDATEPSABEGIN=./.updatepsa/begin
readonly UPDATEPSAEND=./.updatepsa/end
readonly OPKG_CMDS_TMP=/tmp/opkg_commands
readonly GIT_PULL_TMP=/tmp/git_pull
readonly PROGRAM=`basename $0`
readonly WORKSPACE_DIR=workspace
@ -100,15 +97,13 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
compute_hash () {
if cd_customer_repository; then
local hash=""
if [[ -z "$1" ]]; then
if [[ -z $1 ]]; then
hash=$(git log -n 1 --pretty=format:%H)
else
hash=$(git hash-object "$1")
hash=$(git log -n 1 --pretty=format:%H -- $1)
fi
cd_home ; echo ${hash:0:10} # return the first 10 hex characters
return 0
echo ${hash:0:10} # return the first 10 hex characters
fi
return 1
}
compute_version () {

View File

@ -35,9 +35,6 @@ 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
@ -76,76 +73,62 @@ update_psa() {
# no backup necessary as saved in git-repo
# 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
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"
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
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
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"
# 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 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
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
# 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