mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
- install -m 0755 dracut-initramfs-backup.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-backup
+ install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
- install -m 0644 dracut-backup.service $(DESTDIR)$(systemdsystemunitdir); \
- install -m 0644 dracut-restore.service $(DESTDIR)$(systemdsystemunitdir); \
- mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \
+ install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
- ln -s ../dracut-backup.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/dracut-backup.service; \
- ln -s ../dracut-restore.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-restore.service; \
+ ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \
fi
clean:
+++ /dev/null
-# 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=Save /run/initramfs
-ConditionPathExists=/run/initramfs
-
-[Service]
-ExecStart=/usr/lib/dracut/dracut-initramfs-backup backup
-Type=oneshot
-RemainAfterExit=yes
+++ /dev/null
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-set -e
-cd /run/initramfs
-
-if [ "x$1" = "xbackup" ]; then
- compress="gzip"
- command -v pigz > /dev/null 2>&1 && compress="pigz"
- find . |cpio -H newc -o --quiet \
- | pigz > /var/lib/initramfs/_run_initramfs-backup.cpio.gz
- mv -f /var/lib/initramfs/_run_initramfs-backup.cpio.gz \
- /var/lib/initramfs/run_initramfs-backup.cpio.gz
- rm -fr etc bin lib lib64 sbin shutdown tmp usr var
- > .backuped
-elif [ "x$1" = "xrestore" ]; then
- [ -f .backuped -a -f /var/lib/initramfs/run_initramfs-backup.cpio.gz ] || exit 1
- zcat /var/lib/initramfs/run_initramfs-backup.cpio.gz | cpio -id >/dev/null 2>&1
- rm .backuped
- rm -f /var/lib/initramfs/run_initramfs-backup.cpio.gz
-fi
--- /dev/null
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+set -e
+cd /run/initramfs
+IMG="/boot/initramfs-$(uname -r).img"
+[ -f .need_shutdown -a -f "$IMG" ] || exit 1
+zcat "$IMG" | cpio -id >/dev/null 2>&1
+rm .need_shutdown
After=getty@tty1.service prefdm.service
Before=reboot.service
DefaultDependencies=no
-ConditionPathExists=/run/initramfs/.backuped
+ConditionPathExists=/run/initramfs/.need_shutdown
[Service]
-ExecStart=/usr/lib/dracut/dracut-initramfs-backup restore
+ExecStart=/usr/lib/dracut/dracut-initramfs-restore
Type=oneshot
-RemainAfterExit=yes
\ No newline at end of file
+RemainAfterExit=yes
add_dracutmodules+=" rpmversion "
omit_dracutmodules+=" dash "
stdloglvl=3
-prefix=/run/initramfs
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm openvt "
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-logger
-%{dracutlibdir}/dracut-initramfs-backup
+%{dracutlibdir}/dracut-initramfs-restore
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
# mark device as asked
>> /tmp/cryptroot-asked-$2
+need_shutdown
udevsettle
exit 0
ln -s /dev/mapper/live-rw /dev/root
printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh
+need_shutdown
+
exit 0
rm -f /etc/lvm/lvm.conf
fi
unset lvmwritten
+
+need_shutdown
containers="$containers $md"
continue
fi
- mdadm -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
done
for md in $containers; do
- mdadm -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1 || need_shutdown
done
unset containers udevinfo
if [ -e /etc/multipath.conf ]; then
modprobe dm-multipath
multipathd -B || multipathd
+ need_shutdown
else
rm /etc/udev/rules.d/??-multipath.rules 2>/dev/null
fi
else
echo -n "$netif" > /sys/module/fcoe/parameters/create
fi
+
+need_shutdown
handle_netroot $iroot
fi
+need_shutdown
+
# now we have a root filesystem somewhere in /dev/sda*
# let the normal block handler handle root=
exit 0
# NBD doesn't emit uevents when it gets connected, so kick it
echo change > /sys/block/nbd0/uevent
udevadm settle
+need_shutdown
exit 0
# force udevsettle to break
> $hookdir/initqueue/work
-
+need_shutdown
# check, if we have to mount the /usr filesystem
while read _dev _mp _fs _opts _rest; do
if [ "$_mp" = "/usr" ]; then
+ case "$_dev" in
+ LABEL=*)
+ _dev="$(echo $_dev | sed 's,/,\\x2f,g')"
+ _dev="/dev/disk/by-label/${_dev#LABEL=}"
+ ;;
+ UUID=*)
+ _dev="${_dev#block:}"
+ _dev="/dev/disk/by-uuid/${_dev#UUID=}"
+ ;;
+ esac
echo "$_dev ${NEWROOT}${_mp} $_fs ${_opts} $_rest"
_usr_found="1"
break
fi
done
}
+
+need_shutdown() {
+ >/run/initramfs/.need_shutdown
+}