add correct reboot and poweroff to emergency shell

This commit is contained in:
Tobias Powalowski 2023-02-11 20:04:48 +01:00
parent 9b3e924837
commit 21d6394340
2 changed files with 5 additions and 2 deletions

View file

@ -13,7 +13,7 @@ build() {
map add_binary bash sh blkid mount switch_root bsdcpio mkfs.btrfs setfont \ map add_binary bash sh blkid mount switch_root bsdcpio mkfs.btrfs setfont \
/usr/lib/systemd/systemd-udevd udevadm systemd-tmpfiles kmod \ /usr/lib/systemd/systemd-udevd udevadm systemd-tmpfiles kmod \
insmod modprobe mkdir gzip sleep uname cat cp cut dmesg grep ln ls mv \ insmod modprobe mkdir gzip sleep uname cat cp cut dmesg grep ln ls mv \
poweroff reboot rm umount lsblk rmmod rm umount lsblk rmmod
add_file "/usr/share/kbd/consolefonts/ter-v16n.psf.gz" "/consolefont.psf.gz" add_file "/usr/share/kbd/consolefonts/ter-v16n.psf.gz" "/consolefont.psf.gz"
map add_udev_rule '50-udev-default.rules' '60-persistent-storage.rules' \ map add_udev_rule '50-udev-default.rules' '60-persistent-storage.rules' \
'64-btrfs.rules' '80-drivers.rules' '64-btrfs.rules' '80-drivers.rules'

View file

@ -4,7 +4,8 @@
_emergency_shell() { _emergency_shell() {
echo "Welcome to Archboot Emergeny Shell:" echo "Welcome to Archboot Emergeny Shell:"
echo "Seems something went wrong..." echo "Seems something went wrong..."
echo "Type 'poweroff' for shutdown or 'reboot' to restart." echo "Type 'echo b >/proc/sysrq-trigger' for reboot."
echo "Type 'echo o >/proc/sysrq-trigger' for poweroff."
/bin/sh /bin/sh
} }
@ -25,6 +26,7 @@ udevadm trigger --action=add --type=devices
udevadm settle udevadm settle
udevadm control --exit udevadm control --exit
udevadm info --cleanup-db udevadm info --cleanup-db
echo 1 > /proc/sys/kernel/sysrq
echo -e "\e[1mInitializing\e[m \e[36mArchboot\e[m \e[1m- Arch Linux Environment:\e[m" echo -e "\e[1mInitializing\e[m \e[36mArchboot\e[m \e[1m- Arch Linux Environment:\e[m"
# it needs one echo before, in order to reset the consolefont! # it needs one echo before, in order to reset the consolefont!
setfont consolefont.psf.gz -C /dev/console setfont consolefont.psf.gz -C /dev/console
@ -61,6 +63,7 @@ cd /new_root || _emergency_shell
echo -e "\e[1mStep 4/4:\e[m Copying archboot rootfs to /new_root..." echo -e "\e[1mStep 4/4:\e[m Copying archboot rootfs to /new_root..."
echo -e " This may need some time..." echo -e " This may need some time..."
bsdcpio -i <"/mnt/boot/initramfs-$(uname -m).img" &>/dev/null || _emergency_shell bsdcpio -i <"/mnt/boot/initramfs-$(uname -m).img" &>/dev/null || _emergency_shell
echo 0 > /proc/sys/kernel/sysrq
exec switch_root /new_root /init "$@" exec switch_root /new_root /init "$@"
# vim: set ft=sh ts=4 sw=4 et: # vim: set ft=sh ts=4 sw=4 et: