extended for ini-files

This commit is contained in:
Gerhard Hoffmann 2022-06-02 22:25:08 +02:00
parent 72f8b0b28e
commit 5cc4b6a6b6

View File

@ -62,14 +62,14 @@ revert_to_commit_before_pull () {
clone_customer_repository () { clone_customer_repository () {
local func="${FUNCNAME[0]}" local func="${FUNCNAME[0]}"
if [ "$PWD" = "$working_directory" ]; then if [ "$PWD" = "$working_directory" ]; then
if ! [[ -d $workspace_dir ]]; then if ! [[ -d "./$workspace_dir" ]]; then
{ mkdir -p ./$workspace_dir; } { mkdir -p ./$workspace_dir; }
fi fi
# check if the directory is empty. If so, clone the # check if the directory is empty. If so, clone the
# customer repository # customer repository
if ! find ./$workspace_dir -mindepth 1 -maxdepth 1 | read; then if ! find ./$workspace_dir -mindepth 1 -maxdepth 1 | read; then
log_debug "$func:${LINENO} cloning ${1} ..." log_debug "$func:${LINENO} cloning ${1} ..."
if { cd ./$workspace_dir ; }; then if { cd "./$workspace_dir" ; }; then
$(exec_git_command git clone "$1") $(exec_git_command git clone "$1")
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
log_debug "$func:${LINENO} cloning ${1} done" log_debug "$func:${LINENO} cloning ${1} done"
@ -80,7 +80,7 @@ clone_customer_repository () {
else else
# the directory is not empty, so we assume the # the directory is not empty, so we assume the
# customer-repository has been cloned already # customer-repository has been cloned already
if ! [[ -d ./${workspace_dir}/$customer_id ]]; then if ! [[ -d "./${workspace_dir}/$customer_id" ]]; then
log_fatal "$func:${LINENO} "\ log_fatal "$func:${LINENO} "\
"wrong repository: $(ls -d './${workspace_dir}/*')" "wrong repository: $(ls -d './${workspace_dir}/*')"
else else
@ -147,12 +147,22 @@ pull_customer_repository () {
return 1 return 1
fi fi
# see 'man -Pless\ +/parameter/pattern/string/bash' # see https://www.gnu.org/
# software/bash/manual/html_node/Shell-Parameter-Expansion.html
# [...]
#
# ${parameter//pattern/string}
#
# If there are two slashes separating parameter and pattern (...),
# all matches of pattern are replaced with string.
#
# If the expansion of string is null, matches of pattern are deleted.
# [...]
git_result=${git_result//[$'\r\n\t']/ } git_result=${git_result//[$'\r\n\t']/ }
log_debug "$func:${LINENO} git-pull-result=${git_result}" log_debug "$func:${LINENO} git-pull-result=${git_result}"
if grep -qE "^Already\s+\up\s+\to\s+date.*$" <<< $git_result; then if grep -qE "^Already\s+\up\s+\to\s+date.*$" <<< "$git_result"; then
log_warn "$func:${LINENO}: repository $PWD already up to date." log_warn "$func:${LINENO}: repository $PWD already up to date."
read $1 <<< 'yes' read $1 <<< 'yes'
cd_home ; return 1 cd_home ; return 1
@ -237,6 +247,8 @@ changed_file_names () {
local file_names="" local file_names=""
local known_files=(update.conf current.conf emp.conf) local known_files=(update.conf current.conf emp.conf)
known_files=(${known_files[@]} device.conf printer.conf opkg_commands) 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 for f in ${known_files[@]} ; do
if grep -qE ".*/${f}\s+.*" <<< $git_res; then if grep -qE ".*/${f}\s+.*" <<< $git_res; then
if ! [ -z $file_names ]; then if ! [ -z $file_names ]; then