mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
test: Integrate custom selinux relabelling unit with firstboot
This commit is contained in:
parent
049b456d9a
commit
a2a734e737
|
@ -3,9 +3,14 @@
|
||||||
Description=Relabel all filesystems
|
Description=Relabel all filesystems
|
||||||
DefaultDependencies=no
|
DefaultDependencies=no
|
||||||
Requires=local-fs.target
|
Requires=local-fs.target
|
||||||
Conflicts=shutdown.target
|
|
||||||
After=local-fs.target
|
After=local-fs.target
|
||||||
Before=sysinit.target shutdown.target
|
Conflicts=shutdown.target
|
||||||
|
Before=shutdown.target
|
||||||
|
Before=multi-user.target
|
||||||
|
# Needs to access /var, which may not have been populated yet
|
||||||
|
After=systemd-tmpfiles-setup.service
|
||||||
|
# Must wait for systemd-machine-id-commit or firstboot-autorelabel will reactivate autorelabel
|
||||||
|
After=systemd-machine-id-commit.service
|
||||||
ConditionSecurity=selinux
|
ConditionSecurity=selinux
|
||||||
ConditionPathExists=|/.autorelabel
|
ConditionPathExists=|/.autorelabel
|
||||||
|
|
||||||
|
@ -16,4 +21,4 @@ TimeoutSec=infinity
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=basic.target
|
WantedBy=multi-user.target
|
||||||
|
|
20
test/units/firstboot-autorelabel.service
Normal file
20
test/units/firstboot-autorelabel.service
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Unit]
|
||||||
|
Description=Activate relabelling on firstboot only
|
||||||
|
DefaultDependencies=no
|
||||||
|
Wants=first-boot-complete.target
|
||||||
|
Requires=local-fs.target
|
||||||
|
After=local-fs.target
|
||||||
|
Conflicts=shutdown.target
|
||||||
|
Before=shutdown.target
|
||||||
|
Before=first-boot-complete.target sysinit.target autorelabel.service
|
||||||
|
ConditionPathIsReadWrite=/etc
|
||||||
|
ConditionFirstBoot=yes
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=touch /.autorelabel
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
Loading…
Reference in a new issue