summaryrefslogtreecommitdiffstats
path: root/liveinit
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-04-19 00:54:59 +0200
committer Eric Hameleers <alien@slackware.com>2016-04-19 00:54:59 +0200
commit805c57b84916b6e42164427227a98eb317bdad39 (patch)
treef07b46107c077f70d81c9c95af8de74fd5d6e322 /liveinit
parent1adfa329bd1a10ba89267ed3e5ed4b47b34a6f30 (diff)
downloadliveslak-805c57b84916b6e42164427227a98eb317bdad39.tar.gz
liveslak-805c57b84916b6e42164427227a98eb317bdad39.tar.xz
liveinit: make the udev trigger for net devices more rebust.
Diffstat (limited to '')
-rwxr-xr-xliveinit31
1 files changed, 21 insertions, 10 deletions
diff --git a/liveinit b/liveinit
index 008940e..c78c8a7 100755
--- a/liveinit
+++ b/liveinit
@@ -48,8 +48,10 @@ LIVEPATH=""
# to avoid anything that writes to disk after we copy the OS to RAM.
VIRGIN=0
-# Used for debugging the init; set to '1' to enable explicit pauses>
+# Used for debugging the init;
+# Set DEBUG to '1' to enable explicit pauses; '2' enables verbose script exec:
DEBUG=0
+DEBUGV=" "
# Masochists can copy the live environment into RAM:
TORAM=0
@@ -105,6 +107,7 @@ for ARG in $(cat /proc/cmdline); do
;;
debug=*)
DEBUG=$(echo $ARG | cut -f2 -d=)
+ DEBUGV="-v"
;;
hostname=*)
LIVE_HOSTNAME=$(echo $ARG | cut -f2 -d=)
@@ -205,18 +208,19 @@ debugit () {
}
rescue() {
+ echo
if [ "x$1" != "x" ]; then
echo "$1"
+ else
+ echo "RESCUE mode"
+ echo
+ echo " You can try to fix or rescue your system now. If you want"
+ echo " to boot into your fixed system, mount your root filesystem"
+ echo " read-only under /mnt:"
+ echo
+ echo " # mount -o ro -t filesystem root_device /mnt"
fi
echo
- echo "RESCUE mode"
- echo
- echo " You can try to fix or rescue your system now. If you want"
- echo " to boot into your fixed system, mount your root filesystem"
- echo " read-only under /mnt:"
- echo
- echo " # mount -o ro -t filesystem root_device /mnt"
- echo
echo " Type 'exit' when things are done."
echo
/bin/sh
@@ -229,7 +233,11 @@ if [ -x /sbin/udevd -a -x /sbin/udevadm ]; then
/sbin/udevadm trigger --subsystem-match=block --action=add
if [ -n "$NFSHOST" ]; then
# We also need network devices if NFS root is requested:
- /sbin/udevadm trigger --type=devices --action=add
+ if [ -z "$(/sbin/udevadm trigger --subsystem-match=net --action=add -v -n |rev |cut -d/ -f1 |rev |grep -v lo)" ]; then
+ /sbin/udevadm trigger $DEBUGV
+ else
+ /sbin/udevadm trigger --subsystem-match=net --action=add $DEBUGV
+ fi
fi
/sbin/udevadm settle --timeout=10
else
@@ -837,6 +845,7 @@ EOPW
mount --bind /var/lib/dhcpcd /mnt/overlay/var/lib/dhcpcd
mkdir -p /mnt/overlay/run/dhcpcd
mount --bind /run/dhcpcd /mnt/overlay/run/dhcpcd
+ cat /etc/resolv.conf > /mnt/overlay/etc/resolv.conf
# Disable NetworkManager:
chmod -x /mnt/overlay/etc/rc.d/rc.networkmanager
@@ -915,6 +924,8 @@ EOT
done
fi
+ [ $DEBUG -gt 3 ] && rescue "DEBUG SHELL"
+
# --------------------------------------------------------------------- #
# SLACKWARE LIVE - !END! #
# --------------------------------------------------------------------- #