config_language(): check for existence of /etc/sysconfig/keyboard
[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:59:07 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 if [ -n "$SPLASH" ] ; then
93    /usr/bin/grml-bootsplash "|">/dev/tty14
94    chvt 14
95 fi
96
97 checkvalue $CONFIG_LANGUAGE && config_language
98
99 checkvalue $CONFIG_LOG && config_log
100
101 checkvalue $CONFIG_SWSPEAK && config_swspeak
102
103 checkvalue $CONFIG_FWTIMEOUT && config_fwtimeout
104
105 checkvalue $CONFIG_FIX_PASSWD && config_fix_passwd
106
107 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||">/dev/tty14
108
109 checkvalue $CONFIG_HOSTNAME && config_hostname
110
111 checkvalue $CONFIG_USERFSTAB && config_userfstab
112
113 checkvalue $CONFIG_TIME && config_time
114
115 checkvalue $CONFIG_KERNEL &&  config_kernel
116
117 checkvalue $CONFIG_VMWARE &&  config_vmware
118
119 checkvalue $CONFIG_QEMU && config_qemu
120
121 checkvalue $CONFIG_SMALL && config_small
122
123 checkvalue $CONFIG_LD_MOD && config_ld_mod
124
125 checkvalue $CONFIG_TIMEZONE && config_timezone
126
127 checkvalue $CONFIG_FAST && config_fast
128
129 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||">/dev/tty14
130
131 checkvalue $CONFIG_ENVIRONMENT && config_environment
132
133 checkvalue $CONFIG_SWRAID && config_swraid
134
135 checkvalue $CONFIG_LVM && config_lvm
136
137 # No kernel messages while probing modules
138 echo "0" > /proc/sys/kernel/printk
139
140 checkvalue $CONFIG_CDROM_PERM && config_cdrom_perm
141
142 checkvalue $CONFIG_LOCAL_NET && config_local_net
143
144 checkvalue $CONFIG_FIREWIRE_DEV && config_firewire_dev
145
146 checkvalue $CONFIG_TESTCD && config_testcd
147
148 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||">/dev/tty14
149
150 checkvalue $CONFIG_DISCOVER && config_discover
151
152 checkvalue $CONFIG_HWINFO && config_hwinfo
153
154 checkvalue $CONFIG_HOTPLUG_AGENT && config_hotplug_agent
155
156 checkvalue $CONFIG_HOTPLUG_BLACKLIST && config_hotplug_blacklist
157
158 checkvalue $CONFIG_HOTPLUG_MAIN && config_hotplug
159
160 checkvalue $CONFIG_MODULES && config_modules
161
162 checkvalue $CONFIG_ACPI_APM && config_acpi_apm
163
164 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||">/dev/tty14
165
166 checkvalue $CONFIG_PCMCIA && config_pcmcia
167
168 # {{{ Read in what hwsetup has found
169 [ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
170 # }}}
171
172 checkvalue $CONFIG_KEYBOARD && config_keyboard
173
174 [ -n "$SPLASH" ] &&  /usr/bin/grml-bootsplash "||||||">/dev/tty14
175
176 checkvalue $CONFIG_BLIND && config_blind
177
178 checkvalue $CONFIG_INTERACTIVE && config_interactive
179
180 checkvalue $CONFIG_AGP && config_agp
181
182 [ -f /etc/sysconfig/grml ] && . /etc/sysconfig/grml
183
184 checkvalue $CONFIG_AUTOMOUNTER && config_automounter
185
186 checkvalue $CONFIG_DMA && config_dma
187
188 checkvalue $CONFIG_FSTAB && config_fstab
189
190 checkvalue $CONFIG_MOUSE && config_mouse
191
192 checkvalue $CONFIG_DHCP && config_dhcp
193
194 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||">/dev/tty14
195
196 checkvalue $CONFIG_SYSLOG && config_syslog
197
198 checkvalue $CONFIG_CPU && config_cpu
199
200 checkvalue $CONFIG_SSH && config_ssh
201
202 checkvalue $CONFIG_PASSWD && config_passwd
203
204 checkvalue $CONFIG_EXTRACT  && config_extract
205
206 checkvalue $CONFIG_HOMEDIR && config_homedir
207
208 checkvalue $CONFIG_MYCONFIG && config_myconfig
209
210 checkvalue $CONFIG_DEBS && config_debs
211
212 checkvalue $CONFIG_SCRIPTS && config_scripts
213
214 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||">/dev/tty14
215
216 checkvalue $CONFIG_CDROM_SCRIPTS && config_cdrom_scripts
217
218 # device symlinks {{{
219   [ -r /mnt/floppy ] || mkdir /mnt/floppy
220   [ -r /mnt/cdrom ]  || mkdir /mnt/cdrom
221   [ -r /mnt/test ]   || mkdir /mnt/test
222 # }}}
223
224 checkvalue $CONFIG_MIXER && config_mixer
225
226 checkvalue $CONFIG_MODEM && config_modem
227
228 checkvalue $CONFIG_WONDERSHAPER && config_wondershaper
229
230 checkvalue $CONFIG_GPM && config_gpm
231
232 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||||">/dev/tty14
233
234 checkvalue $CONFIG_SERVICES && config_services
235
236 checkvalue $CONFIG_NETCONFIG && config_netconfig
237
238 checkvalue $CONFIG_NETIPV6 && config_ipv6
239
240 checkvalue $CONFIG_DEBNET && config_debnet
241
242 [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "||||||||||">/dev/tty14
243
244 checkvalue $CONFIG_CONSOLE && config_console
245
246 checkvalue $CONFIG_SETKEYCODES && config_setkeycodes
247
248 checkvalue $CONFIG_BLINDSOUND && config_blindsound
249
250 checkvalue $CONFIG_WELCOME && config_welcome
251
252 checkvalue $CONFIG_FIX_UNIONFS && fix_unionfs
253
254 checkvalue $CONFIG_CREATE_MNT_DIRS && create_mnt_dirs
255
256 checkvalue $CONFIG_915RESOLUTION && config_915resolution
257
258 checkvalue $CONFIG_IPW3945 && config_ipw3945
259
260 checkvalue $CONFIG_AUTOMOUNT && config_automount
261
262 checkvalue $CONFIG_DISTCC && config_distcc
263
264 checkvalue $CONFIG_DISTRI && config_distri
265
266 checkvalue $CONFIG_BLANKING && config_blanking
267
268 if [ -n "$SPLASH" ] ; then
269    /usr/bin/grml-bootsplash "|||||||||||">/dev/tty14
270    chvt 1
271 fi
272
273 checkvalue $CONFIG_GRML2HD && config_grml2hd
274
275 checkvalue $CONFIG_DEBOOTSTRAP && config_debootstrap
276
277 checkvalue $CONFIG_XSTARTUP && config_x_startup
278 # }}}
279
280 # {{{ debug
281 if [ -z "$SPLASH" ] ; then
282   stage=6
283   rundebugshell
284 fi
285
286 if [ -n "$BOOTDEBUG" ] ; then
287   CMDLINE="$(cat /proc/cmdline)"
288   [ -d /cdrom/bootparams/ ] && CMDLINE="$CMDLINE $(cat /cdrom/bootparams/*)"
289   einfo "Bootoption debug detected. Printing kernel command line:"
290   echo "$CMDLINE"
291 fi
292 # }}}
293
294 # {{{ Re-enable signals
295 trap 2 3 11
296 # }}}
297
298 exit 0
299
300 ## END OF FILE #################################################################
301 # vim:foldmethod=marker