summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmove.sh39
-rwxr-xr-x[-rw-r--r--]reset.sh2
2 files changed, 27 insertions, 14 deletions
diff --git a/move.sh b/move.sh
index 7b29fdd87c..0145fff4ba 100755
--- a/move.sh
+++ b/move.sh
@@ -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