base/dracut-lib.sh: for systemd start emergency.service
do not spawn the shell, start the emergency.service for systemdmaster
parent
d9087a2d85
commit
1e570bf8e3
|
@ -825,30 +825,41 @@ emergency_shell()
|
||||||
_rdshell_name=$2; action="Shutdown"; hook="shutdown-emergency"
|
_rdshell_name=$2; action="Shutdown"; hook="shutdown-emergency"
|
||||||
shift 2
|
shift 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ; echo
|
echo ; echo
|
||||||
warn $@
|
warn $@
|
||||||
source_hook "$hook"
|
source_hook "$hook"
|
||||||
echo
|
echo
|
||||||
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="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
|
if getargbool 1 rd.shell -y rdshell || getarg rd.break rdbreak; then
|
||||||
if [ -z "$_ctty" ]; then
|
if [ -x /lib/systemd/systemd ]; then
|
||||||
_ctty=console
|
> /.console_lock
|
||||||
while [ -f /sys/class/tty/$_ctty/active ]; do
|
echo "PS1=\"$_rdshell_name:\${PWD}# \"" >/etc/profile
|
||||||
_ctty=$(cat /sys/class/tty/$_ctty/active)
|
systemctl start emergency.service
|
||||||
_ctty=${_ctty##* } # last one in the list
|
debug_off
|
||||||
done
|
while [ -e /.console_lock ]; do sleep 1; done
|
||||||
_ctty=/dev/$_ctty
|
debug_on
|
||||||
fi
|
else
|
||||||
[ -c "$_ctty" ] || _ctty=/dev/tty1
|
echo "Dropping to debug shell."
|
||||||
strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c"
|
echo
|
||||||
|
export PS1="$_rdshell_name:\${PWD}# "
|
||||||
|
[ -e /.profile ] || >/.profile
|
||||||
|
|
||||||
|
_ctty="$(getarg rd.ctty=)" && _ctty="/dev/${_ctty##*/}"
|
||||||
|
if [ -z "$_ctty" ]; then
|
||||||
|
_ctty=console
|
||||||
|
while [ -f /sys/class/tty/$_ctty/active ]; do
|
||||||
|
_ctty=$(cat /sys/class/tty/$_ctty/active)
|
||||||
|
_ctty=${_ctty##* } # last one in the list
|
||||||
|
done
|
||||||
|
_ctty=/dev/$_ctty
|
||||||
|
fi
|
||||||
|
[ -c "$_ctty" ] || _ctty=/dev/tty1
|
||||||
|
strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c"
|
||||||
# stop watchdog
|
# stop watchdog
|
||||||
echo 'V' > /dev/watchdog
|
echo 'V' > /dev/watchdog
|
||||||
setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
warn "$action has failed. To debug this issue add \"rd.shell\" to the kernel command line."
|
warn "$action has failed. To debug this issue add \"rd.shell\" to the kernel command line."
|
||||||
# cause a kernel panic
|
# cause a kernel panic
|
||||||
|
|
Loading…
Reference in New Issue