]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test/TEST-06: make autorelabel.service a static file too
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Dec 2019 19:46:48 +0000 (20:46 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 10:46:47 +0000 (11:46 +0100)
test/test-functions
test/units/autorelabel.service [new file with mode: 0644]

index b38c04c6b3d03dc9f9336baaee03b9bc1f9cda25..35c2d16404015607303b7187c2a978331089a672 100644 (file)
@@ -353,27 +353,9 @@ setup_selinux() {
         exit 1
     fi
 
-    cat <<EOF >$initdir/etc/systemd/system/autorelabel.service
-[Unit]
-Description=Relabel all filesystems
-DefaultDependencies=no
-Requires=local-fs.target
-Conflicts=shutdown.target
-After=local-fs.target
-Before=sysinit.target shutdown.target
-ConditionSecurity=selinux
-ConditionPathExists=|/.autorelabel
-
-[Service]
-ExecStart=/bin/sh -x -c 'echo 0 >/sys/fs/selinux/enforce && fixfiles -f -F relabel && rm /.autorelabel && systemctl --force reboot'
-Type=oneshot
-TimeoutSec=0
-RemainAfterExit=yes
-EOF
-
     touch $initdir/.autorelabel
-    mkdir -p $initdir/etc/systemd/system/basic.target.wants
-    ln -fs autorelabel.service $initdir/etc/systemd/system/basic.target.wants/autorelabel.service
+    mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/basic.target.wants
+    ln -sf ../autorelabel.service $initdir/usr/lib/systemd/tests/testdata/units/basic.target.wants/
 
     dracut_install $_fixfiles_tools
     dracut_install fixfiles
diff --git a/test/units/autorelabel.service b/test/units/autorelabel.service
new file mode 100644 (file)
index 0000000..cb38849
--- /dev/null
@@ -0,0 +1,18 @@
+[Unit]
+Description=Relabel all filesystems
+DefaultDependencies=no
+Requires=local-fs.target
+Conflicts=shutdown.target
+After=local-fs.target
+Before=sysinit.target shutdown.target
+ConditionSecurity=selinux
+ConditionPathExists=|/.autorelabel
+
+[Service]
+ExecStart=sh -x -c 'echo 0 >/sys/fs/selinux/enforce && fixfiles -f -F relabel && rm /.autorelabel && systemctl --force reboot'
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+
+[Install]
+WantedBy=basic.target