diff options
Diffstat (limited to 'systemd')
-rwxr-xr-x | systemd/fedora-import-state | 14 | ||||
-rwxr-xr-x | systemd/fedora-readonly | 16 | ||||
-rwxr-xr-x | systemd/fedora-storage-init | 3 | ||||
-rw-r--r-- | systemd/system/fedora-import-state.service | 14 | ||||
-rw-r--r-- | systemd/system/fedora-readonly.service | 3 | ||||
-rw-r--r-- | systemd/system/fedora-storage-init-late.service | 3 | ||||
-rw-r--r-- | systemd/system/fedora-storage-init.service | 3 | ||||
-rw-r--r-- | systemd/system/fedora-wait-storage.service | 5 |
8 files changed, 53 insertions, 8 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/fedora-readonly b/systemd/fedora-readonly index 4e8003a2..0690cd45 100755 --- a/systemd/fedora-readonly +++ b/systemd/fedora-readonly @@ -16,6 +16,12 @@ if [ -e "/sys/fs/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "ke fi fi +selinux_fixup() { + if [ -n "$SELINUX_STATE" ] && [ -e "$1" ]; then + restorecon -R "$1" + fi +} + # Only read this once. [ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline) @@ -75,7 +81,7 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT" fi - for file in /etc/rwtab /etc/rwtab.d/* /dev/.initramfs/rwtab ; do + for file in /etc/rwtab /etc/rwtab.d/* /run/initramfs/rwtab ; do is_ignored_file "$file" && continue [ -f $file ] && cat $file | while read type path ; do case "$type" in @@ -91,12 +97,12 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then *) ;; esac - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done done # Use any state passed by initramfs - [ -d /dev/.initramfs/state ] && cp -a /dev/.initramfs/state/* $RW_MOUNT + [ -d /run/initramfs/state ] && cp -a /run/initramfs/state/* $RW_MOUNT # In theory there should be no more than one network interface active # this early in the boot process -- the one we're booting from. @@ -153,14 +159,14 @@ if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then for path in $(grep -v "^#" "$file" 2>/dev/null); do mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done done if [ -f "$STATE_MOUNT/files" ] ; then for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" + selinux_fixup "$path" done fi fi diff --git a/systemd/fedora-storage-init b/systemd/fedora-storage-init index 46d8bfb3..962102af 100755 --- a/systemd/fedora-storage-init +++ b/systemd/fedora-storage-init @@ -19,6 +19,8 @@ if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then modprobe dm-mirror >/dev/null 2>&1 dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i) if [ "$?" = "0" ]; then + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") for dmname in $dmraidsets; do if [[ "$dmname" == isw_* ]] && \ ! strstr "$cmdline" noiswmd; then @@ -27,6 +29,7 @@ if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then /sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1 /sbin/kpartx -u -a -p p "/dev/mapper/$dmname" done + IFS=$SAVEIFS fi fi diff --git a/systemd/system/fedora-import-state.service b/systemd/system/fedora-import-state.service new file mode 100644 index 00000000..00d3d066 --- /dev/null +++ b/systemd/system/fedora-import-state.service @@ -0,0 +1,14 @@ +[Unit] +Description=Import network configuration from initramfs +DefaultDependencies=no +ConditionPathIsReadWrite=/ +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 diff --git a/systemd/system/fedora-readonly.service b/systemd/system/fedora-readonly.service index eca197f0..2a7db25f 100644 --- a/systemd/system/fedora-readonly.service +++ b/systemd/system/fedora-readonly.service @@ -2,12 +2,11 @@ Description=Configure read-only root support DefaultDependencies=no Conflicts=shutdown.target -Before=shutdown.target emergency.service emergency.target systemd-tmpfiles-setup.service +Before=shutdown.target emergency.service emergency.target systemd-tmpfiles-setup.service local-fs.target After=remount-rootfs.service [Service] ExecStart=/lib/systemd/fedora-readonly Type=oneshot TimeoutSec=0 -StandardInput=tty RemainAfterExit=yes diff --git a/systemd/system/fedora-storage-init-late.service b/systemd/system/fedora-storage-init-late.service index bfd4b73b..69ad0891 100644 --- a/systemd/system/fedora-storage-init-late.service +++ b/systemd/system/fedora-storage-init-late.service @@ -5,6 +5,9 @@ Conflicts=shutdown.target After=cryptsetup.target fedora-storage-init.service Before=local-fs.target shutdown.target Wants=fedora-wait-storage.service +ConditionFileIsExecutable=|/sbin/lvm +ConditionFileIsExecutable=|/sbin/dmraid +ConditionPathExists=|/etc/multipath.conf [Service] ExecStart=/lib/systemd/fedora-storage-init diff --git a/systemd/system/fedora-storage-init.service b/systemd/system/fedora-storage-init.service index add337b6..6d8e39ff 100644 --- a/systemd/system/fedora-storage-init.service +++ b/systemd/system/fedora-storage-init.service @@ -5,6 +5,9 @@ Conflicts=shutdown.target After=fedora-wait-storage.service Before=local-fs.target shutdown.target Wants=fedora-wait-storage.service +ConditionFileIsExecutable=|/sbin/lvm +ConditionFileIsExecutable=|/sbin/dmraid +ConditionPathExists=|/etc/multipath.conf [Service] ExecStart=/lib/systemd/fedora-storage-init diff --git a/systemd/system/fedora-wait-storage.service b/systemd/system/fedora-wait-storage.service index 230dadec..9d3b6ae9 100644 --- a/systemd/system/fedora-wait-storage.service +++ b/systemd/system/fedora-wait-storage.service @@ -4,7 +4,7 @@ DefaultDependencies=no Conflicts=shutdown.target After=systemd-udev-settle.service Before=local-fs.target shutdown.target -Wants=systemd-udevd.service systemd-udev-settle.service +Wants=systemd-udev-settle.service [Service] ExecStart=-/sbin/rmmod scsi_wait_scan @@ -13,3 +13,6 @@ ExecStart=-/sbin/rmmod scsi_wait_scan Type=oneshot TimeoutSec=0 RemainAfterExit=yes +StandardInput=null +StandardOutput=null +StandardError=null |