diff --git a/git_helpers b/git_helpers index be969d4..c3ff404 100755 --- a/git_helpers +++ b/git_helpers @@ -62,14 +62,14 @@ revert_to_commit_before_pull () { clone_customer_repository () { local func="${FUNCNAME[0]}" if [ "$PWD" = "$working_directory" ]; then - if ! [[ -d $workspace_dir ]]; then + if ! [[ -d "./$workspace_dir" ]]; then { mkdir -p ./$workspace_dir; } fi # check if the directory is empty. If so, clone the # customer repository if ! find ./$workspace_dir -mindepth 1 -maxdepth 1 | read; then log_debug "$func:${LINENO} cloning ${1} ..." - if { cd ./$workspace_dir ; }; then + if { cd "./$workspace_dir" ; }; then $(exec_git_command git clone "$1") if [ $? -eq 0 ]; then log_debug "$func:${LINENO} cloning ${1} done" @@ -80,7 +80,7 @@ clone_customer_repository () { else # the directory is not empty, so we assume the # customer-repository has been cloned already - if ! [[ -d ./${workspace_dir}/$customer_id ]]; then + if ! [[ -d "./${workspace_dir}/$customer_id" ]]; then log_fatal "$func:${LINENO} "\ "wrong repository: $(ls -d './${workspace_dir}/*')" else @@ -147,12 +147,22 @@ pull_customer_repository () { return 1 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']/ } 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." read $1 <<< 'yes' cd_home ; return 1 @@ -237,6 +247,8 @@ changed_file_names () { 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 ".*/${f}\s+.*" <<< $git_res; then if ! [ -z $file_names ]; then