updated check_md5_for_changed_conf_and_ini_files() and began to fix copy()
This commit is contained in:
parent
74c8358a99
commit
54ad30752e
@ -36,17 +36,21 @@ copy () {
|
||||
|
||||
readarray -td' ' files <<< "$1"
|
||||
for f in ${files[@]}; do
|
||||
if grep -qE "^.*[.]conf.*$" <<< ${f}; then
|
||||
if [ "$f" = "update.conf" ] || [ "$f" = "current.conf" ]; then
|
||||
continue
|
||||
fi
|
||||
if grep -qE "^.*[.]conf\s*$" <<< ${f}; then
|
||||
local __f="${psa_config_dir}/${f}"
|
||||
if ! cp ${__f} /etc/psa_config; then
|
||||
log_error "$func:${LINENO}: cannot cp ${__f} /etc/psa_config"
|
||||
return 1
|
||||
fi
|
||||
log_info "$func:${LINENO}: copied $f to /etc/psa_config"
|
||||
# elif grep -qE "^.*[.]ini.*$" <<< ${f}; then
|
||||
# if ! cp ${f} $psa_ini; then
|
||||
# return 1
|
||||
# fi
|
||||
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
|
||||
# TODO
|
||||
set -x
|
||||
:
|
||||
set +x
|
||||
fi
|
||||
done
|
||||
|
||||
@ -56,46 +60,83 @@ copy () {
|
||||
|
||||
filter_system_files () {
|
||||
local func="${FUNCNAME[0]}"
|
||||
|
||||
log_debug "$func:${LINENO} $1"
|
||||
readarray -td' ' files <<< "$1"
|
||||
local __system_files=""
|
||||
for f in ${files[@]}; do
|
||||
case "$f" in
|
||||
("emp.conf"|"printer.conf"|"device.conf")
|
||||
__system_files+="${f} "
|
||||
;;
|
||||
esac
|
||||
if grep -qE "^.*[.](conf|ini)\s*$" <<< $f; then
|
||||
if [ -z $__system_files ]; then
|
||||
__system_files="${f}"
|
||||
else
|
||||
__system_files="$__system_files ${f}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
log_debug "$func:${LINENO} system-files=$__system_files"
|
||||
printf '%s' "$__system_files"
|
||||
}
|
||||
|
||||
#
|
||||
md5_of () {
|
||||
printf '%s' "$(md5sum "$1" | cut -d' ' -f1)"
|
||||
}
|
||||
|
||||
# Check if the fetched/merged files have the correct md5 and are
|
||||
# valid for the PSA.
|
||||
#
|
||||
check_md5_for_changed_conf_and_ini_files () {
|
||||
local func="${FUNCNAME[0]}"
|
||||
local json_key=""
|
||||
local js_key="" # used by json-parser 'jq'
|
||||
local md5sum_update_conf=""
|
||||
local md5sum_repository=""
|
||||
local readonly cut_md5="cut -d' ' -f1"
|
||||
log_debug "$func:${LINENO} files=$1"
|
||||
if ! [ -z $1 ]; then
|
||||
readarray -td' ' files <<< "$1"
|
||||
for file in ${files[@]}; do
|
||||
log_debug "$func:${LINENO} file=$file"
|
||||
if [ "$file" = "emp.conf" ]; then
|
||||
json_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $json_key)
|
||||
md5sum_repository="$(md5sum $emp_conf | awk '{ print $1}')"
|
||||
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository="$(md5_of $emp_conf)"
|
||||
elif [ "$file" = "printer.conf" ]; then
|
||||
json_key=".conf.szeged.zg[1].z[1].etc.psa_config.printer"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $json_key)
|
||||
md5sum_repository="$(md5sum $printer_conf | awk '{ print $1}')"
|
||||
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.printer"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository="$(md5_of $printer_conf)"
|
||||
elif [ "$file" = "device.conf" ]; then
|
||||
json_key=".conf.szeged.zg[1].z[1].etc.psa_config.device"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $json_key)
|
||||
md5sum_repository="$(md5sum $device_conf | awk '{ print $1}')"
|
||||
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.device"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository="$(md5_of $device_conf)"
|
||||
elif [ "$file" = "ATBQT.ini" ]; then
|
||||
js_key=".ini.szeged.zg[1].z[1].opt.app.ATBQT.ATBQT"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository="$(md5_of $atbqt_ini)"
|
||||
elif [ "$file" = "sysconfig.ini" ]; then
|
||||
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.sysconfig"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository=$(md5_of $sysconfig_sysconfig_ini)
|
||||
elif [ "$file" = "SystemControl.ini" ]; then
|
||||
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.SystemControl"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository=$(md5_of $sysconfig_sysctrl_ini)
|
||||
elif [ "$file" = "ISMASMgr.ini" ]; then
|
||||
js_key=".ini.szeged.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository=$(md5_of $ismasmgr_ismasmgr_ini)
|
||||
if [ "$md5sum_repository" = "$md5sum_update_conf" ]; then
|
||||
log_info "$func:${LINENO}: md5sum 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
|
||||
fi
|
||||
|
||||
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.ISMASMgr"
|
||||
md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
|
||||
md5sum_repository=$(md5_of $sysconfig_ismasmgr_ini)
|
||||
else
|
||||
continue
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user