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