init-storage: Copy file contexts from rootfs

Apparently, BusyBox's `cp` does NOT copy SELinux contexts when the `-a`
argument is specified.  This differs from GNU coreutils's `cp`, and
explains why the files copied from the rootfs image to the persistent
storage volume were not being labelled correctly.  The `-c` argument is
required.

Now that files are labelled correctly when they are copied, the step to
run `restorecon` is no longer necessary.
This commit is contained in:
2023-03-14 14:39:22 -05:00
parent 31d8a98f64
commit 292a4d2268
3 changed files with 32 additions and 16 deletions

View File

@@ -1,15 +0,0 @@
[Unit]
Description=Restore SELinux file contexts in /var
ConditionNeedsUpdate=/var
DefaultDependencies=no
After=local-fs.target
Before=sysinit.target
Before=systemd-tmpfiles-setup.service
Before=systemd-update-done.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/restorecon -RFv /var
[Install]
WantedBy=sysinit.target