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