[PATCH] add fedora-import-state.service (fix NFS root: #799989)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dracut writes out an ifcfg-ethX file and a dhclient lease file for the
interface used to mount the runtime. We need to pass that along to
NetworkManager so it won't bring down the interface we're using for our
root device.

This service copies the contents of the /run/initramfs/state directory
into its intended place, as would normally be done in fedora-readonly
for NFS readonly-root systems.

This service will likely be moved into initscripts later.

Cherry-picked from noloader commits:
6f94987bad4a275ff8348f5ca1ed889f3837c14d
5322777d496e0ee0d37103ca4d0f4ef0abe9bd55
---
 data/systemd/Makefile.am                 |    4 +++-
 data/systemd/anaconda.target             |    2 +-
 data/systemd/fedora-import-state         |   14 ++++++++++++++
 data/systemd/fedora-import-state.service |   13 +++++++++++++
 4 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100755 data/systemd/fedora-import-state
 create mode 100644 data/systemd/fedora-import-state.service

diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am
index 37a5eb1..27ce232 100644
--- a/data/systemd/Makefile.am
+++ b/data/systemd/Makefile.am
@@ -18,5 +18,7 @@
 # Author: Chris Lumens <clumens@xxxxxxxxxx>
 
 systemddir = /lib/systemd/system
-dist_systemd_DATA = anaconda-shell@.service anaconda.target loader.service instperf.service
+dist_systemd_DATA = anaconda-shell@.service anaconda.target loader.service instperf.service fedora-import-state.service
+systemdscriptdir = /lib/systemd
+dist_systemd_SCRIPTS = fedora-import-state
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/data/systemd/anaconda.target b/data/systemd/anaconda.target
index 844999e..292720d 100644
--- a/data/systemd/anaconda.target
+++ b/data/systemd/anaconda.target
@@ -4,4 +4,4 @@ Requires=basic.target
 Conflicts=rescue.service rescue.target
 After=basic.target rescue.service rescue.target
 AllowIsolate=yes
-Wants=loader.service anaconda-shell@tty2.service anaconda-shell@hvc1.service
+Wants=loader.service anaconda-shell@tty2.service anaconda-shell@hvc1.service fedora-import-state.service
diff --git a/data/systemd/fedora-import-state b/data/systemd/fedora-import-state
new file mode 100755
index 0000000..a853ab9
--- /dev/null
+++ b/data/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/data/systemd/fedora-import-state.service b/data/systemd/fedora-import-state.service
new file mode 100644
index 0000000..5294fe1
--- /dev/null
+++ b/data/systemd/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
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux