test/TEST-06: make autorelabel.service a static file too

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-10 20:46:48 +01:00
parent 1c76b5b5bb
commit 4caa1ac794
2 changed files with 20 additions and 20 deletions

View 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

View File

@ -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