Added use of update_psa-ismas messages
This commit is contained in:
parent
6bc2854e78
commit
99fe056626
@ -9,12 +9,17 @@ source ./news_to_ismas
|
||||
source ./news_from_ismas
|
||||
|
||||
update_psa() {
|
||||
|
||||
if ! updates_available; then # check for false alarm
|
||||
update_psa_false_alarm "update requested, but no WAIT state detected"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
update_psa_activated # message to ISMAS
|
||||
|
||||
local try_update_count=0
|
||||
local func="${FUNCNAME[0]}"
|
||||
|
||||
# read config parameters
|
||||
# read_config
|
||||
|
||||
log_debug "$func:${LINENO}: fetch/merge updates..."
|
||||
|
||||
# Fetch new updates (using git)
|
||||
@ -25,13 +30,18 @@ update_psa() {
|
||||
if [ "$repository_is_already_up_to_date" = "yes" ]; then
|
||||
log_error "$func:${LINENO}: $customer_id is up-to-date"\
|
||||
"-> no files to update -> no psa update"
|
||||
exit 1
|
||||
update_psa_false_alarm \
|
||||
"update request, but no change in $CUSTOMER_REPOSITORY_PATH"
|
||||
exit $?
|
||||
fi
|
||||
try_updates_count=$((try_updates_count+1))
|
||||
if [[ "$try_updates_count" -eq 5 ]]; then
|
||||
log_error "$func:${LINENO}: fetch/merging failed" ; exit 1
|
||||
log_error "$func:${LINENO}: fetch/merging failed"
|
||||
update_psa_pull_error # message to ISMAS
|
||||
exit $?
|
||||
fi
|
||||
sleep 60s
|
||||
update_psa_pull_error # message to ISMAS
|
||||
sleep 10s
|
||||
else
|
||||
# Fetched updates successfully
|
||||
try_updates_count=0
|
||||
@ -39,13 +49,19 @@ update_psa() {
|
||||
fi
|
||||
done
|
||||
|
||||
update_psa_pull_customer_repository # message to ISMAS
|
||||
|
||||
# TODO: backup implementieren
|
||||
# Backup before any updates in case some previous test was wrong
|
||||
if ! backup_previous_version; then
|
||||
log_error "$func:${LINENO}: backup failed"
|
||||
revert_customer_repository ; exit 1
|
||||
revert_customer_repository
|
||||
update_psa_backup_error # message to ISMAS
|
||||
exit $?
|
||||
fi
|
||||
|
||||
update_psa_backup # message to ISMAS
|
||||
|
||||
# TODO: use CLONE_CUSTOMER_REPOSITORY=true
|
||||
# d.h. wird das rep geklont, also neu angelegt, dann sind eigentlich alle
|
||||
# dateinen zu ueberpruefen
|
||||
@ -53,17 +69,30 @@ update_psa() {
|
||||
local changed_files=$(changed_file_names)
|
||||
local conf_ini_files=$(filter_conf_ini_files "$changed_files")
|
||||
|
||||
update_psa_report_changed_file_names $changed_files # message to ISMAS
|
||||
|
||||
# check if *.conf and/or *.ini-files have to md5-sum as denoted
|
||||
# in update.conf
|
||||
if ! check_md5_for_changed_conf_and_ini_files "$conf_ini_files" ; then
|
||||
local __r=$?
|
||||
log_error "$func:${LINENO}: new customer files wrong"
|
||||
revert_customer_repository ; exit 1
|
||||
revert_customer_repository
|
||||
exit $__r
|
||||
fi
|
||||
|
||||
if ! check_hardware_compatibility "$conf_ini_files" ; then
|
||||
local __r=$?
|
||||
log_error "$func:${LINENO}: conf/ini-files not fit for PSA"
|
||||
revert_customer_repository
|
||||
exit $__r
|
||||
fi
|
||||
|
||||
# copy *.conf and/or *.ini-files to their corresponding system-directories
|
||||
if ! copy $conf_ini_files; then
|
||||
local __r=$?
|
||||
log_error "$func:${LINENO}: copy operation failed"
|
||||
revert_customer_repository ; exit 1
|
||||
revert_customer_repository
|
||||
exit $__r
|
||||
fi
|
||||
|
||||
# check if the opkg-command-file has been changed during 'git pull'
|
||||
@ -109,7 +138,9 @@ update_psa() {
|
||||
fi
|
||||
done
|
||||
else
|
||||
log_info "$func:${LINENO}: no opkg commnds to execute"
|
||||
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.
|
||||
@ -117,6 +148,15 @@ update_psa() {
|
||||
log_error "$func:${LINENO}: cleanup_previous_version failed"
|
||||
fi
|
||||
|
||||
update_psa_cleanup $UPDATE_ISMAS_PROGRESS \
|
||||
$RC_SUCCESS "cleanup after psa update"
|
||||
|
||||
update_psa_update_succeeded $UPDATE_SUCCEEDED \
|
||||
$RC_SUCCESS "psa update succeeded"
|
||||
|
||||
update_psa_update_succeeded $UPDATE_ACTIVATED \
|
||||
$RC_SUCCESS "psa update activated"
|
||||
|
||||
log_info "$func:${LINENO}: success"
|
||||
exit 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user