8ceb9c63bbd7bf656c997a8893e71299a5bf8008
[grml-terminalserver.git] / linuxrc
1 #!/static/sh
2 # Filename: /linuxrc
3 # Purpose:  minirt for kernel 2.6 running on grml live-cd
4 # Authors:  (c) Klaus Knopper <knoppix@knopper.net>, (c) Michael Prokop <mika@grml.org>
5 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
6 # Latest change: Don Nov 16 14:46:00 CET 2006 [mika]
7 =======
8 # Latest change: Mon Sep 18 23:19:53 CEST 2006 [mika]
9 >>>>>>> /tmp/linuxrc~other.LuZLNY
10 #######################################################################################
11
12 # hardcoded configurable options
13 # Default maximum size of dynamic ramdisk in kilobytes
14 RAMSIZE=1000000
15 # End of options
16
17 # Don't allow interrupt signals
18 trap "" 1 2 3 15
19
20 # Misc functions
21 INSMOD="/static/insmod"
22 # [ -x /modules/insmod ] && INSMOD="/modules/insmod"
23
24 RMMOD="/static/rmmod"
25 # [ -x /modules/rmmod ] && RMMOD="/modules/rmmod"
26
27 # Builin filesystems
28 # BUILTIN_FS="iso9660 ext2 vfat"
29 BUILTIN_FS="iso9660 ext2 ext3 reiserfs vfat xfs jfs reiser4"
30
31 mountit(){
32 # Usage: mountit src dst "options"
33 for fs in $BUILTIN_FS; do
34  if test -b $1; then
35   options="$3"
36   case "$fs" in vfat)
37    # We REALLY need this for Knoppix on DOS-filesystems
38    shortname="shortname=winnt"
39    [ -n "$options" ] && options="$options,$shortname" || options="-o $shortname"
40   ;;
41   esac
42   mount -t $fs $options $1 $2 >/dev/null 2>&1 && return 0
43  fi
44 done
45 return 1
46 }
47
48 FOUND_SCSI=""
49 FOUND_GRML=""
50 INTERACTIVE=""
51
52 # Clean input/output
53 exec >/dev/console </dev/console 2>&1
54
55 # Mount /proc and /dev/pts
56 mount -t proc /proc /proc
57
58 # Disable kernel messages while probing modules in autodetect mode
59 echo "0" > /proc/sys/kernel/printk
60
61 mount -t devpts /dev/pts /dev/pts
62 # Kernel 2.6
63 mount -t sysfs /sys /sys >/dev/null 2>&1
64
65 # Read boot command line with builtin cat command (shell read function fails in Kernel 2.4.19-rc1)
66 CMDLINE="$(cat /proc/cmdline)"
67
68 # Simple shell grep
69 stringinfile(){
70   case "$(cat $2)" in *$1*) return 0;; esac
71   return 1
72 }
73
74 # same for strings
75 stringinstring(){
76   case "$2" in *$1*) return 0;; esac
77   return 1
78 }
79
80 # Reread boot command line; echo last parameter's argument or return false.
81 getbootparam(){
82   stringinstring " $1=" "$CMDLINE" || return 1
83   result="${CMDLINE##*$1=}"
84   result="${result%%[   ]*}"
85   echo "$result"
86   return 0
87 }
88
89 # Check boot commandline for specified option
90 checkbootparam(){
91   stringinstring " $1" "$CMDLINE"
92   return "$?"
93 }
94
95 if checkbootparam "nocolor" ; then
96   echo "Disabling colors in bootsequence as requested on commandline."
97   # Reset fb color mode
98   RESET="\e]R"
99   # ANSI COLORS
100   # Erase to end of line
101   CRE="\r\e[K"
102   # Clear and reset Screen
103   CLEAR="\ec"
104 else
105   # Reset fb color mode
106   RESET="\e]R"
107   # ANSI COLORS
108   # Erase to end of line
109   CRE="\r\e[K"
110   # Clear and reset Screen
111   CLEAR="\ec"
112   # Normal color
113   NORMAL="\e[0;39m"
114   # RED: Failure or error message
115   RED="\e[1;31m"
116   # GREEN: Success message
117   GREEN="\e[1;32m"
118   # YELLOW: Descriptions
119   YELLOW="\e[1;33m"
120   # BLUE: System mesages
121   BLUE="\e[1;34m"
122   # MAGENTA: Found devices or drivers
123   MAGENTA="\e[1;35m"
124   # CYAN: Questions
125   CYAN="\e[1;36m"
126   # BOLD WHITE: Hint
127   WHITE="\e[1;37m"
128 fi
129
130 # don't output anything if running with bootsplash feature
131 if checkbootparam "splash" ; then
132   echo ""
133   echo "${WHITE}Welcome to"
134   echo ""
135   echo "${RED}   ____ ____  __  __ _     "
136   echo "${RED}  / ___|  _ \|  \/  | |    "
137   echo "${RED} | |  _| |_) | |\/| | |    "
138   echo "${RED} | |_| |  _ <| |  | | |___ "
139   echo "${RED}  \____|_| \_\_|  |_|_____|"
140   echo ""
141   echo "${WHITE}grml.org - Linux for users of texttools and sysadmins."
142   echo "${NORMAL}"
143   exec >/dev/null </dev/null 2>&1
144 fi
145
146 # helper functions {{{
147 #log_success_msg () {
148 #  echo " * $@"
149 #}
150
151 log_failure_msg () {
152   echo " ${RED}*${NORMAL} $@"
153 }
154
155 #log_warning_msg () {
156 # echo " ${BLUE}*${NORMAL} $@"
157 #}
158
159 # int log_begin_message (char *message)
160 log_begin_msg () {
161   echo -n " ${GREEN}*${NORMAL} $@"
162 }
163
164 log_warn_msg () {
165   echo -n " ${YELLOW}*${NORMAL} $@"
166 }
167
168 # int log_end_message (int exitstatus)
169 SUCCESS=" ${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}"
170 FAILED=" ${NORMAL}[${RED}fail${NORMAL}]"
171 # }}}
172
173 # Clear screen with colormode reset
174 # echo "$CLEAR$RESET"
175 # echo "$CLEAR"
176 # Just go to the top of the screen
177 # echo -n "\e[H\e[J"
178 echo ""
179 echo "${WHITE}Welcome to"
180 echo ""
181 echo "${RED}   ____ ____  __  __ _     "
182 echo "${RED}  / ___|  _ \|  \/  | |    "
183 echo "${RED} | |  _| |_) | |\/| | |    "
184 echo "${RED} | |_| |  _ <| |  | | |___ "
185 echo "${RED}  \____|_| \_\_|  |_|_____|"
186 echo ""
187 echo "${WHITE}grml.org - Linux for users of texttools and sysadmins."
188 echo "${NORMAL}"
189
190 # We only need the builtin commands and /static at this point
191 PATH=/static
192 export PATH
193
194 umask 022
195
196 case "$CMDLINE" in *debuglinuxrc*) set -x; echo "linuxrc debugging activated"; DEBUG="yes"; ;; esac
197 case "$CMDLINE" in *BOOT_IMAGE=expert\ *) INTERACTIVE="yes"; :>/interactive; ;; esac
198 case "$CMDLINE" in *BOOT_IMAGE=vmware\ *) VMWARE="yes"; ;; esac
199 case "$CMDLINE" in *modules-disk*) INTERACTIVE="yes"; ;; esac
200 case "$CMDLINE" in *BOOT_IMAGE=debug\ *|*\ debug\ *) DEBUG="yes"; ;; esac
201 case "$CMDLINE" in *secure*) SECURE=",nosuid"; ;; esac
202 # Does the user want to skip scsi detection?
203 NOSCSI=""
204 NOUSB=""
205 NOFIREWIRE=""
206 case "$CMDLINE" in *noscsi*|*nobootscsi*) NOSCSI="yes"; ;; esac
207 case "$CMDLINE" in *nousb\ *|*nobootusb*) NOUSB="yes"; ;; esac
208 case "$CMDLINE" in *nofirewire*|*nobootfirewire*) NOFIREWIRE="yes"; ;; esac
209 NOCD=""
210 case "$CMDLINE" in *fromhd*) NOCD="yes"; ;; esac
211 case "$CMDLINE" in *fromdvd*) FROMDVD="yes"; ;; esac
212 case "$CMDLINE" in *idecd*|*atapicd*) IDECD="yes"; ;; esac
213 case "$CMDLINE" in *noideraid*) NOIDERAID="yes"; ;; esac
214 USB2="ehci-hcd.ko"
215 case "$CMDLINE" in *nousb2*) USB2="" NOUSB2="yes"; ;; esac
216 case "$CMDLINE" in *\ usb*) USB="yes"; ;; esac
217
218 GRML_DIR="GRML"
219 GRML_NAME="GRML"
220 case "$CMDLINE" in *grml_dir=*) GRML_DIR="$grml_dir"; ;; esac
221 case "$CMDLINE" in *grml_name=*) GRML_NAME="$grml_name"; ;; esac
222
223 if [ -n "$DEBUG" ]; then
224    log_begin_msg "Bootoption debug detected. Printing kernel command line:"
225    echo ""
226    cat /proc/cmdline
227 fi
228
229 # Run a shell if in debug mode
230 # echo "${BLUE}Dropping you to a busybox shell for debugging.${NORMAL}"
231 stage=1
232 rundebugshell(){
233  if [ -n "$DEBUG" ]; then
234   log_begin_msg "Starting intermediate shell stage $stage as requested by \"debug\" option."
235   echo ""
236   echo "   ${GREEN}-${NORMAL} Just exit the shell to continue boot process...${NORMAL}"
237   if [ -x /static/sh ]; then
238     /static/sh
239   else
240     /bin/bash
241   fi
242  fi
243 }
244 rundebugshell
245
246 # Mount module disk
247 mountmodules(){
248 TYPE="$1"; shift
249 echo -n "${CRE}Please insert ${TYPE} modules disk and hit Return."
250 read a
251 echo -n "${CRE}Mounting ${TYPE} modules disk... "
252 # We always mount over /modules/scsi (because it's there ;-)
253 if mountit /dev/fd0 /modules/scsi "-o ro"; then
254 echo "${GREEN}OK.${NORMAL}"
255 return 0
256 fi
257 echo "${RED}NOT FOUND.${NORMAL}"
258 return 1
259 }
260
261 # Unmount module disk
262 umountmodules(){
263 TYPE="$1"; shift
264 echo -n "${CRE}Unmounting ${TYPE} modules disk... "
265 umount /modules/scsi 2>/dev/null
266 echo "${GREEN}DONE.${NORMAL}"
267 }
268
269 # Ask user for modules
270 askmodules(){
271 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
272  TYPE="$1"; shift
273  echo "${TYPE} modules available:${WHITE}"
274  c=""
275  for m in "$@"; do
276   if test -f "/modules/scsi/$m"; then
277    test -z "$c"  && { echo -n " $m"; c="1"; } || { echo "               $m"; c=""; }
278   fi
279  done
280  [ -n "$c" ] && echo ""
281  echo "Load ${TYPE} Modules?"
282  echo "[Enter full filename(s) (space-separated), Return for autoprobe, n for none] "
283  echo -n "insmod module(s)> "
284  read MODULES
285  case "$MODULES" in n|N) MODULES=""; ;; y|"")  MODULES="$*"; ;; esac
286 =======
287  TYPE="$1"; shift
288  echo "${TYPE} modules available:${WHITE}"
289  c=""
290  for m in "$@"; do
291   if test -f "/modules/scsi/$m"; then
292    test -z "$c"  && { echo -n " $m"; c="1"; } || { echo "               $m"; c=""; }
293   fi
294  done
295  [ -n "$c" ] && echo ""
296  echo "Load ${TYPE} Modules?"
297  echo "[Enter full filename(s) (space-separated), Return for autoprobe, n for none] "
298  echo -n "insmod module(s)> "
299  read MODULES
300  case "$MODULES" in n|N) MODULES=""; ;; y|"")  MODULES="$*"; ;; esac
301 >>>>>>> /tmp/linuxrc~other.LuZLNY
302 }
303
304 # Try to load the given modules (full path or current directory)
305 loadmodules(){
306  TYPE="$1"; shift
307  test -n "$INTERACTIVE" && echo "6" > /proc/sys/kernel/printk
308  echo ""
309  for i in "$@"; do
310   echo -n "   Probing ${TYPE}... ${WHITE}$i${NORMAL}: "
311    if test -f /modules/scsi/$i.ko && $INSMOD -f /modules/scsi/$i.ko >/dev/null 2>&1 && echo "  $SUCCESS" || echo " failed " ; then
312      case "$TYPE" in scsi|SCSI) FOUND_SCSI="yes"; ;; esac
313    fi
314  done
315  test -n "$INTERACTIVE" && echo "0" > /proc/sys/kernel/printk
316  echo -n "${CRE}"
317 }
318
319 # Check for SCSI, use modules on bootfloppy first
320 # Trying to do kind of /proc/pci hardware detection
321 if checkbootparam oldscsi ; then
322   PROCPCI="`cat /proc/pci 2>/dev/null`"
323   case "$PROCPCI" in *[Aa][Ii][Cc]-*|*[Aa][Hh][Aa]-*) SCSI_PROBE="$SCSI_PROBE aic7xxx" ;; esac
324   case "$PROCPCI" in *[Bb][Uu][Ss][Ll][Oo][Gg][Ii][Cc]*) SCSI_PROBE="$SCSI_PROBE BusLogic" ;; esac
325   case "$PROCPCI" in *[Tt][Rr][Mm]-[Ss]1040*|*[Dd][Cc]395*|*[Dd][Cc]315*) SCSI_PROBE="$SCSI_PROBE dc395x" ;; esac
326   case "$PROCPCI" in *53[Cc]8*) SCSI_PROBE="$SCSI_PROBE sym53c8xx" ;; esac
327   case "$PROCPCI" in *53[Cc]9*) SCSI_PROBE="$SCSI_PROBE NCR53C9x" ;; esac
328   case "$PROCPCI" in *53[Cc]406*) SCSI_PROBE="$SCSI_PROBE NCR53c406a" ;; esac
329   case "$PROCPCI" in *[Ii][Nn][Ii][Tt][Ii][Oo]\ *|*[Ii][Nn][Ii]-[Aa]100[Uu]2[Ww]*) SCSI_PROBE="$SCSI_PROBE initio" ;; esac
330   case "$PROCPCI" in *[Mm][Pp][Tt]*[Ss][Cc][Ss][Ii]*) SCSI_PROBE="$SCSI_PROBE mptbase mptscsih" ;; esac
331   case "$PROCPCI" in *[Aa][Dd][Vv][Aa][Nn][Cc][Ee][Dd]\ [Ss][Yy][Ss]*) SCSI_PROBE="$SCSI_PROBE advansys" ;; esac
332   case "$PROCPCI" in *[Aa][Tt][Pp]8*|*[Aa][Ee][Cc]6*) SCSI_PROBE="$SCSI_PROBE atp870u" ;; esac
333   case "$PROCPCI" in *[Dd][Tt][Cc]*) SCSI_PROBE="$SCSI_PROBE dtc" ;; esac
334   case "$PROCPCI" in *[Ee][Aa][Tt][Aa]*) SCSI_PROBE="$SCSI_PROBE eata" ;; esac
335   case "$PROCPCI" in *[Ff]*[Dd][Oo][Mm][Aa][Ii][Nn]*) SCSI_PROBE="$SCSI_PROBE fdomain" ;; esac
336   case "$PROCPCI" in *[Gg][Dd][Tt]\ *) SCSI_PROBE="$SCSI_PROBE gdth" ;; esac
337   case "$PROCPCI" in *[Mm][Ee][Gg][Aa][Rr][Aa][Ii][Dd]*) SCSI_PROBE="$SCSI_PROBE megaraid_mm megaraid_mbox" ;; esac
338   case "$PROCPCI" in *[Qq][Ll][Oo][Gg][Ii][Cc]*) SCSI_PROBE="$SCSI_PROBE qlogicfas408 qlogicfas qlogicfc" ;; esac
339   case "$PROCPCI" in *53[Cc]974*) SCSI_PROBE="$SCSI_PROBE tmscsim" ;; esac
340   case "$PROCPCI" in *[Uu][Ll][Tt][Rr][Aa][Ss][Tt][Oo][Rr]*) SCSI_PROBE="$SCSI_PROBE ultrastor" ;; esac
341   case "$PROCPCI" in *3[Ww][Aa][Rr][Ee]*) SCSI_PROBE="$SCSI_PROBE 3w-xxxx" ;; esac
342 fi
343
344 # New sysfs based SCSI detection (thanks, Jörg Schirottke)
345 sysfsscsi(){
346 SYS=$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x; done|cut -f2 -d:)
347 while read id driver; do
348  for sysid in $SYS; do
349   case $sysid in $id)
350    if [ -z "$SCSI_PROBE" ]; then
351     SCSI_PROBE="$driver"
352    else
353     SCSI_PROBE="$SCSI_PROBE $driver"
354    fi
355    ;;
356   esac
357  done
358 done <<EOF
359 $(cat /modules/scsi/scsi-modules.txt)
360 EOF
361 }
362
363 if test -n "$INTERACTIVE"; then
364 # Let the user select interactively
365   askmodules SCSI $(cd /modules/scsi; echo *.ko)
366 else
367 # these are the autoprobe-safe modules
368   sysfsscsi
369   MODULES="$SCSI_PROBE"
370 fi
371
372 if test -z "$NOSCSI" ; then
373  log_begin_msg "Scanning for SCSI devices."
374  $INSMOD -f /modules/scsi/firmware_class.ko 1>/dev/null
375  test -n "$MODULES" && loadmodules SCSI $MODULES &&  echo -n "" || echo "           ${BLUE}[${NORMAL} none found ${BLUE}]${NORMAL} (try bootoption scsi=probe)"
376 else
377   log_warn_msg "Not scanning for SCSI devices as requested on commandline." && echo " $SUCCESS"
378 fi
379
380 if checkbootparam scsi ; then
381   MODULE="$(getbootparam 'scsi' 2>/dev/null)"
382   if test "$MODULE" = "probe" ; then
383     log_begin_msg "Bootoption scsi=probe found. Trying to autoprobe SCSI modules:"
384     echo ""
385     echo -n "   Trying to load scsi_debug: " ; $INSMOD -f /modules/scsi/scsi_debug.ko 1>/dev/null && echo "           $SUCCESS" || echo " [ failed ]"
386     for module in /modules/scsi/*.ko ; do
387       echo -n "   Probing ${WHITE}${module}${NORMAL}..."
388       $INSMOD -f ${module} >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
389     done
390   elif test "$MODULE" = "ask" ; then
391     askmodules SCSI $(cd /modules/scsi; echo *.ko)
392     test -z "$NOSCSI" && test -n "$MODULES" && loadmodules SCSI $MODULES
393   else
394     [ -n "$MODULE" ] || echo "   ${RED}Neither a specific module nor option probe nor option ask for SCSI module given. Skipping.${NORMAL}"
395     [ -n "$MODULE" ] && echo -n "   Trying to load module ${WHITE}${MODULE}${NORMAL}:" ; \
396       $INSMOD -f "/modules/scsi/${MODULE}.ko" 1>/dev/null && echo "  $SUCCESS" || echo " [ failed ]"
397   fi
398 fi
399 # End of SCSI check
400
401 if test -n "$VMWARE" ; then
402   log_begin_msg "Bootoption VMware detected. Trying to load SCSI modules:"
403   echo ""
404   for module in mptbase mptscsih mptspi BusLogic ; do
405     echo -n "   Trying to load ${WHITE}${module}${NORMAL}: "
406     $INSMOD -f /modules/scsi/${module}.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
407   done
408 fi
409
410 # Check for USB, use modules on bootfloppy first
411 if test -z "$NOUSB"; then
412   log_begin_msg "Checking for USB."
413   if test -f /modules/div/usbcore.ko; then
414     $INSMOD /modules/div/usbcore.ko >/dev/null 2>&1
415     FOUNDUSB=""
416     for i in $USB2 uhci-hcd.ko ohci-hcd.ko ; do
417       test -f /modules/div/$i && $INSMOD /modules/div/$i >/dev/null 2>&1 && FOUNDUSB="yes"
418     done
419     if test -n "$FOUNDUSB"; then
420       test -f /modules/div/usb-storage.ko && $INSMOD /modules/div/usb-storage.ko >/dev/null 2>&1
421       echo "                   $SUCCESS"
422     else
423       echo "                   ${BLUE}[${NORMAL} not found ${BLUE}]${NORMAL}"
424       true
425     fi
426     if [ -n "$NOUSB2" ] ; then
427       echo "   Not loading usb2 module ehci-hcd as requested on commandline."
428       echo "   Notice: to skip loading of USB in initrd at all use bootoption nousb"
429     fi
430   fi
431 else
432   log_warn_msg "Not scanning for USB devices as requested on commandline." && echo " $SUCCESS"
433   echo "   Notice that bootoption nousb affects initrd only, it does *not*"
434   echo "   avoid loading of usb modules in userspace afterwards"
435   echo "   Boot using something like 'nousb blacklist=uhci-hcd' to avoid loading of usb modules at all"
436 fi
437 # End of USB check
438
439 # Check for Firewire, use modules on bootfloppy first
440 if test -z "$NOFIREWIRE" ; then
441   log_begin_msg "Checking for Firewire."
442   if test -f /modules/div/ieee1394.ko ; then
443     $insmoD /modules/div/ieee1394.ko > /dev/null 2>&1
444     FOUNDFIREWIRE=""
445     test -f /modules/div/ohci1394.ko && $INSMOD /modules/div/ohci1394.ko > /dev/null 2>&1 && FOUNDFIREWIRE="yes"
446     if test -n "$FOUNDFIREWIRE" ; then
447       test -f /modules/div/sbp2.ko && $INSMOD /modules/div/sbp2.ko > /dev/null 2>&1
448       echo "              $SUCCESS"
449     else
450       echo "               ${BLUE}[${NORMAL} not found ${BLUE}]${NORMAL}"
451       true
452     fi
453   fi
454 else
455   log_warn_msg "Not scanning for firewire devices as requested on commandline." && echo " $SUCCESS"
456   echo "   Notice that bootoption nofirewire affects initrd only, it does *not*"
457   echo "   avoid loading of firewire modules in userspace afterwards"
458   echo "   Boot with something like 'nofirewire blacklist=ohci1394' to avoid loading of firewire modules at all"
459 fi
460 # End of FIREWIRE check
461
462 # Unfortunately, hotpluggable devices tend to need some time in order to register
463 if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then
464   log_begin_msg "Scanning for USB/Firewire devices."
465   sleep 4
466   if test -n "$USB"; then
467     sleep 10
468   fi
469  echo "  $SUCCESS"
470 fi
471
472 if checkbootparam scandelay ; then
473   DELAY="$(getbootparam 'scandelay' 2>/dev/null)"
474   [ -z $DELAY ] && DELAY='10'
475   log_begin_msg "Delaying bootsequence as requested for ${WHITE}${DELAY}${NORMAL} seconds."
476   sleep $DELAY && echo "  $SUCCESS"
477 fi
478
479 # boot via pcmcia
480 if checkbootparam bootpcmcia ; then
481   log_begin_msg "Bootoption bootpcmcia found. Trying to load ${WHITE}PCMCIA${NORMAL} modules..."
482   if $INSMOD -f /modules/div/pcmcia_core.ko 1>/dev/null ; then
483      $INSMOD -f /modules/div/firmware_class.ko 1>/dev/null && \
484      $INSMOD -f /modules/div/pcmcia.ko         1>/dev/null && \
485      $INSMOD -f /modules/div/rsrc_nonstatic.ko 1>/dev/null && \
486      $INSMOD -f /modules/div/yenta_socket.ko   1>/dev/null && echo " $SUCCESS"
487   else
488     echo " [ failed ]"
489   fi
490 fi
491
492 # Check for misc modules in expert mode
493 if test -n "$INTERACTIVE" ; then
494   another=""
495   answer=""
496   while test "$answer" != "n" -a "$answer" != "N" ; do
497     echo -n "${CYAN}Do you want to load additional modules from$another floppy disk? [${WHITE}Y${CYAN}/n] ${NORMAL}"
498     another=" another"
499     read answer
500     case "$answer" in n*|N*) break; ;; esac
501     if mountmodules new ; then
502        askmodules new $(cd /modules/scsi; echo *.ko)
503        test -n "$MODULES" && loadmodules new $MODULES
504        umountmodules current
505     fi
506   done
507 fi
508 # All interactively requested modules should be loaded now.
509
510 # Check for ide-scsi supported CD-Roms et al.
511 test -f /proc/scsi/scsi && FOUND_SCSI="yes"
512
513 # Disable kernel messages again
514 echo "0" > /proc/sys/kernel/printk
515
516 # We now enable DMA right here, for faster reading/writing from/to IDE devices
517 # in FROMHD or TORAM mode
518 case "$CMDLINE" in *\ nodma*) ;; *)
519  for d in $(cd /proc/ide 2>/dev/null && echo hd[a-z]); do
520   if test -d /proc/ide/$d; then
521     MODEL="$(cat /proc/ide/$d/model 2>/dev/null)"
522     test -z "$MODEL" && MODEL="[GENERIC IDE DEVICE]"
523     log_begin_msg "Enabling DMA acceleration for: ${MAGENTA}$d   ${YELLOW}[${MODEL}]${NORMAL}"
524     echo "using_dma:1" >/proc/ide/$d/settings && echo ""
525   fi
526  done
527  ;;
528 esac
529
530 stage=2
531 rundebugshell
532 # NFS
533 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
534 if [ -n "$NFS" ]; then
535   tmp_="$(getbootparam nfsdir)"
536   echo -n "checkbootparam nfsdir   "
537   checkbootparam "nfsdir" && echo "OK" || echo "FAILED"
538   echo "getbootparam nfsdir=\"$tmp_\""
539
540   # put the mylibs into /lib for discover and udhcpc
541   cdir
542
543   # starting hw-detection for network card
544   echo "Starting hw-detection"
545   kernel_version_=`uname -r`
546   modules_to_load=$(/static/discover --disable-bus all --enable-bus pci --type network --normalize-whitespace --data-path=linux/module/name --data-version=$kernel_version_ | grep -v '^ $' | uniq)
547   echo "trying to load the following network modules:  \"$modules_to_load\""
548
549   # FIXME modprobe is buggy from busybox
550   modules_to_load=`echo $modules_to_load | xargs`
551   modLoad()
552   {
553     for mod in $@ ; do
554       tmp_="`modprobe -vn $mod`"
555       if [ $? -ne 0 ]; then
556         continue
557       fi
558       eval "$tmp_"
559     done
560   }
561   modLoad "$modules_to_load"
562
563   # loading additional modules
564   modLoad sunrpc lockd af_packet nfs
565
566   /static/udhcpc --foreground --quit --script=/static/udhcp-config.sh
567   #echo "press <enter> to start a system shell and configure your system"
568   #sh
569
570   # recreate the old dir structures
571   rdir
572   #rm -rf /myusr /mylib
573
574   log_begin_msg "${RED}Debug: NFS = ${NFS}${NORMAL}"
575   log_begin_msg -n "${CRE}${BLUE}Looking for GRML in: ${MAGENTA}$NFS${NORMAL}   "
576   if mount -t nfs "$NFS" -o "async,ro,nolock" /cdrom #>/dev/null 2>&1
577 =======
578 if checkbootparam "nfsdir" ; then
579   NFS="$(getbootparam nfsdir)"
580 #  if test -z $NFS
581 #    then
582 #    NFS=192.168.0.1
583 #    echo "${CRE}${BLUE}No NFS-server given, assuming default $NFS${NORMAL}"
584 #  fi
585   echo "${RED}Debug: NFS = ${NFS}${NORMAL}"
586   log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in: ${MAGENTA}$NFS${NORMAL}"
587   if mountit -t nfs $NFS "-o ro" >/dev/null 2>&1
588 >>>>>>> /tmp/linuxrc~other.LuZLNY
589     then
590     if test -f /cdrom/$GRML_DIR/$GRML_NAME
591       then
592       log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}${NFS}${NORMAL}" ; echo "     $SUCCESS"
593       FOUND_GRML="$NFS"
594       break
595     fi
596     umount /cdrom
597   fi
598 fi
599
600 # Now that the right SCSI driver is (hopefully) loaded, try to find CD-ROM
601 if test -z $NFS ; then
602   DEVICES="/dev/hd?"
603   test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
604   # New: Also try parallel port CD-Roms [for Mike].
605   DEVICES="$DEVICES /dev/pcd?"
606   # New: also check HD partitions for a GRML/GRML image
607   # notice: use /dev/sd? for usb-sticks without partition(s)
608   test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd?[1-9] /dev/sd?[1-9][0-9] /dev/sd?"
609   DEVICES="$DEVICES /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
610   case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac
611   for i in $DEVICES
612   do
613   log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in:    ${MAGENTA}$i${NORMAL}"
614   if mountit $i /cdrom "-o ro" >/dev/null 2>&1
615     then
616     echo "  $SUCCESS"
617     if test -f /cdrom/$GRML_DIR/$GRML_NAME
618       then
619       log_begin_msg "Accessing grml CD-ROM at: ${MAGENTA}$i${NORMAL}" ; echo "  $SUCCESS"
620       FOUND_GRML="$i"
621       break
622     fi
623     umount /cdrom
624   fi
625   done
626 fi
627
628 # Harddisk-installed script part version has been removed
629 # (GRML can be booted directly from HD now).
630 mount_grml()
631 {
632   if test -n "$FOUND_GRML" -a -f $1/$GRML_DIR/$GRML_NAME; then
633     # echo "6" > /proc/sys/kernel/printk
634     mount -t squashfs $1/$GRML_DIR/$GRML_NAME /GRML -o loop,ro$SECURE || FOUND_GRML=""
635   fi
636 }
637
638 remount_grml()
639 {
640   if test -f $TARGET/$GRML_DIR/$GRML_NAME; then
641     umount /GRML # unmount it
642     umount $SOURCE  # unmount CD
643     [ -n "$SOURCE2" ] && umount $SOURCE2  # umount possible loop-device
644     mount_grml $TARGET
645   else
646     log_failure_msg "Warning: Changing to $TARGET failed."
647     return 1
648   fi
649
650   return 0
651 }
652
653 boot_from()
654 {
655   # preparations
656   /bin/mkdir $TARGET
657
658   SOURCE_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/bootfrom=/s/.*=//p' | /usr/bin/tail -1)
659
660   LOOP_DEV=$(echo $SOURCE_DEV | /usr/bin/gawk -F/ '{ print $1 "/" $2 "/" $3 }')
661   ISO_PATH=$(echo $SOURCE_DEV | /bin/sed "s|$LOOP_DEV||g" )
662   case "$ISO_PATH" in /*.[iI][sS][oO]) ;; *) ISO_PATH="" ;; esac
663   LOOP_SOURCE=""
664
665   # load filesystems
666   /GRML/sbin/modprobe fuse
667   /GRML/sbin/modprobe ntfs
668   $INSMOD -f /modules/div/ntfs.ko 1>/dev/null
669
670   if [ -n "$ISO_PATH" ]; then
671      LOOP_SOURCE="$TARGET.loop"
672      LOOP_SOURCE2="$LOOP_SOURCE"
673      TARGET_DEV="$LOOP_SOURCE$ISO_PATH"
674      /bin/mkdir $LOOP_SOURCE
675      /bin/mount -o ro $LOOP_DEV $LOOP_SOURCE || LOOP_SOURCE=""
676      /bin/mount -n -o loop $LOOP_SOURCE2$ISO_PATH $TARGET
677   else
678      TARGET_DEV="$SOURCE_DEV"
679     /bin/mount -n -o ro $SOURCE_DEV $TARGET
680   fi
681   if [ $? -ne 0 ]; then
682      [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
683      log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable."
684      sleep 2
685      return 1
686   fi
687
688   if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then
689     log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo "  $SUCCESS"
690   else
691     log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}"
692     [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
693     umount $TARGET
694     sleep 2
695     return 1
696   fi
697   # remount the CD
698   remount_grml
699 }
700
701 copy_to()
702 {
703   # preparations
704   /bin/mkdir $TARGET
705   COPY="$SOURCE/$GRML_DIR"
706
707   # look if we copy to hd or to ram
708   SIZE="$(/usr/bin/du -s $COPY | /usr/bin/gawk '{print int($1*1.1)}')"
709   test -n "$SIZE" || SIZE="800000"
710
711   case "$1" in
712     ram)
713       TARGET_DEV="/dev/shm"
714       TARGET_DEV_DESC="ramdisk"
715       FOUNDSPACE="$(/usr/bin/gawk '/MemTotal/{print $2}' /proc/meminfo)"
716       /bin/mount -n -t tmpfs -o size=${SIZE}k $TARGET_DEV $TARGET
717     ;;
718     hd)
719       TARGET_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1)
720       TARGET_DEV_DESC="$TARGET_DEV"
721       # load filesystems
722 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
723       /GRML/sbin/modprobe fuse
724       /GRML/sbin/modprobe ntfs
725       FS="ext3 ext2 reiserfs reiser4 vfat ntfs"
726
727       MOUNTED=""
728       for i in $FS; do
729        if /GRML/bin/mount -o rw -t "$i" "$TARGET_DEV" "$TARGET"; then
730         MOUNTED="true"
731         break
732        fi
733       done
734       if test -z "$MOUNTED"; then
735         log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable."
736         sleep 2
737 =======
738       /GRML/sbin/modprobe fuse
739       /GRML/sbin/modprobe ntfs
740       FS="ext3 ext2 reiserfs reiser4 vfat ntfs"
741
742       MOUNTED=""
743       for i in $FS; do
744        if /GRML/bin/mount -o rw -t "$i" "$TARGET_DEV" "$TARGET"; then
745         MOUNTED="true"
746         break
747        fi
748       done
749       if test -z "$MOUNTED"; then
750         echo -n "${CRE} ${RED}Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${RED} is not mountable.${NORMAL}"
751         sleep 2
752 >>>>>>> /tmp/linuxrc~other.LuZLNY
753         return 1
754       fi
755       # check for enough free space
756       USED_SPACE=0
757       [ -f $TARGET/$GRML_DIR/$GRML_NAME ] && USED_SPACE=$(/usr/bin/du -s $TARGET/$GRML_DIR/$GRML_NAME | /usr/bin/gawk '{ print $1 }')
758       FOUNDSPACE="$(/bin/df -k $TARGET | /usr/bin/tail -1 | /usr/bin/gawk '{ print $4+int('$USED_SPACE') }')"
759    ;;
760    *)
761      return 1
762    ;;
763   esac
764
765   # sanity check
766
767   if [ $FOUNDSPACE -lt $SIZE ]
768   then
769     log_failure_msg "Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${NORMAL}. Found: ${MAGENTA}${FOUNDSPACE}k${NORMAL} Need: ${MAGENTA}${SIZE}k${NORMAL}"
770     sleep 2
771     umount $TARGET
772     return 1
773   fi
774
775   # do the real copy
776 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
777
778   log_begin_msg "Copying grml CD-ROM to ${TARGET_DEV_DESC}... Please be patient."
779   echo
780 =======
781
782   echo "${CRE} ${GREEN}Copying grml CD-ROM to ${MAGENTA}$TARGET_DEV_DESC${GREEN}... Please be patient. ${NORMAL}"
783 >>>>>>> /tmp/linuxrc~other.LuZLNY
784   if [ -z "$use_cp" -a -x /usr/bin/rsync ]
785   then
786     # first cp the small files
787     /usr/bin/rsync -a --exclude="$GRML_DIR/$GRML_NAME" $COPY $TARGET # Copy grml to $TARGET
788     # then the big file with nice progress meter
789     [ -f $TARGET/$GRML_DIR/$GRML_NAME ] && /bin/rm -f $TARGET/$GRML_DIR/$GRML_NAME
790     /usr/bin/rsync -a --progress --include="$GRML_DIR/$GRML_NAME" --include="$GRML_DIR/" --exclude="*" $COPY $TARGET # Copy grml to $TARGET
791     #/usr/bin/rsync -avP $COPY $TARGET # Copy grml to $TARGET
792     # make sure to support directories from http://grml.org/config/
793     for dir in scripts bootparams config debs ; do
794         if [ -d "/cdrom/$dir" ] ; then
795            log_begin_msg "Customization directory $dir found, copying to $TARGET"
796            cp -a /cdrom/$dir $TARGET/ && echo "$SUCCESS" || echo "$FAILED"
797         fi
798     done
799   else
800     /bin/cp -a -f $COPY $TARGET # Copy grml to $TARGET
801   fi
802   if [ $? -ne 0 ]
803   then
804     log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left."
805     sleep 2
806     return 1
807   fi
808   # remount r/o
809 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
810   /bin/mount -n -o remount,ro $TARGET 1>/dev/null 2>&1
811 =======
812   /bin/mount -n -o remount,ro $TARGET
813 >>>>>>> /tmp/linuxrc~other.LuZLNY
814   remount_grml
815 }
816
817 mount_grml /cdrom
818
819 COPYTO=""
820 BOOTFROM=""
821 DO_REMOUNT=""
822 REAL_TARGET=""
823 UNIONFS=""
824
825 case "$CMDLINE" in *toram*) DO_REMOUNT="yes"; COPYTO="ram"; ;; esac
826 case "$CMDLINE" in *tohd=*) DO_REMOUNT="yes"; COPYTO="hd"; ;; esac
827 case "$CMDLINE" in *bootfrom=*) DO_REMOUNT="yes"; BOOTFROM="yes" ;; esac
828
829 # Remount later after copying/isoloading/driverloading?
830 # pre-test if everything succeeded
831 if  test -n "$DO_REMOUNT" -a -n "$FOUND_GRML" ; then
832   # copy library cache
833   cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
834   echo ""
835
836   SOURCE="/cdrom"
837   TARGET="/cdrom2"
838 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
839
840   # first copy_to, then boot_from
841   if [ -n "$COPYTO" ]; then
842      copy_to $COPYTO && REAL_TARGET="$TARGET"
843   fi
844   if [ -n "$BOOTFROM" ]; then
845      boot_from
846      if [ "$?" -eq "0" ]; then
847         # set new source / target paths
848         REAL_TARGET="$TARGET"
849         SOURCE2="$LOOP_SOURCE"
850         SOURCE="/cdrom2"
851         TARGET="/cdrom3"
852 =======
853
854   # first copy_to, then boot_from
855   if [ -n "$COPYTO" ]; then
856    copy_to $COPYTO && REAL_TARGET="$TARGET"
857   fi
858   if [ -n "$BOOTFROM" ]; then
859     boot_from
860     if [ "$?" -eq "0" ]; then
861       # set new source / target paths
862       REAL_TARGET="$TARGET"
863       SOURCE2="$LOOP_SOURCE"
864       SOURCE="/cdrom2"
865       TARGET="/cdrom3"
866 >>>>>>> /tmp/linuxrc~other.LuZLNY
867     fi
868   fi
869 fi
870
871 # Final test if everything succeeded.
872 if test -n "$FOUND_GRML"
873 then
874 # copy library cache
875 cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
876
877 UNIONFS=""
878 $INSMOD /modules/unionfs.ko 1>/dev/null
879 grep -q unionfs /proc/filesystems && UNIONFS=yes
880
881 # Enable kernel messages
882 echo "6" > /proc/sys/kernel/printk
883
884 # Set paths
885 log_begin_msg "Setting paths"
886 PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:."
887 export PATH
888
889 # Make space: We don't need the modules anymore from here.
890 /GRML/bin/rm -rf /modules
891 # Debian weirdness
892 /GRML/bin/cp -a /GRML/etc/alternatives /etc/ 2>/dev/null
893
894 # Replace /sbin
895 /GRML/bin/rm -f /sbin
896 /GRML/bin/ln -sf /GRML/sbin /sbin
897
898 # From here, we should have all essential commands available.
899 hash -r
900
901 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
902 # Did we remount the source media?
903 if  test -n "$REAL_TARGET"; then
904   /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot
905 =======
906 # Did we remount the source media ?
907 if  test -n "$REAL_TARGET";
908 then
909    /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot
910 >>>>>>> /tmp/linuxrc~other.LuZLNY
911 fi
912
913 # Clean up /etc/mtab (and - just in case - make a nice entry for looped ISO)
914 egrep " /GRML | /cdrom " /proc/mounts 2>/dev/null | sed 's|/dev/loop0 /cdrom \(.*\) 0 0|'$LOOP_SOURCE$ISO_PATH' /cdrom/ \1,loop=/dev/loop0 0 0|g' >> /etc/mtab
915
916 # Clean up /
917 /GRML/bin/rm -rf /modules /static
918 echo "                       $SUCCESS"
919
920 # New in Kernel 2.4.x: tempfs with variable ramdisk size.
921 # We check for available memory anyways and limit the ramdisks
922 # to a reasonable size.
923 FOUNDMEM="$(awk '/MemTotal/{print $2}' /proc/meminfo)"
924 TOTALMEM="$(awk 'BEGIN{m=0};/MemFree|Cached/{m+=$2};END{print m}' /proc/meminfo)"
925
926 # Be verbose
927 log_begin_msg "Total memory found: $FOUNDMEM kB" ; echo "       $SUCCESS"
928
929 # Now we need to use a little intuition for finding a ramdisk size
930 # that keeps us from running out of space, but still doesn't crash the
931 # machine due to lack of Ram
932
933 # Minimum size of additional ram partitions
934 MINSIZE=20000
935 # At least this much memory minus 30% should remain when home and var are full.
936 MINLEFT=16000
937 # Maximum ramdisk size
938 MAXSIZE="$(expr $TOTALMEM - $MINLEFT)"
939 # Default ramdisk size for ramdisk
940 RAMSIZE="$(expr $TOTALMEM / 5)"
941
942 # Create additional dynamic ramdisk.
943 test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
944 mkdir -p /ramdisk
945 # tmpfs/varsize version, can use swap
946 RAMSIZE=$(expr $RAMSIZE \* 4)
947 log_begin_msg "Creating /ramdisk (dynamic size=${RAMSIZE}k) on shared memory"
948 # We need /bin/mount here for the -o size= option
949 /bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk  && echo "$SUCCESS"
950 mkdir -p /ramdisk/tmp /ramdisk/home/grml && chmod 1777 /ramdisk/tmp && chown grml.grml /ramdisk/home/grml && ln -snf /ramdisk/home /home && mv /tmp /tmp.old && ln -s /ramdisk/tmp /tmp && rm -rf /tmp.old
951
952 stage=3
953 rundebugshell
954 # unionfs
955 log_begin_msg "Creating unionfs and symlinks on ramdisk"
956 mkdir -p /UNIONFS
957 if test -n "$UNIONFS" && /bin/mount -t unionfs -o noatime${SECURE},dirs=/ramdisk=rw:/GRML=ro /UNIONFS /UNIONFS; then
958  # We now have unionfs, copy some data from the initial ramdisk first
959  cp -a /etc/fstab /etc/auto.mnt /etc/filesystems /etc/mtab /UNIONFS/etc/
960  for i in bin boot etc sbin var lib opt root usr; do # Move directories to unionfs
961   if test -d /$i; then
962    mv /$i /$i.old && \
963    /GRML/lib/ld-linux.so.2 --library-path /GRML/lib /GRML/bin/ln -snf /UNIONFS/$i /$i && \
964    rm -rf /$i.old
965   else
966    ln -snf /UNIONFS/$i /$i
967   fi
968  done
969  echo "                 $SUCCESS"
970  log_begin_msg "Merging read-only system with read-writeable /ramdisk."
971  for i in $(cd /UNIONFS; echo *); do # Create links for new stuff on /UNIONFS
972    test "$i" = "home" -o "$i" = "tmp" && continue
973    test -L "/$i" || test -d "/$i" || test -f "/$i" || ln -snf "/UNIONFS/$i" /$i
974  done && echo "   $SUCCESS" || echo "   $FAILED"
975 else
976  echo ""
977  log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!"
978  echo "$FAILED"
979  NOUNIONFS="yes"
980  /GRML/sbin/halt -f -n
981 fi
982
983 chown grml.grml /home/grml
984 # old:
985 # chmod 1777 /var/tmp
986 # new:
987 rm -rf /var/tmp/ ; mkdir /var/tmp ; chown root.root /var/tmp ; chmod 1777 /var/tmp
988
989 # Create empty utmp and wtmp
990 :> /var/run/utmp
991 :> /var/run/wtmp
992
993 # Make SURE that these are files, not links!
994 rm -rf /etc/ftpusers /etc/passwd /etc/shadow /etc/group \
995        /etc/ppp /etc/isdn /etc/ssh /etc/ioctl.save \
996        /etc/inittab /etc/network /etc/sudoers \
997        /etc/init /etc/localtime /etc/dhcpc /etc/pnm2ppa.conf 2>/dev/null
998 cp -a /GRML/etc/ftpusers /GRML/etc/passwd /GRML/etc/shadow /GRML/etc/group \
999       /GRML/etc/ppp /GRML/etc/isdn /GRML/etc/ssh \
1000       /GRML/etc/inittab /GRML/etc/network /GRML/etc/sudoers \
1001       /GRML/sbin/init /GRML/etc/dhcpc /etc/ 2>/dev/null
1002
1003 # Extremely important, init crashes on shutdown if this is only a link
1004 :> /etc/ioctl.save
1005 :> /etc/pnm2ppa.conf
1006 # Must exist for samba to work
1007 [ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
1008 # Diet libc bug workaround
1009 # cp -f /GRML/etc/localtime /etc/localtime
1010 # echo "${BLUE}Done.${NORMAL}"
1011
1012 # Now tell kernel where the real modprobe lives
1013 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
1014
1015 # Change root device from /dev/fd0 to /dev/ram0
1016 echo "0x100" > /proc/sys/kernel/real-root-dev
1017
1018 umount /sys # (remount in grml-autoconfig)
1019
1020 stage=4
1021 rundebugshell
1022 # Give control to the init process.
1023 log_begin_msg "Starting init process."
1024 [ -r /mountit ] && rm -f /mountit
1025 rm -f /linuxrc
1026 exit 0
1027
1028 else
1029 <<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc
1030  log_failure_msg "Error: Can't find grml filesystem, sorry."
1031  echo "
1032 Are you booting via USB or firewire?
1033 ====================================
1034 Try to boot with bootparam scandelay which delays the
1035 bootup sequence so modules should have enough time
1036 to initialize devices.
1037
1038 Usage examples on bootprompt of grml-iso:
1039
1040 grml scandelay       -> adds the default delay of 10 seconds
1041 grml scandelay=13    -> adds a delay of 13 seconds
1042
1043 Are you booting via SCSI?
1044 ====================================
1045 Use the bootparam scsi.
1046 Usage examples on bootprompt of grml-iso:
1047
1048 grml scsi=probe      -> autoprobing of scsi modules
1049 grml scsi=ask        -> list modules and prompt for module which should be loaded
1050 grml scsi=modulename -> loads specified module (without .ko extension)
1051 expert               -> activate expert mode, similar to scsi=ask
1052
1053 Are you getting SquashFS/zlib errors?
1054 =====================================
1055 Try to boot with \"grml nodma\"
1056
1057 Still problems?
1058 ===============
1059 Make sure the ISO itself is ok.
1060 Check the md5sum of downloaded ISO.
1061 Used a CD-RW? Make sure the medium is ok!
1062
1063 Please report any problems you notice to the grml-team!
1064 http://grml.org/contact/
1065 "
1066  echo "${RED}Now dropping you to the busybox shell.${NORMAL}"
1067  echo "${RED}Press reset button to quit.${NORMAL}"
1068  echo ""
1069  PS1="grml# "
1070  export PS1
1071  echo "6" > /proc/sys/kernel/printk
1072  # Allow signals
1073  trap 1 2 3 15
1074  exec /static/sh
1075 =======
1076  echo "${CRE}${RED}Can't find grml filesystem, sorry.${NORMAL}"
1077  echo "
1078 Are you booting via USB or firewire?
1079 ====================================
1080 Try to boot with bootparam scandelay which delays the
1081 bootup sequence so modules should have enough time
1082 to initialize devices.
1083
1084 Usage examples on bootprompt of grml-iso:
1085
1086 grml scandelay       -> adds the default delay of 10 seconds
1087 grml scandelay=13    -> adds a delay of 13 seconds
1088
1089 Are you booting via SCSI?
1090 ====================================
1091 Use the bootparam scsi.
1092 Usage examples on bootprompt of grml-iso:
1093
1094 grml scsi=probe      -> autoprobing of scsi modules
1095 grml scsi=ask        -> list modules and prompt for module which should be loaded
1096 grml scsi=modulename -> loads specified module (without .ko extension)
1097 expert               -> activate expert mode, similar to scsi=ask
1098
1099 Are you getting SquashFS/zlib errors?
1100 =====================================
1101 Try to boot with \"grml nodma\"
1102
1103 Still problems?
1104 ===============
1105 Make sure the ISO itself is ok.
1106 Check the md5sum of downloaded ISO.
1107 Used a CD-RW? Make sure the medium is ok!
1108
1109 Please report any problems you notice to the grml-team!
1110 http://grml.org/contact/
1111 "
1112  echo "${RED}Now dropping you to the busybox shell.${NORMAL}"
1113  echo "${RED}Press reset button to quit.${NORMAL}"
1114  echo ""
1115  PS1="grml# "
1116  export PS1
1117  echo "6" > /proc/sys/kernel/printk
1118  # Allow signals
1119  trap 1 2 3 15
1120  exec /static/sh
1121 >>>>>>> /tmp/linuxrc~other.LuZLNY
1122 fi
1123 # EOF