From 96a8065fe039e1b76e09342aade4bb3158fa68c5 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Sun, 5 Jun 2022 16:50:04 +0200 Subject: [PATCH] Added copy() and filter_system_files() --- update_psa_helpers | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/update_psa_helpers b/update_psa_helpers index e1b6cd0..e4bea51 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -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. #