65a3b7477c
nfs path fixes for live image over nfs root=live:nfs://10.10.10.10:/srv/all/install.img ip=dhcp rd.neednet
119 lines
3.6 KiB
Diff
119 lines
3.6 KiB
Diff
From ffcc64bdea9080c2a1430ba59720f583bc0ac908 Mon Sep 17 00:00:00 2001
|
|
From: Will Woods <wwoods@redhat.com>
|
|
Date: Wed, 29 Feb 2012 13:09:58 -0500
|
|
Subject: [PATCH] move emergency_shell to dracut-lib.sh
|
|
|
|
This lets things running outside init call an emergency_shell.
|
|
(example: scripts called by initqueue)
|
|
---
|
|
modules.d/99base/dracut-lib.sh | 38 ++++++++++++++++++++++++++++++++++++++
|
|
modules.d/99base/init.sh | 40 +---------------------------------------
|
|
2 files changed, 39 insertions(+), 39 deletions(-)
|
|
|
|
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
|
|
index afd366e..c31854e 100755
|
|
--- a/modules.d/99base/dracut-lib.sh
|
|
+++ b/modules.d/99base/dracut-lib.sh
|
|
@@ -753,3 +753,41 @@ killproc() {
|
|
need_shutdown() {
|
|
>/run/initramfs/.need_shutdown
|
|
}
|
|
+
|
|
+emergency_shell()
|
|
+{
|
|
+ local _ctty
|
|
+ set +e
|
|
+ if [ "$1" = "-n" ]; then
|
|
+ _rdshell_name=$2
|
|
+ shift 2
|
|
+ else
|
|
+ _rdshell_name=dracut
|
|
+ fi
|
|
+ echo ; echo
|
|
+ warn $@
|
|
+ source_hook emergency
|
|
+ echo
|
|
+ wait_for_loginit
|
|
+ [ -e /run/initramfs/.die ] && exit 1
|
|
+ if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
|
|
+ echo "Dropping to debug shell."
|
|
+ echo
|
|
+ export PS1="$_rdshell_name:\${PWD}# "
|
|
+ [ -e /.profile ] || >/.profile
|
|
+ _ctty=/dev/console
|
|
+ if [ -n "$(command -v setsid)" ]; then
|
|
+ _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
|
|
+ [ -c "$_ctty" ] || _ctty=/dev/tty1
|
|
+ setsid sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
|
+ elif [ -n "$(command -v openvt)" ] && ! getarg "console=" >/dev/null 2>&1 && getargbool 1 "rd.openvt" ; then
|
|
+ openvt -f -c 1 -w -s -l -- sh
|
|
+ else
|
|
+ sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
|
+ fi
|
|
+ else
|
|
+ warn "Boot has failed. To debug this issue add \"rdshell\" to the kernel command line."
|
|
+ # cause a kernel panic
|
|
+ exit 1
|
|
+ fi
|
|
+}
|
|
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
|
|
index 4d0a2a2..d197497 100755
|
|
--- a/modules.d/99base/init.sh
|
|
+++ b/modules.d/99base/init.sh
|
|
@@ -38,54 +38,16 @@ wait_for_loginit()
|
|
rm -f /run/initramfs/loginit.pipe /run/initramfs/loginit.pid
|
|
}
|
|
|
|
-emergency_shell()
|
|
-{
|
|
- local _ctty
|
|
- set +e
|
|
- if [ "$1" = "-n" ]; then
|
|
- _rdshell_name=$2
|
|
- shift 2
|
|
- else
|
|
- _rdshell_name=dracut
|
|
- fi
|
|
- echo ; echo
|
|
- warn $@
|
|
- source_hook emergency
|
|
- echo
|
|
- wait_for_loginit
|
|
- [ -e /run/initramfs/.die ] && exit 1
|
|
- if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
|
|
- echo "Dropping to debug shell."
|
|
- echo
|
|
- export PS1="$_rdshell_name:\${PWD}# "
|
|
- [ -e /.profile ] || >/.profile
|
|
- _ctty=/dev/console
|
|
- if [ -n "$(command -v setsid)" ]; then
|
|
- _ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
|
|
- [ -c "$_ctty" ] || _ctty=/dev/tty1
|
|
- setsid sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
|
- elif [ -n "$(command -v openvt)" ] && ! getarg "console=" >/dev/null 2>&1 && getargbool 1 "rd.openvt" ; then
|
|
- openvt -f -c 1 -w -s -l -- sh
|
|
- else
|
|
- sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
|
- fi
|
|
- else
|
|
- warn "Boot has failed. To debug this issue add \"rdshell\" to the kernel command line."
|
|
- # cause a kernel panic
|
|
- exit 1
|
|
- fi
|
|
-}
|
|
-
|
|
NEWROOT="/sysroot"
|
|
[ -d $NEWROOT ] || mkdir -p -m 0755 $NEWROOT
|
|
|
|
-trap "emergency_shell Signal caught!" 0
|
|
OLDPATH=$PATH
|
|
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
|
export PATH
|
|
|
|
RD_DEBUG=""
|
|
. /lib/dracut-lib.sh
|
|
+trap "emergency_shell Signal caught!" 0
|
|
|
|
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
|
|