diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-01 15:09:06 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-06-01 15:09:06 -0400 |
commit | 36b949f7c4214c6d676d056d6724b55b1abce137 (patch) | |
tree | 3e9bb128cd8fcceae2a4912169548e15f500bbed | |
parent | 26b574cec4b5d1d70baf1d33f36e410fbe2bf176 (diff) |
tidy scripts
-rwxr-xr-x | move.sh | 39 | ||||
-rwxr-xr-x[-rw-r--r--] | reset.sh | 2 |
2 files changed, 27 insertions, 14 deletions
@@ -9,11 +9,7 @@ in_array() { return 1 # Not Found } -set -e - -git checkout -b postmove - -( +move_files() ( for d in libsystemd libudev machine resolve; do mkdir src/$d-new mv -T src/$d src/$d-new/src @@ -112,7 +108,7 @@ git checkout -b postmove mkdir src/libsystemd/libsystemd-journal-internal ) -( +breakup_makefile() ( find . \( -name Makefile -o -name '*.mk' \) -delete touch .tmp.move.all @@ -136,15 +132,32 @@ git checkout -b postmove rm .tmp.move.all ) -( +fixup_includes() ( find src \( -name '*.h' -o -name '*.c' \) \ -exec grep '#include "sd-' -l -- {} + | xargs -d $'\n' sed -ri 's|#include "(sd-[^"]*)"|#include <systemd/\1>|' ) -git add . -git commit -m './move.sh' -git merge -s ours lukeshu/postmove -git checkout lukeshu/postmove -git merge postmove -git branch -d postmove +main() { + set -e + + 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 postmove + + move_files + breakup_makefile + fixup_includes + + git add . + git commit -m './move.sh' + git merge -s ours lukeshu/postmove + git checkout lukeshu/postmove + git merge postmove + git branch -d postmove +} + +main "$@" diff --git a/reset.sh b/reset.sh index fe2eb19a44..66b629c217 100644..100755 --- a/reset.sh +++ b/reset.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e git checkout lukeshu/premove -git branch -D postmove +git branch -D postmove || true git checkout . git clean -xdf |