Compare commits
No commits in common. "34ffefd45fe4a175719b22b9170fd98f2bc2a1df" and "54ad30752ec61c6ec53c6df5cfc819d11cafd864" have entirely different histories.
34ffefd45f
...
54ad30752e
@ -245,8 +245,12 @@ changed_file_names () {
|
||||
git_res=${git_res//[$'\r\n\t']/ }
|
||||
log_debug "$func:${LINENO}: git_res=$git_res"
|
||||
local file_names=""
|
||||
local known_files=(update.conf current.conf emp.conf)
|
||||
known_files=(${known_files[@]} device.conf printer.conf opkg_commands)
|
||||
known_files=(${known_files[@]} ATBQT.ini sysconfig.ini ISMASMgr.ini)
|
||||
known_files=(${known_files[@]} SystemControl.ini)
|
||||
for f in ${known_files[@]} ; do
|
||||
if grep -qE ".*\s+${f}\s+.*" <<< $git_res; then
|
||||
if grep -qE ".*/${f}\s+.*" <<< $git_res; then
|
||||
if ! [ -z $file_names ]; then
|
||||
file_names="$f $file_names"
|
||||
else
|
||||
|
22
read_config
22
read_config
@ -27,7 +27,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
if [ -z "$workspace_dir" ]; then
|
||||
log_fatal "$func:${LINENO}: workspace_dir not set in $1"
|
||||
fi
|
||||
log_debug "$func:${LINENO}: workspace_dir=$workspace_dir"
|
||||
log_debug "$func:${LINENO}: workspace_dir=$working_dir"
|
||||
|
||||
readonly customer_location=$(cat "$1" | jq -r .customer_location)
|
||||
if [ -z "$customer_location" ]; then
|
||||
@ -69,11 +69,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
|
||||
local __customer_base_dir="$working_directory/${workspace_dir}"
|
||||
__customer_base_dir="${__customer_base_dir}/${customer_id}"
|
||||
|
||||
readonly customer_id_base_dir=${__customer_base_dir}
|
||||
log_debug "$func:${LINENO}: customer_id_base_dir="
|
||||
log_debug "$func:${LINENO}: $customer_id_base_dir"
|
||||
|
||||
__customer_base_dir="${__customer_base_dir}/${customer_location}"
|
||||
|
||||
readonly customer_location_dir="$__customer_base_dir"
|
||||
@ -145,7 +140,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
log_fatal "$func:${LINENO}: $psa_ismasmgr_dir does not exist"
|
||||
fi
|
||||
|
||||
readonly psa_atbqt_dir="${psa_base_ini_dir}/ATBAPP"
|
||||
readonly psa_atbqt_dir="${psa_base_ini_dir}/ATBQT"
|
||||
if [ -d "$psa_atbqt_dir" ]; then
|
||||
log_debug "$func:${LINENO}: psa_atbqt_dir="
|
||||
log_debug "$func:${LINENO}: $psa_atbqt_dir"
|
||||
@ -225,19 +220,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||
log_fatal "$func:${LINENO}: $opkg_cmds_file does not exist"
|
||||
fi
|
||||
|
||||
readonly known_files=(${customer_location}/update.conf \
|
||||
${customer_location}/current.conf \
|
||||
${device_conf##*${customer_id}/} \
|
||||
${emp_conf##*${customer_id}/} \
|
||||
${printer_conf##*${customer_id}/} \
|
||||
${opkg_cmds_file##*${customer_id}/} \
|
||||
${atbqt_ini##*${customer_id}/} \
|
||||
${ismasmgr_ismasmgr_ini##*${customer_id}/} \
|
||||
${sysconfig_ismasmgr_ini##*${customer_id}/} \
|
||||
${sysconfig_sysconfig_ini##*${customer_id}/} \
|
||||
${sysconfig_sysctrl_ini##*${customer_id}/})
|
||||
|
||||
log_debug "$func:${LINENO}: conf/ini_files=$(echo ${known_files[@]})"
|
||||
log_debug "$func:${LINENO}: sanity of ${customer_repository_path} OK"
|
||||
|
||||
return 0
|
||||
|
10
update_psa
10
update_psa
@ -90,24 +90,24 @@ update() {
|
||||
revert_customer_repository ; exit 1
|
||||
fi
|
||||
|
||||
local changed_files=$(changed_file_names)
|
||||
local conf_ini_files=$(filter_conf_ini_files "$changed_files")
|
||||
local files=$(changed_file_names)
|
||||
local system_files=$(filter_system_files "$files") # conf/ini-files
|
||||
|
||||
# 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
|
||||
if ! check_md5_for_changed_conf_and_ini_files "$system_files" ; then
|
||||
log_error "$func:${LINENO}: new customer files wrong"
|
||||
revert_customer_repository ; exit 1
|
||||
fi
|
||||
|
||||
# copy *.conf and/or *.ini-files to their corresponding system-directories
|
||||
if ! copy $conf_ini_files; then
|
||||
if ! copy $system_files; then
|
||||
log_error "$func:${LINENO}: copy operation failed"
|
||||
revert_customer_repository ; exit 1
|
||||
fi
|
||||
|
||||
# check if the opkg-command-file has been changed during 'git pull'
|
||||
if grep -qE ".*opkg_commands.*?" <<< $changed_files; then
|
||||
if grep -qE ".*opkg_commands.*?" <<< $files; then
|
||||
# read opkg_cmds: each line respresents an opkg-command
|
||||
readarray opkg_commands < <(cat $opkg_cmds_file)
|
||||
for opkg_c in "${opkg_commands[@]}"; do
|
||||
|
@ -36,30 +36,21 @@ copy () {
|
||||
|
||||
readarray -td' ' files <<< "$1"
|
||||
for f in ${files[@]}; do
|
||||
if [[ "$f" =~ .*update[.]conf.* ]] || [[ "$f" =~ .*current[.]conf.* ]]
|
||||
then
|
||||
if [ "$f" = "update.conf" ] || [ "$f" = "current.conf" ]; then
|
||||
continue
|
||||
fi
|
||||
if grep -qE "^.*[.]conf\s*$" <<< ${f}; then
|
||||
local __f=${f#*etc/}
|
||||
if ! cp "${customer_id_base_dir}/${f}" "/etc/${__f}"; then
|
||||
log_error "$func:${LINENO}: cannot "\
|
||||
"cp ${customer_id_base_dir}/${f} /etc/${__f}"
|
||||
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/${__f}"
|
||||
log_info "$func:${LINENO}: copied $f to /etc/psa_config"
|
||||
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
|
||||
# TODO: die anderen system-verzeichnisse werden gebraucht
|
||||
local __f=${f#*opt/app/ATBAPP/}
|
||||
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
|
||||
fi
|
||||
fi
|
||||
log_info "$func:${LINENO}: copied $f to /opt/app/ATBAPP/${__f}"
|
||||
# TODO
|
||||
set -x
|
||||
:
|
||||
set +x
|
||||
fi
|
||||
done
|
||||
|
||||
@ -67,7 +58,7 @@ copy () {
|
||||
return 0;
|
||||
}
|
||||
|
||||
filter_conf_ini_files () {
|
||||
filter_system_files () {
|
||||
local func="${FUNCNAME[0]}"
|
||||
log_debug "$func:${LINENO} $1"
|
||||
readarray -td' ' files <<< "$1"
|
||||
@ -105,35 +96,44 @@ check_md5_for_changed_conf_and_ini_files () {
|
||||
readarray -td' ' files <<< "$1"
|
||||
for file in ${files[@]}; do
|
||||
log_debug "$func:${LINENO} file=$file"
|
||||
if [[ "$file" =~ .*emp[.]conf.* ]]; then
|
||||
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)
|
||||
md5sum_repository="$(md5_of $emp_conf)"
|
||||
elif [[ "$file" =~ .*printer[.]conf.* ]]; then
|
||||
elif [ "$file" = "printer.conf" ]; then
|
||||
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
|
||||
elif [ "$file" = "device.conf" ]; then
|
||||
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.ATBAPP.ATBQT"
|
||||
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
|
||||
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
|
||||
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/ISMASMgr[.]ini.* ]]; then
|
||||
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)
|
||||
elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user