[systemd-devel] [PATCH 3/6] tests: don't hardcode systemctl path

Martin Pitt martin.pitt at ubuntu.com
Sun Feb 1 15:19:30 PST 2015


Get it from type -P instead, to support --enable-split-usr.
---
 Makefile.am         | 2 +-
 test/end.service    | 6 ------
 test/end.service.in | 6 ++++++
 test/test-functions | 3 ++-
 4 files changed, 9 insertions(+), 8 deletions(-)
 delete mode 100644 test/end.service
 create mode 100644 test/end.service.in

diff --git a/Makefile.am b/Makefile.am
index e3ba11c..0fd5ca3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1433,7 +1433,7 @@ EXTRA_DIST += \
 	test/c.service \
 	test/daughter.service \
 	test/d.service \
-	test/end.service \
+	test/end.service.in \
 	test/e.service \
 	test/f.service \
 	test/grandchild.service \
diff --git a/test/end.service b/test/end.service
deleted file mode 100644
index 0f04dfe..0000000
--- a/test/end.service
+++ /dev/null
@@ -1,6 +0,0 @@
-[Unit]
-Description=End the test
-After=testsuite.service
-
-[Service]
-ExecStart=/usr/bin/systemctl poweroff --no-block
diff --git a/test/end.service.in b/test/end.service.in
new file mode 100644
index 0000000..4857ffe
--- /dev/null
+++ b/test/end.service.in
@@ -0,0 +1,6 @@
+[Unit]
+Description=End the test
+After=testsuite.service
+
+[Service]
+ExecStart=@SYSTEMCTL@ poweroff --no-block
diff --git a/test/test-functions b/test/test-functions
index a0f1bf4..42c954d 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -293,7 +293,8 @@ install_terminfo() {
 }
 
 setup_testsuite() {
-    cp $TEST_BASE_DIR/{testsuite.target,end.service} $initdir/etc/systemd/system/
+    cp $TEST_BASE_DIR/testsuite.target $initdir/etc/systemd/system/
+    sed "s#@SYSTEMCTL@#$(type -P systemctl)#g" $TEST_BASE_DIR/end.service.in > $initdir/etc/systemd/system/end.service
 
     mkdir -p $initdir/etc/systemd/system/testsuite.target.wants
     ln -fs $TEST_BASE_DIR/testsuite.service $initdir/etc/systemd/system/testsuite.target.wants/testsuite.service
-- 
2.1.4



More information about the systemd-devel mailing list