aboutsummaryrefslogtreecommitdiffstats
path: root/systemd
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-10-15 16:25:31 -0400
committerBill Nottingham <notting@redhat.com>2010-10-15 16:25:31 -0400
commit59b2f505ea603ef65823615711b5adfa87795f41 (patch)
treed5b42a97c7c6e964d920c51f39d890313b997b09 /systemd
parent675389f11ffaab590e9dedabc821e33745e3eb5c (diff)
downloadinitscripts-59b2f505ea603ef65823615711b5adfa87795f41.tar
initscripts-59b2f505ea603ef65823615711b5adfa87795f41.tar.gz
initscripts-59b2f505ea603ef65823615711b5adfa87795f41.tar.bz2
initscripts-59b2f505ea603ef65823615711b5adfa87795f41.tar.xz
initscripts-59b2f505ea603ef65823615711b5adfa87795f41.zip
Add split-out bits of rc.sysinit and associated service files. Remove sysinit.service. Based on work by Harald Hoyer (<harald@redhat.com>)
sysinit-hack/unhack will be removed once the net hotplug stuff is fixed to not require this.
Diffstat (limited to 'systemd')
-rwxr-xr-xsystemd/fedora-cleanup58
-rwxr-xr-xsystemd/fedora-configure25
-rwxr-xr-xsystemd/fedora-init-crypto5
-rwxr-xr-xsystemd/fedora-loadmodules11
-rwxr-xr-xsystemd/fedora-mountall243
-rwxr-xr-xsystemd/fedora-readonly167
-rwxr-xr-xsystemd/fedora-storage-init42
-rwxr-xr-xsystemd/fedora-swapon20
-rw-r--r--systemd/system/fedora-cleanup.service13
-rw-r--r--systemd/system/fedora-configure.service13
-rw-r--r--systemd/system/fedora-init-crypto-1.service14
-rw-r--r--systemd/system/fedora-init-crypto-2.service14
-rw-r--r--systemd/system/fedora-init-crypto-3.service14
-rw-r--r--systemd/system/fedora-loadmodules.service15
-rw-r--r--systemd/system/fedora-mountall.service14
-rw-r--r--systemd/system/fedora-readonly.service14
-rw-r--r--systemd/system/fedora-storage-init.service13
-rw-r--r--systemd/system/fedora-swapon.service13
-rw-r--r--systemd/system/fedora-sysinit-hack.service10
-rw-r--r--systemd/system/fedora-sysinit-unhack.service10
-rw-r--r--systemd/system/fedora-wait-storage.service15
-rw-r--r--systemd/system/single.service2
-rw-r--r--systemd/system/sysinit.service19
23 files changed, 744 insertions, 20 deletions
diff --git a/systemd/fedora-cleanup b/systemd/fedora-cleanup
new file mode 100755
index 00000000..4f6b8c0d
--- /dev/null
+++ b/systemd/fedora-cleanup
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Clean out various old state.
+#
+
+SELINUX_STATE=
+if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
+ if [ -r "/selinux/enforce" ] ; then
+ SELINUX_STATE=$(cat "/selinux/enforce")
+ else
+ # assume enforcing if you can't read it
+ SELINUX_STATE=1
+ fi
+fi
+
+# Clean out /.
+rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \
+ /poweroff /.suspended &> /dev/null
+
+# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might...
+_NEED_XFILES=
+[ -f /var/run/utmpx ] || [ -f /var/log/wtmpx ] && _NEED_XFILES=1
+
+# Clean up /var.
+rm -rf /var/lock/cvs/* /var/run/screen/*
+find /var/lock /var/run ! -type d -exec rm -f {} \;
+rm -f /var/lib/rpm/__db* &> /dev/null
+rm -f /var/gdm/.gdmfifo &> /dev/null
+
+# Clean up utmp/wtmp
+> /var/run/utmp
+touch /var/log/wtmp /var/log/btmp
+chgrp utmp /var/run/utmp /var/log/wtmp /var/log/btmp
+chmod 0664 /var/run/utmp /var/log/wtmp
+chmod 0600 /var/log/btmp
+if [ -n "$_NEED_XFILES" ]; then
+ > /var/run/utmpx
+ touch /var/log/wtmpx
+ chgrp utmp /var/run/utmpx /var/log/wtmpx
+ chmod 0664 /var/run/utmpx /var/log/wtmpx
+fi
+[ -n "$SELINUX_STATE" ] && restorecon /var/run/utmp* /var/log/wtmp* >/dev/null 2>&1
+
+# Clean up various /tmp bits
+[ -n "$SELINUX_STATE" ] && restorecon /tmp
+rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
+rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
+ /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
+ /tmp/scrollkeeper-* /tmp/ssh-* \
+ /dev/.in_sysinit
+
+# Make ICE directory
+mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1
+chown root:root /tmp/.ICE-unix
+[ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
+
+# create the crash indicator flag to warn on crashes, offer fsck with timeout
+touch /.autofsck &> /dev/null
diff --git a/systemd/fedora-configure b/systemd/fedora-configure
new file mode 100755
index 00000000..3a8c6dc4
--- /dev/null
+++ b/systemd/fedora-configure
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Configure machine if necessary.
+
+. /etc/init.d/functions
+
+if [ -f /.unconfigured ]; then
+ if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then
+ /usr/bin/rhgb-client --quit
+ fi
+
+ if [ -x /usr/sbin/firstboot ]; then
+ /usr/sbin/firstboot
+ fi
+
+ # Reread in network configuration data.
+ if [ -f /etc/sysconfig/network ]; then
+ . /etc/sysconfig/network
+
+ # Reset the hostname.
+ action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME}
+ fi
+
+ rm -f /.unconfigured
+fi
diff --git a/systemd/fedora-init-crypto b/systemd/fedora-init-crypto
new file mode 100755
index 00000000..9134d93f
--- /dev/null
+++ b/systemd/fedora-init-crypto
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. /etc/init.d/functions
+
+[ -f /etc/crypttab ] && init_crypto $1
diff --git a/systemd/fedora-loadmodules b/systemd/fedora-loadmodules
new file mode 100755
index 00000000..4fd167c4
--- /dev/null
+++ b/systemd/fedora-loadmodules
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Load other user-defined modules
+for file in /etc/sysconfig/modules/*.modules ; do
+ [ -x $file ] && $file
+done
+
+# Load modules (for backward compatibility with VARs)
+if [ -f /etc/rc.modules ]; then
+ /etc/rc.modules
+fi
diff --git a/systemd/fedora-mountall b/systemd/fedora-mountall
new file mode 100755
index 00000000..e66c0b2b
--- /dev/null
+++ b/systemd/fedora-mountall
@@ -0,0 +1,243 @@
+#!/bin/bash
+#
+# fsck, mount, set quotas, and relabel filesystems.
+#
+
+. /etc/init.d/functions
+
+PLYMOUTH=
+[ -x /usr/bin/plymouth ] && PLYMOUTH=yes
+
+# Check SELinux status
+SELINUX_STATE=
+if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
+ if [ -r "/selinux/enforce" ] ; then
+ SELINUX_STATE=$(cat "/selinux/enforce")
+ else
+ # assume enforcing if you can't read it
+ SELINUX_STATE=1
+ fi
+fi
+
+disable_selinux() {
+ echo $"*** Warning -- SELinux is active"
+ echo $"*** Disabling security enforcement for system recovery."
+ echo $"*** Run 'setenforce 1' to reenable."
+ echo "0" > "/selinux/enforce"
+}
+
+relabel_selinux() {
+ # if /sbin/init is not labeled correctly this process is running in the
+ # wrong context, so a reboot will be required after relabel
+ AUTORELABEL=
+ . /etc/selinux/config
+ echo "0" > /selinux/enforce
+ [ -n "$PLYMOUTH" ] && plymouth --hide-splash
+
+ if [ "$AUTORELABEL" = "0" ]; then
+ echo
+ echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required. "
+ echo $"*** /etc/selinux/config indicates you want to manually fix labeling"
+ echo $"*** problems. Dropping you to a shell; the system will reboot"
+ echo $"*** when you leave the shell."
+ sulogin
+
+ else
+ echo
+ echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required."
+ echo $"*** Relabeling could take a very long time, depending on file"
+ echo $"*** system size and speed of hard drives."
+
+ /sbin/fixfiles -F restore > /dev/null 2>&1
+ fi
+ rm -f /.autorelabel
+ echo $"Unmounting file systems"
+ umount -a
+ mount -n -o remount,ro /
+ echo $"Automatic reboot in progress."
+ reboot -f
+}
+
+[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline)
+
+if [ -f /fastboot ] || strstr "$cmdline" fastboot ; then
+ fastboot=yes
+fi
+
+if [ -f /fsckoptions ]; then
+ fsckoptions=$(cat /fsckoptions)
+fi
+
+if [ -f /forcefsck ] || strstr "$cmdline" forcefsck ; then
+ fsckoptions="-f $fsckoptions"
+elif [ -f /.autofsck ]; then
+ [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck
+ if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then
+ AUTOFSCK_OPT="$AUTOFSCK_OPT -f"
+ fi
+ if [ -n "$AUTOFSCK_SINGLEUSER" ]; then
+ [ -n "$PLYMOUTH" ] && plymouth --hide-splash
+ echo
+ echo $"*** Warning -- the system did not shut down cleanly. "
+ echo $"*** Dropping you to a shell; the system will continue"
+ echo $"*** when you leave the shell."
+ [ -n "$SELINUX_STATE" ] && echo "0" > /selinux/enforce
+ sulogin
+ [ -n "$SELINUX_STATE" ] && echo "1" > /selinux/enforce
+ [ -n "$PLYMOUTH" ] && plymouth --show-splash
+ fi
+ fsckoptions="$AUTOFSCK_OPT $fsckoptions"
+fi
+
+if [ "$BOOTUP" = "color" ]; then
+ fsckoptions="-C $fsckoptions"
+else
+ fsckoptions="-V $fsckoptions"
+fi
+
+READONLY=
+if [ -f /etc/sysconfig/readonly-root ]; then
+ . /etc/sysconfig/readonly-root
+fi
+if strstr "$cmdline" readonlyroot ; then
+ READONLY=yes
+ [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable
+ [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state
+fi
+if strstr "$cmdline" noreadonlyroot ; then
+ READONLY=no
+fi
+
+if [[ " $fsckoptions" != *" -y"* ]]; then
+ fsckoptions="-a $fsckoptions"
+fi
+
+_RUN_QUOTACHECK=0
+if strstr "$cmdline" forcequotacheck || [ -f /forcequotacheck ] ; then
+ _RUN_QUOTACHECK=1
+fi
+if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then
+
+ STRING=$"Checking filesystems"
+ echo $STRING
+ fsck -T -t noopts=_netdev -A $fsckoptions
+ rc=$?
+
+ if [ "$rc" -eq "0" ]; then
+ success "$STRING"
+ echo
+ elif [ "$rc" -eq "1" ]; then
+ passed "$STRING"
+ echo
+ elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then
+ echo $"Unmounting file systems"
+ umount -a
+ mount -n -o remount,ro /
+ echo $"Automatic reboot in progress."
+ reboot -f
+ fi
+
+ # A return of 4 or higher means there were serious problems.
+ if [ $rc -gt 1 ]; then
+ [ -n "$PLYMOUTH" ] && plymouth --hide-splash
+
+ failure "$STRING"
+ echo
+ echo
+ echo $"*** An error occurred during the file system check."
+ echo $"*** Dropping you to a shell; the system will reboot"
+ echo $"*** when you leave the shell."
+
+ str=$"(Repair filesystem)"
+ PS1="$str \# # "; export PS1
+ [ "$SELINUX_STATE" = "1" ] && disable_selinux
+ sulogin
+
+ echo $"Unmounting file systems"
+ umount -a
+ mount -n -o remount,ro /
+ echo $"Automatic reboot in progress."
+ reboot -f
+ elif [ "$rc" -eq "1" ]; then
+ _RUN_QUOTACHECK=1
+ fi
+fi
+
+remount_needed() {
+ local state oldifs
+ [ "$READONLY" = "yes" ] && return 1
+ state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts)
+ oldifs=$IFS
+ IFS=","
+ for opt in $state ; do
+ if [ "$opt" = "rw" ]; then
+ IFS=$oldifs
+ return 1
+ fi
+ done
+ IFS=$oldifs
+ return 0
+}
+
+# Remount the root filesystem read-write.
+update_boot_stage RCmountfs
+if remount_needed ; then
+ action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw /
+fi
+
+# Clean up SELinux labels
+if [ -n "$SELINUX_STATE" ]; then
+ restorecon /etc/mtab /etc/ld.so.cache /etc/blkid/blkid.tab /etc/resolv.conf >/dev/null 2>&1
+fi
+
+# If relabeling, relabel mount points.
+if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
+ if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then
+ restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1
+ fi
+fi
+
+if [ "$READONLY" != "yes" ] ; then
+ # Clear mtab
+ (> /etc/mtab) &> /dev/null
+
+ # Remove stale backups
+ rm -f /etc/mtab~ /etc/mtab~~
+
+ # Enter mounted filesystems into /etc/mtab
+ mount -f /
+ mount -f /proc >/dev/null 2>&1
+ mount -f /sys >/dev/null 2>&1
+ mount -f /dev/pts >/dev/null 2>&1
+ mount -f /dev/shm >/dev/null 2>&1
+ mount -f /proc/bus/usb >/dev/null 2>&1
+fi
+
+# Mount all other filesystems (except for NFS and /proc, which is already
+# mounted). Contrary to standard usage,
+# filesystems are NOT unmounted in single user mode.
+if [ "$READONLY" != "yes" ] ; then
+ action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
+else
+ action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev
+fi
+
+# Update quotas if necessary
+if [ X"$_RUN_QUOTACHECK" = X1 ] && [ -x /sbin/quotacheck ]; then
+ action $"Checking local filesystem quotas: " /sbin/quotacheck -anug
+fi
+
+if [ -x /sbin/quotaon ]; then
+ action $"Enabling local filesystem quotas: " /sbin/quotaon -aug
+fi
+
+# Check to see if a full relabel is needed
+if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then
+ if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then
+ relabel_selinux
+ fi
+else
+ if [ "$READONLY" != "yes" ] && [ -d /etc/selinux ]; then
+ [ -f /.autorelabel ] || touch /.autorelabel
+ fi
+fi
diff --git a/systemd/fedora-readonly b/systemd/fedora-readonly
new file mode 100755
index 00000000..70e57a62
--- /dev/null
+++ b/systemd/fedora-readonly
@@ -0,0 +1,167 @@
+#!/bin/bash
+#
+# Set up readonly-root support.
+#
+
+. /etc/init.d/functions
+
+# Check SELinux status
+SELINUX_STATE=
+if [ -e "/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
+ if [ -r "/selinux/enforce" ] ; then
+ SELINUX_STATE=$(cat "/selinux/enforce")
+ else
+ # assume enforcing if you can't read it
+ SELINUX_STATE=1
+ fi
+fi
+
+# Only read this once.
+[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline)
+
+READONLY=
+if [ -f /etc/sysconfig/readonly-root ]; then
+ . /etc/sysconfig/readonly-root
+fi
+if strstr "$cmdline" readonlyroot ; then
+ READONLY=yes
+ [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable
+ [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state
+fi
+if strstr "$cmdline" noreadonlyroot ; then
+ READONLY=no
+fi
+
+if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then
+
+ mount_empty() {
+ if [ -e "$1" ]; then
+ echo "$1" | cpio -p -vd "$RW_MOUNT" &>/dev/null
+ mount -n --bind "$RW_MOUNT$1" "$1"
+ fi
+ }
+
+ mount_dirs() {
+ if [ -e "$1" ]; then
+ mkdir -p "$RW_MOUNT$1"
+ find "$1" -type d -print0 | cpio -p -0vd "$RW_MOUNT" &>/dev/null
+ mount -n --bind "$RW_MOUNT$1" "$1"
+ fi
+ }
+
+ mount_files() {
+ if [ -e "$1" ]; then
+ cp -a --parents "$1" "$RW_MOUNT"
+ mount -n --bind "$RW_MOUNT$1" "$1"
+ fi
+ }
+
+ # Common mount options for scratch space regardless of
+ # type of backing store
+ mountopts=
+
+ # Scan partitions for local scratch storage
+ rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -l -o device)
+
+ # First try to mount scratch storage from /etc/fstab, then any
+ # partition with the proper label. If either succeeds, be sure
+ # to wipe the scratch storage clean. If both fail, then mount
+ # scratch storage via tmpfs.
+ if mount $mountopts "$RW_MOUNT" > /dev/null 2>&1 ; then
+ rm -rf "$RW_MOUNT" > /dev/null 2>&1
+ elif [ x$rw_mount_dev != x ] && mount $rw_mount_dev $mountopts "$RW_MOUNT" > /dev/null 2>&1; then
+ rm -rf "$RW_MOUNT" > /dev/null 2>&1
+ else
+ mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT"
+ fi
+
+ for file in /etc/rwtab /etc/rwtab.d/* /dev/.initramfs/rwtab ; do
+ is_ignored_file "$file" && continue
+ [ -f $file ] && cat $file | while read type path ; do
+ case "$type" in
+ empty)
+ mount_empty $path
+ ;;
+ files)
+ mount_files $path
+ ;;
+ dirs)
+ mount_dirs $path
+ ;;
+ *)
+ ;;
+ esac
+ [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path"
+ done
+ done
+
+ # Use any state passed by initramfs
+ [ -d /dev/.initramfs/state ] && cp -a /dev/.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.
+ # Use the network address to set the hostname of the client. This
+ # must be done even if we have local storage.
+ ipaddr=
+ if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; then
+ ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }')
+ for ip in $ipaddr ; do
+ HOSTNAME=
+ eval $(ipcalc -h $ipaddr 2>/dev/null)
+ [ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; }
+ done
+ fi
+
+ # Clients with read-only root filesystems may be provided with a
+ # place where they can place minimal amounts of persistent
+ # state. SSH keys or puppet certificates for example.
+ #
+ # Ideally we'll use puppet to manage the state directory and to
+ # create the bind mounts. However, until that's all ready this
+ # is sufficient to build a working system.
+
+ # First try to mount persistent data from /etc/fstab, then any
+ # partition with the proper label, then fallback to NFS
+ state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -l -o device)
+ if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then
+ /bin/true
+ elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1; then
+ /bin/true
+ elif [ ! -z "$CLIENTSTATE" ]; then
+ # No local storage was found. Make a final attempt to find
+ # state on an NFS server.
+
+ mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock
+ fi
+
+ if [ -w "$STATE_MOUNT" ]; then
+
+ mount_state() {
+ if [ -e "$1" ]; then
+ [ ! -e "$STATE_MOUNT$1" ] && cp -a --parents "$1" "$STATE_MOUNT"
+ mount -n --bind "$STATE_MOUNT$1" "$1"
+ fi
+ }
+
+ for file in /etc/statetab /etc/statetab.d/* ; do
+ is_ignored_file "$file" && continue
+ [ ! -f "$file" ] && continue
+
+ if [ -f "$STATE_MOUNT/$file" ] ; then
+ mount -n --bind "$STATE_MOUNT/$file" "$file"
+ fi
+
+ for path in $(grep -v "^#" "$file" 2>/dev/null); do
+ mount_state "$path"
+ [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$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"
+ done
+ fi
+ fi
+fi
diff --git a/systemd/fedora-storage-init b/systemd/fedora-storage-init
new file mode 100755
index 00000000..a9c12769
--- /dev/null
+++ b/systemd/fedora-storage-init
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Storage initialization
+
+. /etc/init.d/functions
+
+[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline)
+
+[ -f /etc/crypttab ] && init_crypto 0
+
+if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && \
+ [ -x /sbin/multipath ]; then
+ modprobe dm-multipath > /dev/null 2>&1
+ /sbin/multipath -v 0
+ if [ -x /sbin/kpartx ]; then
+ /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" >/dev/null
+ fi
+fi
+
+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
+ for dmname in $dmraidsets; do
+ if [[ "$dmname" == isw_* ]] && \
+ ! strstr "$cmdline" noiswmd; then
+ continue
+ fi
+ /sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1
+ /sbin/kpartx -a -p p "/dev/mapper/$dmname"
+ done
+ fi
+fi
+
+# Start any MD RAID arrays that haven't been started yet
+[ -r /proc/mdstat -a -r /dev/md/md-device-map ] && /sbin/mdadm -IRs
+
+if [ -x /sbin/lvm ]; then
+ action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit
+fi
+
+[ -f /etc/crypttab ] && init_crypto 0
diff --git a/systemd/fedora-swapon b/systemd/fedora-swapon
new file mode 100755
index 00000000..98c5b273
--- /dev/null
+++ b/systemd/fedora-swapon
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Start up swap (partitions and files)
+#
+
+. /etc/init.d/functions
+
+update_boot_stage RCswap
+action $"Enabling /etc/fstab swaps: " swapon -a -e
+if [ "$AUTOSWAP" = "yes" ]; then
+ curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)
+ swappartitions=$(blkid -t TYPE=swap -o device)
+ if [ x"$swappartitions" != x ]; then
+ for partition in $swappartitions ; do
+ [ ! -e $partition ] && continue
+ majmin=$(get_numeric_dev dec $partition)
+ echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition
+ done
+ fi
+fi
diff --git a/systemd/system/fedora-cleanup.service b/systemd/system/fedora-cleanup.service
new file mode 100644
index 00000000..127fab64
--- /dev/null
+++ b/systemd/system/fedora-cleanup.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Clean out assorted temporary files
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
+After=fedora-mountall.service fedora-readonly.service
+Requires=fedora-mountall.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-cleanup
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
diff --git a/systemd/system/fedora-configure.service b/systemd/system/fedora-configure.service
new file mode 100644
index 00000000..032e94ae
--- /dev/null
+++ b/systemd/system/fedora-configure.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Reconfigure the system on administrator request
+DefaultDependencies=no
+Conflicts=multi-user.target shutdown.target
+Before=multi-user.target shutdown.target
+After=local-fs.target
+
+[Service]
+ExecStart=/lib/systemd/fedora-configure
+Type=oneshot
+TimeoutSec=0
+StandardInput=tty
+RemainAfterExit=yes
diff --git a/systemd/system/fedora-init-crypto-1.service b/systemd/system/fedora-init-crypto-1.service
new file mode 100644
index 00000000..fee6bcce
--- /dev/null
+++ b/systemd/system/fedora-init-crypto-1.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Initialize encrypted storage
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
+After=fedora-wait-storage.service
+Requires=fedora-wait-storage.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-init-crypto 0
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+StandardInput=tty
diff --git a/systemd/system/fedora-init-crypto-2.service b/systemd/system/fedora-init-crypto-2.service
new file mode 100644
index 00000000..2fc128eb
--- /dev/null
+++ b/systemd/system/fedora-init-crypto-2.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Initialize encrypted filesystems on top of other storage
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
+After=fedora-storage-init.service
+Requires=fedora-storage-init.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-init-crypto 0
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+StandardInput=tty
diff --git a/systemd/system/fedora-init-crypto-3.service b/systemd/system/fedora-init-crypto-3.service
new file mode 100644
index 00000000..08d3bf96
--- /dev/null
+++ b/systemd/system/fedora-init-crypto-3.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Initialize encrypted filesystems on top of other storage
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
+After=systemd-random-seed-load.service
+Requires=systemd-random-seed-load.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-init-crypto 1
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+StandardInput=tty
diff --git a/systemd/system/fedora-loadmodules.service b/systemd/system/fedora-loadmodules.service
new file mode 100644
index 00000000..aac773b8
--- /dev/null
+++ b/systemd/system/fedora-loadmodules.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Load legacy module configuration
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=basic.target shutdown.target emergency.service emergency.target
+#Conflicts=sysinit.service
+After=udev.service
+Requires=udev.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-loadmodules
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+
diff --git a/systemd/system/fedora-mountall.service b/systemd/system/fedora-mountall.service
new file mode 100644
index 00000000..af5cf79b
--- /dev/null
+++ b/systemd/system/fedora-mountall.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Check, mount, and relabel all filesystems
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target remount-rootfs.service
+After=fedora-storage-init.service fedora-init-crypto-2.service
+Requires=fedora-storage-init.service fedora-init-crypto-2.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-mountall
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
+StandardInput=tty
diff --git a/systemd/system/fedora-readonly.service b/systemd/system/fedora-readonly.service
new file mode 100644
index 00000000..c1e42367
--- /dev/null
+++ b/systemd/system/fedora-readonly.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Configure read-only root support
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target fedora-cleanup.service
+After=fedora-mountall.service
+Requires=fedora-mountall.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-readonly
+Type=oneshot
+TimeoutSec=0
+StandardInput=tty
+RemainAfterExit=yes
diff --git a/systemd/system/fedora-storage-init.service b/systemd/system/fedora-storage-init.service
new file mode 100644
index 00000000..2806c2dd
--- /dev/null
+++ b/systemd/system/fedora-storage-init.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Initialize storage subsystems (RAID, LVM, etc.)
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target local-fs.target emergency.service emergency.target
+After=fedora-wait-storage.service fedora-init-crypto-1.service
+Requires=fedora-wait-storage.service fedora-init-crypto-1.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-storage-init
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
diff --git a/systemd/system/fedora-swapon.service b/systemd/system/fedora-swapon.service
new file mode 100644
index 00000000..4b945026
--- /dev/null
+++ b/systemd/system/fedora-swapon.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Configure the system if the administrator requested it
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
+After=fedora-mountall.service fedora-init-crypto-3.service
+Requires=fedora-mountall.service fedora-init-crypto-3.service
+
+[Service]
+ExecStart=/lib/systemd/fedora-swapon
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
diff --git a/systemd/system/fedora-sysinit-hack.service b/systemd/system/fedora-sysinit-hack.service
new file mode 100644
index 00000000..dd78da80
--- /dev/null
+++ b/systemd/system/fedora-sysinit-hack.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Bootup hack
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=basic.target shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/touch /dev/.in_sysinit
diff --git a/systemd/system/fedora-sysinit-unhack.service b/systemd/system/fedora-sysinit-unhack.service
new file mode 100644
index 00000000..86e20cd6
--- /dev/null
+++ b/systemd/system/fedora-sysinit-unhack.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Bootup hack
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=shutdown.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=-/bin/rm -f /dev/.in_sysinit
diff --git a/systemd/system/fedora-wait-storage.service b/systemd/system/fedora-wait-storage.service
new file mode 100644
index 00000000..63744b63
--- /dev/null
+++ b/systemd/system/fedora-wait-storage.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Wait for storage scan
+DefaultDependencies=no
+Conflicts=shutdown.target
+Before=local-fs.target shutdown.target emergency.service emergency.target
+After=udev-settle.service
+Requires=udev.service udev-settle.service
+
+[Service]
+ExecStart=-/sbin/rmmod scsi_wait_scan
+ExecStart=-/sbin/modprobe scsi_wait_scan
+ExecStart=-/sbin/rmmod scsi_wait_scan
+Type=oneshot
+TimeoutSec=0
+RemainAfterExit=yes
diff --git a/systemd/system/single.service b/systemd/system/single.service
index d91166b3..4264cd56 100644
--- a/systemd/system/single.service
+++ b/systemd/system/single.service
@@ -11,7 +11,7 @@
Description=Rescue Shell
DefaultDependencies=no
Conflicts=multi-user.target shutdown.target
-After=sysinit.target
+After=basic.target
Before=multi-user.target
[Service]
diff --git a/systemd/system/sysinit.service b/systemd/system/sysinit.service
deleted file mode 100644
index 860d3a34..00000000
--- a/systemd/system/sysinit.service
+++ /dev/null
@@ -1,19 +0,0 @@
-# This file is part of systemd.
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-[Unit]
-Description=System Initialization
-DefaultDependencies=no
-Conflicts=shutdown.target
-Before=shutdown.target emergency.service emergency.target
-
-[Service]
-ExecStart=/etc/rc.d/rc.sysinit
-Type=forking
-TimeoutSec=0
-StandardInput=tty
-RemainAfterExit=yes