aboutsummaryrefslogtreecommitdiffstats
path: root/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'systemd')
-rwxr-xr-xsystemd/fedora-import-state14
-rw-r--r--systemd/system/fedora-import-state.service13
2 files changed, 27 insertions, 0 deletions
diff --git a/systemd/fedora-import-state b/systemd/fedora-import-state
new file mode 100755
index 00000000..a853ab9c
--- /dev/null
+++ b/systemd/fedora-import-state
@@ -0,0 +1,14 @@
+#!/bin/bash
+# fedora-import-state: import state files from initramfs (e.g. network config)
+
+# exit early if root isn't writeable
+[ -w / ] || exit 0
+
+# copy state into root
+cd /run/initramfs/state
+cp -a -t / .
+
+# run restorecon on the copied files
+if [ -e /sys/fs/selinux/enforce ]; then
+ find . | ( cd /; restorecon -i -f -; ) || :
+fi
diff --git a/systemd/system/fedora-import-state.service b/systemd/system/fedora-import-state.service
new file mode 100644
index 00000000..5294fe17
--- /dev/null
+++ b/systemd/system/fedora-import-state.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Import network configuration from initramfs
+DefaultDependencies=no
+ConditionDirectoryNotEmpty=/run/initramfs/state
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target systemd-tmpfiles-setup.service
+After=remount-rootfs.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-import-state
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes