3 # This file was deployed via grml-live's
4 # ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/10-build-initramfs script, using
5 # ${GRML_FAI_CONFIG}/config/files/usr/share/initramfs-tools/scripts/init-top/grml/GRMLBASE
7 # Filename: /usr/share/initramfs-tools/scripts/init-top/grml
8 # Purpose: Early boot progress handler
9 # Authors: grml-team (grml.org),
10 # (c) Michael Prokop <mika@grml.org>
11 # Bug-Reports: see http://grml.org/bugs/
12 # License: This file is licensed under the GPL v2 or any later version.
13 ################################################################################
16 # without this header booting will fail with:
17 # "PANIC: Circular dependancy. Exiting."
32 # helper functions {{{
34 if grep -qe debug -qe verbose /proc/cmdline 2>/dev/null ; then
35 echo "debug: scripts/init-top/grml running">/dev/console
38 # get boot command line
39 CMDLINE="$(cat /proc/cmdline)"
43 case "$(cat $2)" in *$1*) return 0;; esac
49 case "$2" in *$1*) return 0;; esac
53 # Reread boot command line; echo last parameter's argument or return false.
55 stringinstring " $1=" "$CMDLINE" || return 1
56 result="${CMDLINE##*$1=}"
57 result="${result%%[ ]*}"
62 # Check boot commandline for specified option
64 stringinstring " $1" "$CMDLINE"
68 if checkbootparam "nocolor" ; then
69 echo "Disabling colors in bootsequence as requested on commandline."
73 # Erase to end of line
75 # Clear and reset Screen
81 # Erase to end of line
83 # Clear and reset Screen
87 # RED: Failure or error message
89 # GREEN: Success message
91 # YELLOW: Descriptions
93 # BLUE: System mesages
95 # MAGENTA: Found devices or drivers
103 log_grml_failure_msg () {
104 echo -n " ${RED}*${NORMAL} $@"
107 # int log_grml_begin_message (char *message)
108 log_grml_begin_msg () {
109 echo -n " ${GREEN}*${NORMAL} $@"
112 log_grml_warn_msg () {
113 echo -n " ${YELLOW}*${NORMAL} $@"
116 # int log_grml_end_message (int exitstatus)
117 SUCCESS=" ${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}"
118 FAILED=" ${NORMAL}[${RED}fail${NORMAL}]"
124 DISTRI="$(getbootparam 'distri' 2>/dev/null)"
126 if [ -r /etc/grml_version ] ; then
127 GRML_VERSION="$(cat /etc/grml_version)"
130 if checkbootparam "quiet" ; then
134 if [ -n "$DISTRI" ] ; then
138 ${WHITE}based on grml.org.
143 ${RED} ____ ____ __ __ _
144 ${RED} / ___| _ \| \/ | |
145 ${RED} | | _| |_) | |\/| | |
146 ${RED} | |_| | _ <| | | | |___
147 ${RED} \____|_| \_\_| |_|_____|
149 ${WHITE}grml.org - Linux for sysadmins and texttool users.${NORMAL}"
153 echo "${WHITE}Welcome to"
157 if [ -n "$GRML_VERSION" ] ; then
158 log_grml_begin_msg "Running $GRML_VERSION"
162 # don't output anything if running with bootsplash feature
163 if checkbootparam "splash" ; then
164 exec >/dev/null </dev/null 2>&1
168 ## /proc/cmdline handling {{{
169 # No kernel messages while probing modules:
170 if ! grep -qe debug -qe verbose /proc/cmdline 2>/dev/null ; then
171 [ -r /proc/sys/kernel/printk ] && echo "0" > /proc/sys/kernel/printk
174 # Make sure we support squashfs:
175 if ! grep -q squashfs /proc/filesystems ; then
176 modprobe -q squashfs || log_grml_failure_msg "Warning: looks like you do not have support for squashfs"
179 if grep -q 'boot=live' /proc/cmdline 2>/dev/null ; then
180 log_grml_begin_msg "Finished early booting sequence." ; echo "$SUCCESS"
181 log_grml_begin_msg "Searching for GRML file, this might take a few seconds..."
186 # vim: foldmethod=marker expandtab ai ft=sh