4 # without this header booting will fail with:
5 # "PANIC: Circular dependancy. Exiting."
20 # helper functions {{{
22 if grep -qe debug -qe verbose /proc/cmdline 2>/dev/null ; then
23 echo "debug: scripts/init-top/grml running">/dev/console
26 # get boot command line
27 CMDLINE="$(cat /proc/cmdline)"
31 case "$(cat $2)" in *$1*) return 0;; esac
37 case "$2" in *$1*) return 0;; esac
41 # Reread boot command line; echo last parameter's argument or return false.
43 stringinstring " $1=" "$CMDLINE" || return 1
44 result="${CMDLINE##*$1=}"
45 result="${result%%[ ]*}"
50 # Check boot commandline for specified option
52 stringinstring " $1" "$CMDLINE"
56 if checkbootparam "nocolor" ; then
57 echo "Disabling colors in bootsequence as requested on commandline."
61 # Erase to end of line
63 # Clear and reset Screen
69 # Erase to end of line
71 # Clear and reset Screen
75 # RED: Failure or error message
77 # GREEN: Success message
79 # YELLOW: Descriptions
81 # BLUE: System mesages
83 # MAGENTA: Found devices or drivers
91 log_grml_failure_msg () {
92 echo -n " ${RED}*${NORMAL} $@"
95 # int log_grml_begin_message (char *message)
96 log_grml_begin_msg () {
97 echo -n " ${GREEN}*${NORMAL} $@"
100 log_grml_warn_msg () {
101 echo -n " ${YELLOW}*${NORMAL} $@"
104 # int log_grml_end_message (int exitstatus)
105 SUCCESS=" ${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}"
106 FAILED=" ${NORMAL}[${RED}fail${NORMAL}]"
112 DISTRI="$(getbootparam 'distri' 2>/dev/null)"
114 if [ -r /etc/grml_version ] ; then
115 GRML_VERSION="$(cat /etc/grml_version)"
118 if [ -n "$DISTRI" ] ; then
122 ${WHITE}based on grml.org.
127 ${RED} ____ ____ __ __ _
128 ${RED} / ___| _ \| \/ | |
129 ${RED} | | _| |_) | |\/| | |
130 ${RED} | |_| | _ <| | | | |___
131 ${RED} \____|_| \_\_| |_|_____|
133 ${WHITE}grml.org - Linux for sysadmins and texttool users.${NORMAL}"
137 echo "${WHITE}Welcome to"
141 if [ -n "$GRML_VERSION" ] ; then
142 log_grml_begin_msg "Running $GRML_VERSION"
146 # don't output anything if running with bootsplash feature
147 if checkbootparam "splash" ; then
148 exec >/dev/null </dev/null 2>&1
152 ## /proc/cmdline handling {{{
153 # No kernel messages while probing modules:
154 if ! grep -qe debug -qe verbose /proc/cmdline 2>/dev/null ; then
155 [ -r /proc/sys/kernel/printk ] && echo "0" > /proc/sys/kernel/printk
158 # Make sure we support squashfs:
159 if ! grep -q squashfs /proc/filesystems ; then
160 modprobe -q squashfs || log_grml_failure_msg "Warning: look like you do not have support for squashfs"
163 if grep -q 'boot=live' /proc/cmdline 2>/dev/null ; then
164 log_grml_begin_msg "Finished early booting sequence." ; echo "$SUCCESS"
165 log_grml_begin_msg "Searching for GRML file, this might take a few seconds..."
170 # vim: foldmethod=marker expandtab ai ft=sh