]> git.ozlabs.org Git - next-scripts/commitdiff
do_merge: convert to a posix shell script
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 Dec 2022 20:49:49 +0000 (07:49 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 Dec 2022 20:49:49 +0000 (07:49 +1100)
do_merge

index d7ecb2f06c373da945bd450740172ec210b4b1d8..84df69509fa56b8daa3ea85a1a2a9470d607c857 100755 (executable)
--- a/do_merge
+++ b/do_merge
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 no_build=false
 start_from=""
@@ -18,8 +18,7 @@ while getopts 'ns:' opt; do
 done
 shift $((OPTIND - 1))
 
-# shellcheck source=common.sh
-source "$(dirname "$0")/common.sh"
+. "$(dirname "$0")/common.sh"
 
 log()
 {
@@ -28,9 +27,11 @@ log()
 
 execute()
 {
-       log "$" "$@"
-       "$@" 2>&1 | tee -a "$LOG_FILE"
-       return "${PIPESTATUS[0]}"
+       log '$' "$@"
+       _out="$( "$@" 2>&1 )"
+       _err=$?
+       echo "$_out" | tee -a "$LOG_FILE"
+       return "$_err"
 }
 
 fix_up()
@@ -88,7 +89,7 @@ for h in $heads; do
                done 7<"../pre-merge/$tree"
        fi
        log Merging "$h" "($hlog)"
-       printf -v msg "Merge branch '%s' of %s" "${h#*/}" "$(get_url "$tree")"
+       msg=$(printf "Merge branch '%s' of %s" "${h#*/}" "$(get_url "$tree")")
        if ! execute git merge -m "$msg" "$h"; then
                echo Merge failed 1>&2
                echo "$h" >>../merge.debug
@@ -111,9 +112,9 @@ for h in $heads; do
 #              fi
        fi
 
-       tab=$'\t'
+       tab="$_TAB"
        if [ "${#tree}" -lt 8 ]; then
-               tab=$'\t\t'
+               tab="$_TAB$_TAB"
        fi
        printf '%s%s%s\n' "$tree" "$tab" "$(git rev-parse "$h^{}")" >> "$SHA1_FILE"