fixed grub compile problem
[grml-terminalserver.git] / grml-terminalserver-config
1 #!/bin/sh
2 # Filename:      terminalserver-config
3 # Purpose:       Program to do something
4 # Authors:       grml-team (grml.org), (c) Michael Gebetsroither <gebi@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 # Latest change: Sun May 08 22:21:32 CEST 2005 [gebi]
8 ################################################################################
9
10
11 ###
12 ### __INCLUDES
13 ###
14 . /etc/grml/sh-lib
15 #. /etc/grml/sysexits-sh
16
17
18
19 ###
20 ### __VARIABLES
21 ###
22
23 verbose_=0
24
25 # this file holds all variable definitions
26 SHARED_PROG_VARS_="/usr/share/grml-terminalserver/shared_prog_vars"
27 isExistent $SHARED_PROG_VARS_ die
28 . $SHARED_PROG_VARS_
29
30 # variables used in the config file for grml-terminalserver
31 INTERFACE_=""
32 IP_=""
33 NETMASK_=""
34 GW_=""
35 NAMESERVERS_=""
36 IPRANGE_FROM_=""
37 IPRANGE_TO_=""
38 NETWORK_=""
39 OPTIONS_=""
40 BOOT_ARGS_=""
41  
42
43 ###
44 ### __FUNCTIONS
45 ###
46
47 function printUsage
48 {
49   cat <<EOT
50 Usage: "$PROG_NAME__" [OPTIONS] <command>
51
52 $PROG_NAME__ is the config program for the terminalserver
53 comming with grml.
54
55 COMMANDS:
56    help             This text
57    interactive      Interactive Configuration of the grml-terminalserver
58    grubConf         Configure grub and make boot-image (for non-PXE NICs)
59    grubConfWrite    Configure grub and write image to floppy disk
60    grubWrite        Write compiled grub-image to floppy disk
61    grubMultiWrite   batchwrite grub-image to floppy disk
62    initrd           Only create the initrd
63    clean            Remove all configfiles created during user configuration
64    <default>        interactive
65
66 OPTIONS:
67    -v             verbose (show what is going on, v++)
68    -h             this help text
69
70 EOT
71 }
72
73
74 function writeConfig
75 {
76   local date_=""
77
78   if [ -f $CONF_FILE_ ]; then
79     mv -fb $CONF_FILE_ ${CONF_FILE_}-old
80   fi
81
82   date_=`date`
83   cat <<EOT > $CONF_FILE_
84 # GRML TERMINAL-SERVER CONFIG
85 # created on "$date_"
86 INTERFACE_="$INTERFACE_"
87 IP_="$IP_"
88 NETWORK_="$NETWORK_"
89 NETMASK_="$NETMASK_"
90 GW_="$GW_"
91 NAMESERVERS_="$NAMESERVERS_"
92 IPRANGE_FROM_="$IPRANGE_FROM_"
93 IPRANGE_TO_="$IPRANGE_TO_"
94 OPTIONS_="$OPTIONS_"
95 BOOT_ARGS_="$BOOT_ARGS_"
96
97 EOT
98   notice "config successfully safed to \"$CONF_FILE_\""
99 }
100
101
102 # AUTOMATIC CONFIGURATION  {{{
103 function checkParamArg
104 {
105   local param_name="$1"
106   local arg="$2"
107
108   #eval "echo $`echo $test`"
109   echo $arg |grep "^[-|+]" &>/dev/null || return
110
111   die "Argument from $param_name looks like another parameter \"$arg\"" 1
112 }
113
114 function actionAutoconf
115 {
116   checkParamArg "-i" "$interface_"
117 }
118 # }}}
119
120
121 # INITRD {{{
122
123 function actionMkInitrd
124 {
125   echo "Creating initrd: $PATH_/minirt26.gz"
126   isExistent "$PATH_/minirt26.gz" && echo "$PATH_/minirt26.gz does already exist, skipping initrd creation" && return 0
127   mkInitrd
128   echo 'done'
129 }
130
131 function mkInitrd
132 {
133   TMP_DIR_=`mktemp -td terminalserver_initrd.XXXXXX`
134   local i=''
135   local tmp_loopname=''
136
137   # copying original initrd into $INITRD
138   execute "rm -r $INITRD_" 2>/dev/null
139   execute "cp $ORIGINAL_INITRD_ $TMP_DIR_/minirt26.gz" warn || return 1
140   execute "mkdir -p $INITRD_" warn || return 1
141   execute "mkdir -p $PATH_/mini-root.orig" warn || return 1
142   execute "gunzip $TMP_DIR_/minirt26.gz" warn || return 1
143   tmp_loopname=`findNextFreeLoop die`
144   execute "mount -o loop=$tmp_loopname $TMP_DIR_/minirt26 $PATH_/mini-root.orig " warn || return 1
145   execute "cp -a $PATH_/mini-root.orig/* $INITRD_" warn || return 1
146   execute "umount $PATH_/mini-root.orig" warn || return 1
147   losetup -d $tmp_loopname &>/dev/null
148   tmp_loopname=''
149   execute "rmdir $PATH_/mini-root.orig" warn || return 1
150   execute "rm $TMP_DIR_/minirt26" warn || return 1
151
152   # implanting my initrd changes into the original initrd
153   
154   # copy programs, check if there are already links with this name to busybox
155   for i in $USR_SHARE_/discover* $USR_SHARE_/udhcpc $USR_SHARE_/udhcp-config.sh $USR_SHARE_/cdir $USR_SHARE_/rdir /usr/bin/ldd ;do
156     tmp_name_="${i##*/}"
157     isNotExistent "$INITRD_/static/$tmp_name_" eprint || execute "rm $INITRD_/static/$tmp_name_"
158     cp $i "$INITRD_/static/$tmp_name_"
159   done
160   cp $USR_SHARE_/linuxrc $INITRD_/
161   mkdir -p $INITRD_/mylib
162   mkdir -p $INITRD_/myusr/i386-uclibc-linux/lib
163   for i in libdl libc libuClibc ld-uClibc; do
164     cp -a $UCLIBC_PATH_/$i*.so* $INITRD_/myusr/i386-uclibc-linux/lib
165   done
166
167   # copy data files for discover (discover-data)
168   mkdir -p $INITRD_/mylib/discover
169   cp /lib/discover/list.xml /lib/discover/pci-*.xml $INITRD_/mylib/discover/
170
171
172   #
173   # which modules should i put into the ramdisk
174   #
175
176   # get cards detected by discover
177   isNotExistent $CARDS_DETECTED_BY_DISCOVER && awk '/ethernet/{print $3}' /lib/discover/pci.lst |sort |uniq > $CARDS_DETECTED_BY_DISCOVER
178
179   local modules="`cat $CARDS_DETECTED_BY_DISCOVER |xargs` af_packet"
180   local modules_dep=""
181
182   # get paths of modules + paths of all dependet modules
183   echo -n "" >"$TMP_"
184   for i in $modules; do
185     tmp_=`awk -F: '{if($1~/'"$i".ko'/) {print $0}}' $MODULES_PATH_/$KERNEL_VERSION_/modules.dep`
186     echo "${tmp_%%:*}"
187     # FIXME ugly sed hack :(
188     echo "${tmp_#*:}" |xargs -n1 echo |sed 's/://'
189   done \
190   | sort | uniq | while read module relax; do
191     if [ -n "$module" ]; then
192       echo "$module" >> $TMP_
193     fi
194   done
195
196   # copy modules + dependend modules into ramdisk
197   local mod_path_="$INITRD_/mylib/modules/$KERNEL_VERSION_"
198   local tmp_dst_path_="$mod_path_/kernel"
199   mkdir -p $tmp_dst_path_
200   cat $TMP_ |sort |uniq |while read module; do
201     local tmp_path=${module#*/kernel/}
202     tmp_path=$tmp_dst_path_/${tmp_path%/*.ko}
203     local module_path=$tmp_path/${module##/*/}
204
205     isNotExistent "$tmp_path" dprint && mkdir -p "$tmp_path"
206     isNotExistent "$module_path" dprint && cp "$MODULES_PATH_ROOT_DIFF_/$module" "$module_path"
207   done
208
209   # copying additional modules
210   for i in fs/nfs/nfs.ko net/sunrpc/sunrpc.ko fs/lockd/lockd.ko net/packet/af_packet.ko; do
211     local tmp_path="$tmp_dst_path_/${i%/*}"
212     mkdir -p $tmp_path
213     cp $MODULES_PATH_/$KERNEL_VERSION_/kernel/$i "$tmp_path"
214   done
215
216   # generate modules.dep
217   cp $MODULES_PATH_/$KERNEL_VERSION_/modules.dep $mod_path_
218   #grep "^\/lib\/modules\/$KERNEL_VERSION_\/kernel\/" $MODULES_PATH_/$KERNEL_VERSION_/modules.dep |\
219   #  sed "s/\/lib\/modules\/$KERNEL_VERSION_\/kernel\//\/modules\//g" > $mod_path_/modules.dep
220
221   # put everything into the new initrd
222   local tmp_size=`du -s $INITRD_ |awk '{print $1}'`   # in kB
223   let tmp_size=$tmp_size+1000
224   if (( $tmp_size >= 16000 )); then
225     warn "Your initrd is $tmp_size kByte large => TOO BIG (should be 16000kByte)"
226     warn "Please remove a few modules from $CARDS_DETECTED_BY_DISCOVER or edit $INITRD_ manually"
227     return 1
228   fi
229
230   execute "dd if=/dev/zero of=$TMP_DIR_/minirt26 bs=${tmp_size}k count=1 &>/dev/null" warn || \
231     warn "could not create filesystem image"
232
233   tmp_loopname=`findNextFreeLoop die`
234   execute "losetup $tmp_loopname $TMP_DIR_/minirt26" die
235   execute "mke2fs -L \"GRML NETINIT\" -b 1024 -N 8192 -O none -F -q -m 0 $tmp_loopname" warn
236
237   execute "mkdir $PATH_/minirt26_mountp" warn
238   execute "mount $tmp_loopname $PATH_/minirt26_mountp" warn
239   execute "cp -a $INITRD_/* $PATH_/minirt26_mountp" warn
240   execute "umount $PATH_/minirt26_mountp" warn
241   execute "losetup -d $tmp_loopname &>/dev/null" warn
242   execute "rmdir $PATH_/minirt26_mountp" warn
243   execute "gzip -9 $TMP_DIR_/minirt26" warn
244   execute "rm -r $INITRD_" warn
245   execute "mv $TMP_DIR_/minirt26.gz $PATH_"
246   execute "rm -fr $TMP_DIR_"
247 }
248 # }}}
249
250
251 # INTERACTIVE CONFIGURATION  {{{
252
253 function actionInteractive
254 {
255   local i=""
256
257   dprint "running in interactive mode"
258   
259   local card_title_="Choose network device connected to client network"
260   local card_message_="Available network devices:"
261   local iprange_title_="IP Address range for clients"
262 local iprange_message_="
263 Please enter the desired IP-Range of addresses that should be allocated by clients, separated by a single space.
264
265 Example:
266           192.168.0.101 192.168.0.200
267
268 for addresses from 192.168.0.101 to (and including) 192.168.0.200.
269
270 "
271   local runconfig_title_="Networkcard config"
272   local runconfig_message_="Would you like to configure your interfaces now?"
273   local grub_title_="Grub configuration"
274   local grub_message_="Do you have any NON-PXE network cards you would like to boot from?"
275   
276   # on witch interfaces should we listen
277   local netdevices_="$(cat /proc/net/dev | awk -F: '/eth.:|tr.:/{print $1}')"
278   local device_list_=""
279   for INTERFACE_ in $netdevices_; do device_list_="$device_list_ ${INTERFACE_} Networkcard_${INTERFACE_##eth}"; done
280     echo -n "" >"$TMP_"
281     $DIALOG_ --backtitle "$BACK_TITLE_" --title "$card_title_" --menu "$card_message_" \
282       0 0 18 $device_list_ 2>"$TMP_" || warn "could not get network-interface"
283   INTERFACE_="$(<$TMP_)" ; echo -n "" >"$TMP_"
284
285   while true; do
286     IP_=`netGetIp "$INTERFACE_" warn`
287     NETMASK_=`netGetNetmask "$INTERFACE_" warn`
288     netValidIp "$IP_" warn && break
289     $DIALOG_ --backtitle "$BACK_TITLE_" --title "$runconfig_title_" --yesno "$runconfig_message_" 18 45 && \
290       netcardconfig || die "Could not get interface" $?
291   done
292
293   IPRANGE_FROM_=`execute "ipcalc -nb $IP_/$NETMASK_" warn |awk '/HostMin/{print $2}'`
294   IPRANGE_TO_=`execute "ipcalc -nb $IP_/$NETMASK_" warn |awk '/HostMax/{print $2}'`
295   NETWORK_=`execute "ipcalc -nb $IP_/$NETMASK_" warn |awk '/Network:/{print $2}'`
296   NETWORK_=${NETWORK_%/*}
297   local iprange_=""
298   while [ -z "$IPRANGE_FROM_" -o -z "$IPRANGE_TO_" -o -z "$iprange_" ]; do
299     iprange_="$IPRANGE_FROM_ $IPRANGE_TO_"
300     echo -n "" >"$TMP_"
301     $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$iprange_title_ ($INTERFACE_=$IP_/$NETMASK_)" \
302       --inputbox "$iprange_message_" 18 75 "$iprange_" 2>"$TMP_" || die "problems getting network range" $?
303
304     iprange_="$(<$TMP_)"
305     IPRANGE_FROM_="${iprange_%% *}"
306     IPRANGE_TO_="${iprange_##* }"
307
308     for i in "$IPRANGE_FROM_" "$IPRANGE_TO_"; do
309       netValidIp "$i" warn || iprange_=""
310     done
311   done
312
313   NAMESERVERS_=`netGetNameservers warn`
314   GW_=`netGetDefaultGateway warn`
315
316
317   # grub
318   echo -n "" >"$TMP_"
319   local grub_write_="YES"
320   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$grub_title_" --yesno "$grub_message_" 5 75 && \
321     grubConfig || grub_write_="NO"
322  
323
324   # get options
325   #local OPT_IPTABLES_="yes"
326   #local OPT_SSH_="yes"
327   #local OPT_DISTCC_="yes"
328   #local OPT_SQUID_=""
329   
330   local OPTIONS_TITLE_="Options"
331   local OPTIONS_MESSAGE_="Please give the appropriate options you want the clients to use:
332
333 grml2hd   - Make a non-interactive remote installation
334
335
336  
337 "
338 #  local OPTIONS_MESSAGE_="Please give the appropriate options you want the clients to use:
339 #
340 #iptables  - Only the server should be able to access the clients
341 #ssh       - A ssh-key will be created on the server and distributed to the clients
342 #distcc    - You want to use the clients as compile-farm (ssh options recommned)
343 #
344 #"
345
346   local OPT_IPTABLES_DESC_="Start iptables on the clients"
347   local OPT_SSH_DESC_="Start ssh on the clients"
348   local OPT_DISTCC_DESC_="Start distcc on the clients"
349   local OPT_GRML2HD_DESC_="Remote install grml on the network clients"
350   # dialog options (enable if implemented)
351   #iptables "$OPT_IPTABLES_DESC_" off \
352   #ssh "$OPT_SSH_DESC_" off \
353   #distcc "$OPT_DISTCC_DESC_" off \
354   echo -n "" >"$TMP_"
355   $DIALOG_ --clear --separate-output --backtitle "$BACK_TITLE_" --title "$OPTIONS_TITLE_" --checklist "$OPTIONS_MESSAGE_" 25 80 10 \
356   grml2hd "$OPT_GRML2HD_DESC_" off \
357     2>$TMP_ || die "could not get terminalserver options" $?
358   while read tmp_option_; do
359     OPTIONS_="$OPTIONS_ $tmp_option_"
360   done <$TMP_
361
362   # parse options
363   for i in $OPTIONS_; do
364     case "$i" in
365       grml2hd)  optGrml2Hd || return 1 ;;
366     esac
367   done
368
369   echo -n "" >"$TMP_"
370   local OPTIONS_BOOTARG_MESSAGE_="Here you can add additional boot arguments for the clients seperated by spaces:
371
372 Quite usefull examples:
373
374 ssh=<pw>              - Start ssh server and set password of user grml to pw
375 services=<1,2,3>      - Execute /etc/init.d/{1,2,3} start
376 console=ttyS0,9600n8  - Initialise seriell console
377 secure                - Boot only restricted clients (without root permissions)
378 startx                - Boot into X (should be used with secure)
379  
380
381 "
382   $DIALOG_ --clear --no-collapse --backtitle "$BACK_TITLE_" --title "$OPTIONS_TITLE_" --inputbox "$OPTIONS_BOOTARG_MESSAGE_" 0 0\
383     2>$TMP_ || die "problems getting additional boot arguments"
384   BOOT_ARGS_="$BOOT_ARGS_ $(<$TMP_)"
385
386   writeConfig
387   if [ $grub_write_ == "YES" ]; then
388     grubWrite
389   fi
390   actionMkInitrd
391   notice "GRML terminalserver successfully configured"
392 }
393 # }}}
394
395 # OPTIONS GETTING DIALOG {{{
396 function optGrml2Hd
397 {
398   local GRML2HD_TITLE_='Grml2hd options dialog'
399   local tmp_=''
400   local options_='BOOT_IMAGE=grml2hd'
401   
402   # get partition to install grml2hd on
403   OPTIONS_PARTITION_MSG_='Please give me the target partition where to install grml'
404   PARTITION_TITLE_='Partition selection'
405   echo -n "" >"$TMP_"
406   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$PARTITION_TITLE_" --inputbox \
407     "$OPTIONS_PARTITION_MSG_" 0 75 '/dev/hda1' 2>$TMP_ || die "problems getting partition"
408   tmp_="partition=$(<$TMP_)"
409   options_="$options_ $tmp_"
410   
411   # get filesystem type
412   OPTION_FS_TYPE_='Please give me the filesystem type'
413   FS_TITLE_='Filesystem selection'
414   echo -n "" >"$TMP_"
415   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$FS_TITLE_" --inputbox \
416   "$OPTION_FS_TYPE_" 0 75 'ext3' 2>$TMP_ || die "problems getting filesystem type"
417   tmp_="filesystem=$(<$TMP_)"
418   options_="$options_ $tmp_"
419     
420   # get where to save mbr
421   OPTION_MBR_='Please give me the location where to save the mbr'
422   MBR_TITLE_='Select location of mbr'
423   echo -n "" >"$TMP_"
424   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$MBR_TITLE_" --inputbox \
425     "$OPTION_MBR_" 0 75 '/dev/hda' 2>$TMP_ || die "problems getting location where to write mbr"
426   tmp_="mbr=$(<$TMP_)"
427   options_="$options_ $tmp_"
428
429   # get first user
430   OPTION_USER_='Who should be the first user on the system'
431   USER_TITLE_='User selection'
432   echo -n "" >"$TMP_"
433   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$USER_TITLE_" --inputbox \
434     "$OPTION_USER_" 0 75 'grml' 2>$TMP_ || die "problems getting first user of system"
435   tmp_="user=$(<$TMP_)"
436   options_="$options_ $tmp_"
437
438   BOOT_ARGS_="$options_"
439 }
440 #}}}
441
442 # GRUB CONFIG  {{{
443 function grubConfig
444 {
445   local tmp_=`mktemp -td terminalserver_grub.XXXXXX` || warn "could not create tmp file for grubConfig"
446   if [ -z "$tmp_" ]; then return 1; fi
447
448   grubConfigWork $tmp_
449   local ret_=$?
450   execute "rm -rf $tmp_" warn
451
452   return $ret_
453 }
454
455 function grubConfigWork
456 {
457   local tmp_="$1"
458
459   local grub_title_="Grub configuration"
460   local grub_nic_message_="
461 Give me the types of network cards you would want to boot from.
462 If you networkcard is already listed press <OK>!
463
464 WARNING: DON't add all NIC's, grub could possibly stop working!!"
465   local nics_=""
466
467   while read module_ desc_ mode_; do
468     nics_="$nics_ $module_ $desc_ $mode_"
469   done < $GRUB_NIC_CONF_
470
471   echo -n "" >$TMP_
472   local cmd_line_=""
473   $DIALOG_ --clear --separate-output --backtitle "$BACK_TITLE_" --title "$grub_title_" --checklist \
474     "$grub_nic_message_" 10 70 0 $nics_ 2>$TMP_
475   local ret_=$?
476   if [[ $ret_ -ne 0 || `wc -l <$TMP_` -eq 0 ]]; then
477     echo $ret_
478     warn "you should give me your specified NICs but didn't => DEFAULT will be used"
479     awk '/ on$/{print $1}' $GRUB_NIC_CONF_ >$TMP_
480   fi
481   while read module_; do
482     cmd_line_="$cmd_line_ --enable-$module_"
483   done < $TMP_
484
485   echo "\"$cmd_line_\""
486
487   execute "tar xzf $GRUB_SOURCE_ -C $tmp_" warn || return 1
488   execute "cd $tmp_/grub*" warn || return 1
489 cat >preset-menu <<EOT
490 # Set up the serial terminal, first of all.
491 #serial --unit=0 --speed=19200
492 #terminal --timeout=0 serial
493     
494 # Initialize the network.
495 #dhcp --with-configfile
496 #bootp --with-configfile
497 dhcp
498 default 0
499 timeout 0
500 title Load config from Tftp server
501   configfile (nd)/menu.lst
502 EOT
503   #execute "./configure --enable-diskless --enable-preset-menu=./preset-menu $cmd_line_" warn || read
504   execute "CC=gcc-3.3 ./configure --enable-preset-menu=./preset-menu $cmd_line_" warn || read
505   execute "make -j2 CC=gcc-3.3" warn || read #return 1
506
507   local st1_="stage1/stage1"
508   local st2_="stage2/stage2"
509   isExistent $st1_ warn || return 1
510   isExistent $st2_ warn || return 1
511
512   execute "mv -fb $PATH_/grub.img $PATH_/grub.img.old"
513   execute "cat $st1_ $st2_ > $PATH_/grub.img" warn || return 1
514   return 0
515 }
516
517 function grubWrite
518 {
519   local grub_title_="Grub configuration"
520   $DIALOG_ --clear --backtitle "$BACK_TITLE_" --title "$grub_title_" --yesno \
521     "Do you want to write your grub image to /dev/fd0" 5 75 || return 1
522
523   execute "dd if=$PATH_/grub.img of=/dev/fd0" warn || return 0
524   return 1
525 }
526
527 function grubMultiWrite
528 {
529   local target_=${1:-'/dev/fd0'}
530   
531   isExistent "$PATH_/grub.img" die "you must give me an image or run \"$PROG_NAME__ grubconf\""
532   isExistent "$target_" die "$target_ is not a valied"
533   while true; do
534     echo -n "Please insert disk into $target_ and press <ENTER> (STRG-C for end)"
535     read
536     dd if=$PATH_/grub.img of="$target_"
537   done
538 }
539 # }}}
540
541
542 function removeTmpFiles
543 {
544   execute "rm -f $TMP_" warn
545 }
546
547 function actionClean
548 {
549   for i in dhcpd.conf grub.img minirt26.gz; do
550     execute "rm -f $PATH_/$i*"
551   done
552
553   for i in $CARDS_DETECTED_BY_DISCOVER $CONF_FILE_; do
554     execute "rm -f $i"
555   done
556
557 }
558
559
560 ###
561 ### __MAIN
562 ###
563
564 while getopts "i:hv" opt; do
565   case "$opt" in
566     i) interface_=$OPTARG ;;
567     h) printUsage; exit ;;
568     v) let verbose_=$verbose_+1 ;;
569     ?) printUsage; exit 64 ;;
570   esac
571 done
572 shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
573 setVerbose $verbose_
574
575 case "$1" in
576   help)   printUsage; exit 0 ;;
577 esac
578   
579 checkRoot die 'You have to be root to use this program'
580 disableSyslog
581
582 execute "mkdir -p $PATH_" die
583
584 TMP_=`mktemp -t grml-terminalserver-config.XXXXXX` || die "Could not create tmpfile" $?
585 setExitFunction 'removeTmpFiles'
586
587
588 . $DEFAULT_CONFIG_
589 . $CONFIG_
590 # used config vars:
591 # MODULES_PATH_
592 # MODULES_PATH_ROOT_DIFF_
593 # KERNEL_VERSION_
594 # ORIGINAL_INITRD_
595 if [[ $MODULES_PATH_ == "" || $KERNEL_VERSION_ == "" || $ORIGINAL_INITRD_ == "" ]]; then
596   warn "MODULES_PATH_=\"$MODULES_PATH_\" \
597 KERNEL_VERSION_=\"$KERNEL_VERSION_\" \
598 ORIGINAL_INITRD_=\"$ORIGINAL_INITRD_\""
599   die "False configuration, please update $CONFIG_"
600 fi
601     
602
603 case "$1" in
604   interactive)  actionInteractive ;;
605   grubConf)   grubConfig ;;
606   grubConfWrite)  grubConfig && grubWrite ;;
607   grubWrite)    grubWrite ;;
608   grubMultiWrite)   grubMultiWrite "$2" ;;
609   initrd) actionMkInitrd ;;
610   clean)  actionClean ;;
611   *)    actionInteractive ;;
612 esac
613
614 removeTmpFiles
615 # END OF FILE
616 ################################################################################
617 # vim:foldmethod=marker tabstop=2 expandtab shiftwidth=2