Compare commits

...

3 Commits

3 changed files with 56 additions and 5 deletions

View File

@ -67,17 +67,21 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly customer_base_dir="${__customer_base_dir}/${zone_group}/${zone}"
log_info "$func:${LINENO}: customer-base-dir is $customer_base_dir"
readonly psa_config="${customer_base_dir}/etc/psa_config"
readonly psa_update="${customer_base_dir}/etc/psa_update"
readonly psa_ini="${customer_base_dir}/etc/psa_ini"
readonly emp_conf="${customer_base_dir}/etc/psa_config/emp.conf"
readonly emp_conf="${psa_config}/emp.conf"
log_info "$func:${LINENO}: emp.conf at $emp_conf"
readonly device_conf="${customer_base_dir}/etc/psa_config/device.conf"
readonly device_conf="${psa_config}/device.conf"
log_info "$func:${LINENO}: device.conf at $device_conf"
readonly printer_conf="${customer_base_dir}/etc/psa_config/printer.conf"
readonly printer_conf="${psa_config}/printer.conf"
log_info "$func:${LINENO}: device.conf at $printer_conf"
readonly opkg_cmds_file="${customer_base_dir}/etc/psa_update/opkg_commands"
readonly opkg_cmds_file="${psa_update}/opkg_commands"
log_info "$func:${LINENO}: opkg_cmds_file at $opkg_cmds_file"
return 0

View File

@ -90,12 +90,18 @@ update() {
fi
local files=$(changed_file_names)
local system_files=$(filter_system_files "$files") # conf/ini-files
if ! check_md5_for_changed_conf_and_ini_files "$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
if ! copy $system_files; then
log_error "$func:${LINENO}: copy operation failed"
revert_customer_repository ; exit 1
fi
if grep -qE ".*opkg_commands.*?" <<< $files; then
# read opkg_cmds: each line respresents an opkg-command
readarray opkg_commands < <(cat $opkg_cmds_file)

View File

@ -31,6 +31,47 @@ fetch_customer_updates() {
return 0
}
copy () {
local func="${FUNCNAME[0]}"
readarray -td' ' files <<< "$1"
for f in ${files[@]}; do
if grep -qE "^.*[.]conf.*$" <<< ${f}; then
local __f="${psa_config}/${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
fi
done
log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs"
return 0;
}
filter_system_files () {
local func="${FUNCNAME[0]}"
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
done
log_debug "$func:${LINENO} system-files=$__system_files"
printf '%s' "$__system_files"
}
# Check if the fetched/merged files have the correct md5 and are
# valid for the PSA.
#