3 # This file was deployed via grml-live's
4 # ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/42-branding 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 dependency. 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 messages
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.
144 ${YELLOW} / ___| _ __ _____ | |
145 ${YELLOW} | | _ | / /| || |
146 ${YELLOW} | |_| || / | | | || |
147 ${YELLOW} \____||_| |_|_|_||_|
149 ${WHITE}Grml Live Linux - http://grml.org/${NORMAL}"
153 echo "${WHITE}Welcome to"
157 if [ -n "$GRML_VERSION" ] ; then
158 log_grml_begin_msg "Running $GRML_VERSION"
164 ## /proc/cmdline handling {{{
165 # No kernel messages while probing modules:
166 if ! grep -qe debug -qe verbose /proc/cmdline 2>/dev/null ; then
167 [ -r /proc/sys/kernel/printk ] && echo "0" > /proc/sys/kernel/printk
170 # Make sure we support squashfs:
171 if ! grep -q squashfs /proc/filesystems ; then
172 modprobe -q squashfs || log_grml_failure_msg "Warning: looks like you do not have support for squashfs"
175 if grep -q 'boot=live' /proc/cmdline 2>/dev/null ; then
176 log_grml_begin_msg "Finished early booting sequence." ; echo "$SUCCESS"
177 #(256-16)*1024=245760
178 if [ "$(awk '/MemTotal/{print $2}' /proc/meminfo)" -lt 245760 ] ; then
179 log_grml_failure_msg "Warning: less than 256MB RAM, boot may fail"
182 log_grml_begin_msg "Searching for GRML file, this might take a few seconds..."
187 # vim: foldmethod=marker expandtab ai ft=sh