Added check_hardware_compatibility(). Added update_psa-Ismas-messages

This commit is contained in:
Gerhard Hoffmann 2022-06-04 21:46:30 +02:00
parent 283e4666c7
commit d351f4485c

View File

@ -33,6 +33,7 @@ fetch_customer_updates() {
copy () {
local func="${FUNCNAME[0]}"
local copy_necessary=0
readarray -td' ' files <<< "$1"
for f in ${files[@]}; do
@ -40,30 +41,51 @@ copy () {
then
continue
fi
copy_necessary=1
PERCENT=$((PERCENT+1))
test $PERCENT -gt 100 && PERCENT=100
if grep -qE "^.*[.]conf\s*$" <<< ${f}; then
local __f=${f#*etc/}
local __msg="cp ${CUSTOMER_ID_BASE_DIR}/${f} to /etc/${__f}"
if ! cp "${CUSTOMER_ID_BASE_DIR}/${f}" "/etc/${__f}"; then
log_error "$func:${LINENO}: cannot "\
"cp ${CUSTOMER_ID_BASE_DIR}/${f} /etc/${__f}"
return 1
log_error "$func:${LINENO}: cannot $__msg"
update_psa_copy_conf_ini_files $UPDATE_ISMAS_ERROR \
$RC_COPY_ERROR "$__msg failed"
return $?
fi
log_info "$func:${LINENO}: copied $f to /etc/${__f}"
update_psa_copy_conf_ini $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "$__msg ok"
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
# TODO: die anderen system-verzeichnisse werden gebraucht
local __f=${f#*opt/app/ATBAPP/}
local __msg="cp ${CUSTOMER_ID_BASE_DIR}/${f} /opt/app/ATBAPP/${__f}"
if [ "$__f" = "ATBQT.ini" ]; then
if ! cp "${CUSTOMER_ID_BASE_DIR}/${f}" /opt/app/ATBAPP/${__f}
then
log_error "$func:${LINENO}: cannot "\
"cp ${CUSTOMER_ID_BASE_DIR}/${f} /opt/app/ATBAPP/${__f}"
return 1
log_error "$func:${LINENO}: cannot $__msg"
update_psa_copy_conf_ini_files \
$UPDATE_ISMAS_ERROR $RC_COPY_ERROR "$__msg failed"
return $?
fi
fi
log_info "$func:${LINENO}: copied $f to /opt/app/ATBAPP/${__f}"
log_info "$func:${LINENO}: $__msg"
update_psa_copy_conf_ini $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "$__msg ok"
fi
done
log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs"
test $copy_necessary -eq 0 && \
update_psa_copy_conf_ini $UPDATE_ISMAS_PROGRESS $RC_SUCCESS \
"no copy of conf/ini-files necessary"
return 0;
}
@ -104,7 +126,7 @@ check_md5_for_changed_conf_and_ini_files () {
if ! [ -z $1 ]; then
readarray -td' ' files <<< "$1"
for file in ${files[@]}; do
log_debug "$func:${LINENO} file=$file"
log_debug "$func:${LINENO} checking file=${file}..."
if [[ "$file" =~ .*emp[.]conf.* ]]; then
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
@ -140,15 +162,22 @@ check_md5_for_changed_conf_and_ini_files () {
else
continue
fi
PERCENT=$((PERCENT+1))
test $PERCENT -gt 100 && PERCENT=100
if [ "$md5sum_repository" = "$md5sum_update_conf" ]; then
log_info "$func:${LINENO}: md5sum for $file ok"
update_psa_check_hash $UPDATE_ISMAS_PROGRESS $RC_SUCCESS \
"md5sum -|$md5sum_repository|- for $file ok"
else
local __r="repository: $md5sum_repository"
local __u="update.conf=$md5sum_update_conf"
local __m="$__r != $__u"
log_error "$func:${LINENO}: md5sum for $file wrong: $__m"
return 1
update_psa_check_hash $UPDATE_ISMAS_ERROR $RC_HASH_VALUE_ERROR \
"md5sum -|$md5sum_repository|- for $file wrong"
return $?
fi
done
else
@ -157,6 +186,14 @@ check_md5_for_changed_conf_and_ini_files () {
return 0
}
check_hardware_compatibility () {
local func="${FUNCNAME[0]}"
# RC_HW_COMPATIBILITY_ERROR=6
update_psa_check_hardware_compatibility $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "TODO: hardware compatibility"
return $?
}
check_md5_for_opkg_packages () {
local func="${FUNCNAME[0]}"
local -n opkg_output_ref=$1