summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-11 00:01:10 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-11 00:01:10 -0400
commitf896833d84ef58774b892b6439eb3f2dd5d28f59 (patch)
treecf7c25e576ef27be9e444f96b756a4a401b87f8a
parentcb2fcb1fdf2a6620749f2f38ab6e85868c72a2c9 (diff)
tools/notsd-move: better logging
-rwxr-xr-xtools/notsd-move56
1 files changed, 31 insertions, 25 deletions
diff --git a/tools/notsd-move b/tools/notsd-move
index a65d29e946..577f3c6daa 100755
--- a/tools/notsd-move
+++ b/tools/notsd-move
@@ -660,7 +660,6 @@ move_files() (
)
breakup_makefile() (
- set -x
mkdir -p build-aux/Makefile.{once,each}.{head,tail}
touch .tmp.move.all
@@ -740,43 +739,50 @@ breakup_zshcompletion() (
rm _systemd
)
+run() (
+ local tmp
+ tmp="$(mktemp --tmpdir)"
+ trap 'rm -f -- "$tmp"' EXIT
+ "$0" "$@" |& tail -n20 > "$tmp" || { r=$?; cat "$tmp"; return $r; }
+ return 0
+)
+
move() (
find . \( -name Makefile -o -name '*.mk' \) -delete
>&2 echo ' => breakup_zshcompletion'
- breakup_zshcompletion
+ run breakup_zshcompletion
>&2 echo ' => move_files'
- move_files
+ run move_files
>&2 echo ' => breakup_makefile'
- "$0" breakup_makefile |& tail -n20 > .tmp.log || { r=$?; cat .tmp.log; exit $r; }
- rm .tmp.log
+ run breakup_makefile
>&2 echo ' => ./tools/notsd-fixup'
./tools/notsd-fixup
)
main() {
- set -e
- set -o pipefail
-
- if [[ $# -gt 0 ]]; then
- "$@"
- else
- if [[ -n "$(git status -s)" ]] || [[ -n "$(git clean -xdn)" ]]; then
- echo 'There are changes in the current directory.' >&2
- exit 1
- fi
+ if [[ -n "$(git status -s)" ]] || [[ -n "$(git clean -xdn)" ]]; then
+ echo 'There are changes in the current directory.' >&2
+ exit 1
+ fi
- git checkout -b tmp/postmove
+ git checkout -b tmp/postmove
- move
+ move
- git add .
- git commit -m './tools/notsd-move'
- git merge -s ours notsystemd/postmove
- git checkout notsystemd/postmove
- git merge tmp/postmove
- git branch -d tmp/postmove
- fi
+ git add .
+ git commit -m './tools/notsd-move'
+ git merge -s ours notsystemd/postmove
+ git checkout notsystemd/postmove
+ git merge tmp/postmove
+ git branch -d tmp/postmove
}
-main "$@"
+set -e
+set -o pipefail
+if [[ $# -gt 0 ]]; then
+ set -x;
+else
+ set -- main
+fi
+"$@"