diff options
-rw-r--r-- | Makefile | 1 | ||||
-rwxr-xr-x | systemd/fedora-autorelabel | 4 | ||||
-rw-r--r-- | systemd/system/fedora-autorelabel-mark.service | 15 |
3 files changed, 16 insertions, 4 deletions
@@ -126,6 +126,7 @@ install: ln -s ../fedora-loadmodules.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-autoswap.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-autorelabel.service $(ROOT)/lib/systemd/system/basic.target.wants + ln -s ../fedora-autorelabel-mark.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-sysinit-hack.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-readonly.service $(ROOT)/lib/systemd/system/local-fs.target.wants ln -s ../fedora-storage-init.service $(ROOT)/lib/systemd/system/local-fs.target.wants diff --git a/systemd/fedora-autorelabel b/systemd/fedora-autorelabel index 204c5761..dad7a91f 100755 --- a/systemd/fedora-autorelabel +++ b/systemd/fedora-autorelabel @@ -37,8 +37,4 @@ relabel_selinux() { if [ "$READONLY" != "yes" ]; then restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1 relabel_selinux -else - if [ "$READONLY" != "yes" ] && [ -d /etc/selinux ]; then - [ -f /.autorelabel ] || touch /.autorelabel - fi fi diff --git a/systemd/system/fedora-autorelabel-mark.service b/systemd/system/fedora-autorelabel-mark.service new file mode 100644 index 00000000..33b5147b --- /dev/null +++ b/systemd/system/fedora-autorelabel-mark.service @@ -0,0 +1,15 @@ +[Unit] +Description=Mark the need to relabel after reboot +DefaultDependencies=no +Requires=local-fs.target +Conflicts=shutdown.target +After=local-fs.target +Before=sysinit.target shutdown.target +ConditionSecurity=!selinux +ConditionPathIsDirectory=/etc/selinux +ConditionPathExists=!/.autorelabel + +[Service] +ExecStart=-/bin/touch /.autorelabel +Type=oneshot +RemainAfterExit=yes |