Fix code regression of checkbootparam
[grml-autoconfig.git] / grml-autoconfig
1 #!/bin/zsh
2 # Filename:      /etc/init.d/grml-autoconfig
3 # Purpose:       basic system configuration and hardware setup for grml system
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 # Latest change: Mit Jul 25 19:12:49 CEST 2007 [mika]
8 ################################################################################
9
10 # http://wiki.debian.org/LSBInitScripts =>
11 ### BEGIN INIT INFO
12 # Provides:          grml-autoconfig
13 # Required-Start:
14 # Required-Stop:
15 # Should-Start:      udev
16 # Default-Start:     S 2 3 4 5
17 # Default-Stop:
18 ### END INIT INFO
19
20 # {{{ placeholder functions for restart/reload/stop
21 if [[ $1 == "restart" ]] ; then
22   echo "$0 restart - empty placeholder. Doing nothing but running."
23 fi
24
25 if [[ $1 == "force-reload" ]] ; then
26   echo "$0 force-reload - empty placeholder. Doing nothing but running."
27 fi
28
29 if [[ $1 == "stop" ]] ; then
30   echo "$0 stop - empty placeholder. Doing nothing but exiting."
31   exit 1
32 fi
33 # }}}
34
35 # {{{ path, signals, umask, zsh, colors
36 export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin"
37 umask 022
38 # Ignore these signals: INT, TERM, SEGV
39 trap "" 2 3 11
40
41 # zsh stuff
42 setopt no_nomatch # avoid 'no matches found: ...'
43 # }}}
44
45 # {{{ source main files
46 source /etc/grml/autoconfig            # configuration file
47 source /etc/grml/autoconfig.functions  # functions
48 source /etc/grml/lsb-functions         # helper functions for smart display
49 # }}}
50
51 # {{{ mount important directories
52 mount_proc
53 mount_pts
54 mount_sys
55 # }}}
56
57 # {{{ Read in boot parameters
58 CMDLINE="$(cat /proc/cmdline)"
59 [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/* | tr '\n' ' ')"
60 # }}}
61
62 # {{{ main grml-autoconfig
63 checkvalue $CONFIG_DEBUG && config_debug
64
65 SPLASH=''
66 if checkbootparam "textsplash" || checkbootparam "tsplash"; then
67   SPLASH=1
68 fi
69
70 if [ -z "$SPLASH" ] ; then
71   stage=5
72   rundebugshell
73 fi
74
75 if [ -z "$BOOTDEBUG" ] ; then
76   einfo "Setting kernel ring buffer to level 2."
77   echo "2" > /proc/sys/kernel/printk ; eend $?
78 else
79   einfo "Setting kernel ring buffer to level 6. Adjust manually via running dmesg -n \$VALUE."
80   echo "6" > /proc/sys/kernel/printk ; eend $?
81 fi
82
83 if checkbootparam "forensic" ; then
84    eerror "Bootopion forensic found. Important notice!"
85    eerror " Do *not* boot with something like 'grml forensic ...' but with 'forensic ...' instead!"
86    eerror " To avoid damage to your system a debugshell will be started after a delay of 10 seconds." ; eend 1
87    eerror " If you want to continue booting just exit the shell, but think about what you are doing!" ; eend 1
88    sleep 10
89    rundebugshell
90 fi
91
92 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|">/dev/tty7
93
94 checkvalue $CONFIG_LANGUAGE && config_language
95
96 checkvalue $CONFIG_LOG && config_log
97
98 checkvalue $CONFIG_SWSPEAK && config_swspeak
99
100 checkvalue $CONFIG_FWTIMEOUT && config_fwtimeout
101
102 checkvalue $CONFIG_FIX_PASSWD && config_fix_passwd
103
104 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||">/dev/tty7
105
106 checkvalue $CONFIG_HOSTNAME && config_hostname
107
108 checkvalue $CONFIG_USERFSTAB && config_userfstab
109
110 checkvalue $CONFIG_TIME && config_time
111
112 checkvalue $CONFIG_KERNEL &&  config_kernel
113
114 checkvalue $CONFIG_VMWARE &&  config_vmware
115
116 checkvalue $CONFIG_QEMU && config_qemu
117
118 checkvalue $CONFIG_SMALL && config_small
119
120 checkvalue $CONFIG_LD_MOD && config_ld_mod
121
122 checkvalue $CONFIG_TIMEZONE && config_timezone
123
124 checkvalue $CONFIG_FAST && config_fast
125
126 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||">/dev/tty7
127
128 checkvalue $CONFIG_ENVIRONMENT && config_environment
129
130 checkvalue $CONFIG_SWRAID && config_swraid
131
132 checkvalue $CONFIG_LVM && config_lvm
133
134 # No kernel messages while probing modules
135 echo "0" > /proc/sys/kernel/printk
136
137 checkvalue $CONFIG_CDROM_PERM && config_cdrom_perm
138
139 checkvalue $CONFIG_LOCAL_NET && config_local_net
140
141 checkvalue $CONFIG_FIREWIRE_DEV && config_firewire_dev
142
143 checkvalue $CONFIG_TESTCD && config_testcd
144
145 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||">/dev/tty7
146
147 checkvalue $CONFIG_DISCOVER && config_discover
148
149 checkvalue $CONFIG_HWINFO && config_hwinfo
150
151 checkvalue $CONFIG_HOTPLUG_AGENT && config_hotplug_agent
152
153 checkvalue $CONFIG_HOTPLUG_BLACKLIST && config_hotplug_blacklist
154
155 checkvalue $CONFIG_HOTPLUG_MAIN && config_hotplug
156
157 checkvalue $CONFIG_MODULES && config_modules
158
159 checkvalue $CONFIG_ACPI_APM && config_acpi_apm
160
161 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||">/dev/tty7
162
163 checkvalue $CONFIG_PCMCIA && config_pcmcia
164
165 # {{{ Read in what hwsetup has found
166 [ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
167 # }}}
168
169 checkvalue $CONFIG_KEYBOARD && config_keyboard
170
171 [ -n "$SPLASH" ] &&  /usr/bin/grml-bootsplash "||||||">/dev/tty7
172
173 checkvalue $CONFIG_BLIND && config_blind
174
175 checkvalue $CONFIG_INTERACTIVE && config_interactive
176
177 checkvalue $CONFIG_AGP && config_agp
178
179 [ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
180
181 checkvalue $CONFIG_AUTOMOUNTER && config_automounter
182
183 checkvalue $CONFIG_DMA && config_dma
184
185 checkvalue $CONFIG_FSTAB && config_fstab
186
187 checkvalue $CONFIG_MOUSE && config_mouse
188
189 checkvalue $CONFIG_DHCP && config_dhcp
190
191 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||">/dev/tty7
192
193 checkvalue $CONFIG_SYSLOG && config_syslog
194
195 checkvalue $CONFIG_CPU && config_cpu
196
197 checkvalue $CONFIG_SSH && config_ssh
198
199 checkvalue $CONFIG_PASSWD && config_passwd
200
201 checkvalue $CONFIG_EXTRACT  && config_extract
202
203 checkvalue $CONFIG_HOMEDIR && config_homedir
204
205 checkvalue $CONFIG_MYCONFIG && config_myconfig
206
207 checkvalue $CONFIG_DEBS && config_debs
208
209 checkvalue $CONFIG_SCRIPTS && config_scripts
210
211 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||">/dev/tty7
212
213 checkvalue $CONFIG_CDROM_SCRIPTS && config_cdrom_scripts
214
215 # device symlinks {{{
216   [ -r /mnt/floppy ] || mkdir /mnt/floppy
217   [ -r /mnt/cdrom ]  || mkdir /mnt/cdrom
218   [ -r /mnt/test ]   || mkdir /mnt/test
219 # }}}
220
221 checkvalue $CONFIG_MIXER && config_mixer
222
223 checkvalue $CONFIG_MODEM && config_modem
224
225 checkvalue $CONFIG_WONDERSHAPER && config_wondershaper
226
227 checkvalue $CONFIG_GPM && config_gpm
228
229 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||">/dev/tty7
230
231 checkvalue $CONFIG_SERVICES && config_services
232
233 checkvalue $CONFIG_NETCONFIG && config_netconfig
234
235 checkvalue $CONFIG_NETIPV6 && config_ipv6
236
237 checkvalue $CONFIG_DEBNET && config_debnet
238
239 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||||">/dev/tty7
240
241 checkvalue $CONFIG_CONSOLE && config_console
242
243 checkvalue $CONFIG_SETKEYCODES && config_setkeycodes
244
245 checkvalue $CONFIG_BLINDSOUND && config_blindsound
246
247 checkvalue $CONFIG_WELCOME && config_welcome
248
249 checkvalue $CONFIG_FIX_UNIONFS && fix_unionfs
250
251 checkvalue $CONFIG_CREATE_MNT_DIRS && create_mnt_dirs
252
253 checkvalue $CONFIG_915RESOLUTION && config_915resolution
254
255 checkvalue $CONFIG_IPW3945 && config_ipw3945
256
257 checkvalue $CONFIG_AUTOMOUNT && config_automount
258
259 checkvalue $CONFIG_DISTCC && config_distcc
260
261 checkvalue $CONFIG_DISTRI && config_distri
262
263 checkvalue $CONFIG_BLANKING && config_blanking
264
265 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||||">/dev/tty7
266
267 checkvalue $CONFIG_GRML2HD && config_grml2hd
268
269 checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
270
271 checkvalue $CONFIG_XSTARTUP && config_x_startup
272 # }}}
273
274 # {{{ debug
275 if [ -z "$SPLASH" ] ; then
276   stage=6
277   rundebugshell
278 fi
279
280 if [ -n "$BOOTDEBUG" ] ; then
281   CMDLINE="$(cat /proc/cmdline)"
282   [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/*)"
283   einfo "Bootoption debug detected. Printing kernel command line:"
284   echo "$CMDLINE"
285 fi
286 # }}}
287
288 # {{{ Re-enable signals
289 trap 2 3 11
290 # }}}
291
292 exit 0
293
294 ## END OF FILE #################################################################
295 # vim:foldmethod=marker