summaryrefslogtreecommitdiff
path: root/source/a/mkinitrd/init
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2012-09-26 01:10:42 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 22:51:55 +0200
commit9664bee729d487bcc0a0bc35859f8e13d5421c75 (patch)
treeb428a16618e36ed864a8d76ea3435e19a452bf90 /source/a/mkinitrd/init
parent75a4a592e5ccda30715f93563d741b83e0dcf39e (diff)
downloadcurrent-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.gz
Slackware 14.0slackware-14.0
Wed Sep 26 01:10:42 UTC 2012 Slackware 14.0 x86_64 stable is released! We're perfectionists here at Slackware, so this release has been a long time a-brewing. But we think you'll agree that it was worth the wait. Slackware 14.0 combines modern components, ease of use, and flexible configuration... our "KISS" philosophy demands it. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Thanks to everyone who helped make this happen. The Slackware team, the upstream developers, and (of course) the awesome Slackware user community. Have fun! :-)
Diffstat (limited to 'source/a/mkinitrd/init')
-rwxr-xr-xsource/a/mkinitrd/init49
1 files changed, 31 insertions, 18 deletions
diff --git a/source/a/mkinitrd/init b/source/a/mkinitrd/init
index 2205a592..ae475d89 100755
--- a/source/a/mkinitrd/init
+++ b/source/a/mkinitrd/init
@@ -78,6 +78,7 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin"
# Mount /proc and /sys:
mount -n proc /proc -t proc
mount -n sysfs /sys -t sysfs
+mount -n tmpfs /run -t tmpfs -o mode=0755
if grep devtmpfs /proc/filesystems 1>/dev/null 2>/dev/null ; then
DEVTMPFS=1
@@ -123,7 +124,17 @@ for ARG in $(cat /proc/cmdline); do
esac
done
-# Load kernel modules:
+# If udevd is available, use it to generate block devices
+# else use mdev to read sysfs and generate the needed devices
+if [ -x /sbin/udevd -a -x /sbin/udevadm ]; then
+ /sbin/udevd --daemon --resolve-names=never
+ /sbin/udevadm trigger --subsystem-match=block --action=add
+ /sbin/udevadm settle --timeout=10
+else
+ [ "$DEVTMPFS" != "1" ] && mdev -s
+fi
+
+# Load kernel modules (ideally this was already done by udev):
if [ ! -d /lib/modules/$(uname -r) ]; then
echo "No kernel modules found for Linux $(uname -r)."
elif [ -x ./load_kernel_modules ]; then # use load_kernel_modules script:
@@ -143,16 +154,6 @@ fi
# A root filesystem on USB is a good example of that.
sleep $WAIT
-# If udevd is available, use it to generate block devices
-# else use mdev to read sysfs and generate the needed devices
-if [ -x /sbin/udevd -a -x /sbin/udevadm ]; then
- /sbin/udevd --daemon --resolve-names=never
- /sbin/udevadm trigger --subsystem-match=block --action=add
- /sbin/udevadm settle --timeout=10
-else
- [ "$DEVTMPFS" != "1" ] && mdev -s
-fi
-
# Load a custom keyboard mapping:
if [ -n "$KEYMAP" ]; then
echo "${INITRD}: Loading '$KEYMAP' keyboard mapping:"
@@ -222,7 +223,9 @@ if [ "$RESCUE" = "" ]; then
# Initialize LVM:
if [ -x /sbin/vgchange ]; then
- /sbin/vgchange -ay --ignorelockingfailure
+ mkdir -p /var/lock/lvm # this avoids useless warnings
+ /sbin/vgchange -ay --ignorelockingfailure 2>/dev/null
+ /sbin/udevadm settle --timeout=10
fi
# Unlock any LUKS encrypted devices that were deferred above but have now
@@ -247,8 +250,14 @@ if [ "$RESCUE" = "" ]; then
echo "LUKS device '${LUKSDEV}' unavailable for unlocking!"
fi
done
+ /sbin/udevadm settle --timeout=10
fi
+ # Scan for btrfs multi-device filesystems:
+ if [ -x /sbin/btrfs ]; then
+ /sbin/btrfs device scan
+ fi
+
# Find root device if a label or UUID was given:
if echo $ROOTDEV | grep -q "LABEL=" || \
echo $ROOTDEV | grep -q "UUID=" ; then
@@ -264,14 +273,16 @@ if [ "$RESCUE" = "" ]; then
# Resume state from swap
if [ "$RESUMEDEV" != "" ]; then
if ls -l $RESUMEDEV | grep -q "^l" ; then
- RESUMEDEV=$(ls -l $RESUMEDEV | awk '{ print $NF }')
+ #RESUMEDEV=$(ls -l $RESUMEDEV | awk '{ print $NF }')
+ RESUMEDEV=$(readlink -f $RESUMEDEV)
fi
echo "Trying to resume from $RESUMEDEV"
RESMAJMIN=$(ls -l $RESUMEDEV | tr , : | awk '{ print $5$6 }')
echo $RESMAJMIN > /sys/power/resume
fi
-
+
# Switch to real root partition:
+ /sbin/udevadm settle --timeout=10
echo 0x0100 > /proc/sys/kernel/real-root-dev
mount -o ro -t $ROOTFS $ROOTDEV /mnt
@@ -296,14 +307,16 @@ else
/bin/sh
fi
-if pgrep udevd >/dev/null ; then
- /sbin/udevadm settle --timeout=30
- pkill udevd
-fi
+# Need to make sure OPTIONS+="db_persist" exists for all dm devices
+# That should be handled in /sbin/mkinitrd now
+/sbin/udevadm info --cleanup-db
+/sbin/udevadm control --exit
unset ERR
mount -o move /proc /mnt/proc
mount -o move /sys /mnt/sys
+mount -o move /run /mnt/run
+
[ "$DEVTMPFS" = "1" ] && mount -o move /dev /mnt/dev
echo "${INITRD}: exiting"
exec switch_root /mnt $INIT $RUNLEVEL