2022-06-02 18:11:04 +02:00
|
|
|
# !/bin/bash -
|
2022-06-03 20:00:07 +02:00
|
|
|
|
|
|
|
source ./log_helpers
|
|
|
|
|
|
|
|
if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
|
|
|
|
readonly APISM_DB_PORT=7777
|
|
|
|
news_to_ismas () {
|
|
|
|
local data="#M=APISM#C=CMD_EVENT#J=
|
|
|
|
{
|
|
|
|
\"REASON\":\"SW_UP\",
|
|
|
|
\"Timestamp\":\"$(date +%Y-%m-%dT%T.000%z)\",
|
|
|
|
\"EVENT\":\"$1\",
|
|
|
|
\"EVENTSTATE\":1,
|
|
|
|
\"PARAMETER\":\"Testdaten\"
|
|
|
|
}"
|
|
|
|
echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT)
|
|
|
|
}
|
2022-06-03 21:52:57 +02:00
|
|
|
|
|
|
|
# WAIT
|
|
|
|
update_psa_activated () {
|
|
|
|
news_to_ismas "U0010"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
# git pull
|
|
|
|
update_psa_pull_customer_repository () {
|
|
|
|
# text im PARAMETER?
|
|
|
|
news_to_ismas "U0011" "git pull customer repository"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
update_psa_backup () {
|
|
|
|
news_to_ismas "U0011" "backup before update steps"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
update_psa_check_hash_values () {
|
|
|
|
news_to_ismas "U0011" "checking file integrity"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_check_hardware_compatibility () {
|
|
|
|
news_to_ismas "U0011" "check hardware compatiblity"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
# conf/ini files
|
|
|
|
update_psa_copy_files () {
|
|
|
|
news_to_ismas "U0011" "copy conf/ini-files"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
# exec opkg-commands (dry-run)
|
|
|
|
update_psa_install_packages_dry_run () {
|
|
|
|
news_to_ismas "U0011" "install opkg-packages (dry-run)"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
# exec opkg-commands
|
|
|
|
update_psa_install_packages () {
|
|
|
|
news_to_ismas "U0011" "install opkg-packages"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
# remove backup in case of success
|
|
|
|
update_psa_cleanup () {
|
|
|
|
news_to_ismas "U0011" "cleanup"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_finished () {
|
|
|
|
news_to_ismas "U0012"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
# results
|
|
|
|
update_psa_succeeded () {
|
|
|
|
news_to_ismas "U0001" "updates installed"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
reset_update_trigger () {
|
|
|
|
news_to_ismas "U0002" "updates activated"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
update_psa_canceled_no_updates_available () {
|
|
|
|
# text im PARAMETER?
|
|
|
|
news_to_ismas "U0003" # "No updates available, but 'WAIT' active. Missing check-in?"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_backup_failed () {
|
|
|
|
news_to_ismas "U0003" # "Backup failed"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_wrong_hash_values () {
|
|
|
|
news_to_ismas "U0003" # "Wrong hash value for file <xxx>. Missing check-in?"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_hardware_not_compatible () {
|
|
|
|
news_to_ismas "U0003" "conf/ini-file <xxx> and psa hardware <yyy> not compatible"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
update_psa_opkg_command_failure () {
|
|
|
|
news_to_ismas "U0003" "opkg-command <xxx> failed"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
update_psa_failed () {
|
|
|
|
news_to_ismas "U0003" "Unknown error"
|
2022-06-03 20:00:07 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 21:52:57 +02:00
|
|
|
# only for testing
|
|
|
|
set_updates_available () {
|
|
|
|
news_to_ismas "U0099"
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2022-06-03 20:00:07 +02:00
|
|
|
set_update_active () {
|
|
|
|
reset_update_trigger
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
fi
|