Release new version 1:20210208+grml.5
[live-boot-grml.git] / components / 9990-initramfs-tools.sh
1 #!/bin/sh
2
3 #set -e
4
5 log_wait_msg ()
6 {
7         # Print a message and wait for enter
8         if [ -x /bin/plymouth ] && plymouth --ping
9         then
10                 plymouth message --text="$@"
11                 plymouth watch-keystroke | read nunya
12         fi
13
14         _log_msg "Waiting: ${@} ... \n"
15 }
16
17 # Override maybe_break from scripts/functions
18 maybe_break()
19 {
20         if [ "${break}" = "$1" ]; then
21                 # Call original panic
22                 . /scripts/functions
23                 panic "Spawning shell within the initramfs"
24         fi
25 }
26
27 # Override panic from scripts/functions
28 panic()
29 {
30         for _PARAMETER in ${LIVE_BOOT_CMDLINE}
31         do
32                 case "${_PARAMETER}" in
33                         panic=*)
34                                 panic="${_PARAMETER#*panic=}"
35                                 ;;
36                 esac
37         done
38
39         DEB_1="\033[1;31m .''\`.  \033[0m"
40         DEB_2="\033[1;31m: :'  : \033[0m"
41         DEB_3="\033[1;31m\`. \`'\`  \033[0m"
42         DEB_4="\033[1;31m  \`-    \033[0m"
43
44         LIVELOG="\033[1;37m/boot.log\033[0m"
45         DEBUG="\033[1;37mdebug\033[0m"
46
47         # Reset redirections to avoid buffering
48         exec 1>&6 6>&-
49         exec 2>&7 7>&-
50         kill ${tailpid}
51
52         printf "\n\n"
53         printf "  \033[1;37mBOOT FAILED!\033[0m\n"
54         printf "\n"
55         printf "  This image failed to boot.\n\n"
56
57         printf "  Please file a bug at your distributors bug tracking system, making\n"
58         printf "  sure to note the exact version, name and distribution of the image\n"
59         printf "  you were attempting to boot.\n\n"
60
61         if [ -r /etc/grml_version ]
62         then
63                 GRML_VERSION="$(cat /etc/grml_version)"
64                 printf "  $GRML_VERSION\n\n"
65         fi
66
67         printf "  The file ${LIVELOG} contains some debugging information but booting with the\n"
68         printf "  ${DEBUG}=1 command-line parameter will greatly increase its verbosity which is\n"
69         printf "  extremely useful when diagnosing issues.\n\n"
70
71         if [ -n "${panic}" ]; then
72                 printf "  live-boot will now restart your system. "
73         else
74                 printf "  live-boot will now start a shell. "
75         fi
76         printf "The error message was:\n\n    "
77
78         # Call original panic
79         . /scripts/functions
80         panic "$@"
81 }