Added tag 0.81 for changeset 167ea01bdb4a5a63f8e6d51e763539e03bd0054e
[grml-terminalserver.git] / linuxrc
diff --git a/linuxrc b/linuxrc
index 611b8c2..ff7a577 100755 (executable)
--- a/linuxrc
+++ b/linuxrc
@@ -2,7 +2,7 @@
 # Filename: /linuxrc
 # Purpose:  minirt for kernel 2.6 running on grml live-cd
 # Authors:  (c) Klaus Knopper <knoppix@knopper.net>, (c) Michael Prokop <mika@grml.org>
-# Latest change: Don Nov 16 14:46:00 CET 2006 [mika]
+# Latest change: Son Dez 03 00:21:25 CET 2006 [mika]
 #######################################################################################
 
 # hardcoded configurable options
@@ -392,7 +392,7 @@ if test -z "$NOUSB"; then
   if test -f /modules/div/usbcore.ko; then
     $INSMOD /modules/div/usbcore.ko >/dev/null 2>&1
     FOUNDUSB=""
-    for i in $USB2 uhci-hcd.ko ohci-hcd.ko ; do
+    for i in $USB2 uhci-hcd.ko ohci-hcd.ko usbhid.ko ; do
       test -f /modules/div/$i && $INSMOD /modules/div/$i >/dev/null 2>&1 && FOUNDUSB="yes"
     done
     if test -n "$FOUNDUSB"; then
@@ -419,7 +419,7 @@ fi
 if test -z "$NOFIREWIRE" ; then
   log_begin_msg "Checking for Firewire."
   if test -f /modules/div/ieee1394.ko ; then
-    $insmoD /modules/div/ieee1394.ko > /dev/null 2>&1
+    $INSMOD /modules/div/ieee1394.ko > /dev/null 2>&1
     FOUNDFIREWIRE=""
     test -f /modules/div/ohci1394.ko && $INSMOD /modules/div/ohci1394.ko > /dev/null 2>&1 && FOUNDFIREWIRE="yes"
     if test -n "$FOUNDFIREWIRE" ; then
@@ -508,65 +508,74 @@ esac
 
 stage=2
 rundebugshell
-echo "before NFS"
+# NFS
 for i in $cmdline; do case "$i" in nfsdir=*|NFSDIR=*) eval $i;; esac; done
 [ -n "$nfsdir" ] && NFS="$nfsdir"
-echo "nfsdir=$NFS"
-# NFS
 if [ -n "$NFS" ]; then
   tmp_="$(getbootparam nfsdir)"
-  echo -n "checkbootparam nfsdir   "
-  checkbootparam "nfsdir" && echo "OK" || echo "FAILED"
-  echo "getbootparam nfsdir=\"$tmp_\""
+  log_begin_msg "Bootoption NFS found." ; echo "$SUCCESS"
 
   # put the mylibs into /lib for discover and udhcpc
   cdir
 
-  # starting hw-detection for network card
-  echo "Starting hw-detection"
-  kernel_version_=`uname -r`
-  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)
-  echo "trying to load the following network modules:  \"$modules_to_load\""
+  # starting hw-detection for network card - currently broken, so don't use it
+  #  echo "Starting hw-detection"
+  #  kernel_version_=`uname -r`
+  #  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)
+  #  echo "trying to load the following network modules:  \"$modules_to_load\""
+
+  KERNELVER=`uname -r`
+  for mod in `find /lib/modules/$KERNELVER/kernel/drivers/net/ -name \*.ko` ; do
+      echo `basename $mod | sed -e 's/\.ko$//'` >> /modules.load
+  done
+  modules_to_load=`cat /modules.load | xargs`
 
   # FIXME modprobe is buggy from busybox
-  modules_to_load=`echo $modules_to_load | xargs`
+  log_begin_msg "Trying to load network driver(s)." ; echo
   modLoad()
   {
     for mod in $@ ; do
-      tmp_="`modprobe -vn $mod`"
+      tmp_="`modprobe -vn $mod 2>/dev/null`"
       if [ $? -ne 0 ]; then
-        continue
+         continue
       fi
-      eval "$tmp_"
+      # be quiet by default, be verbose only with bootoption debuglinuxrc
+      [ -n "$DEBUG" ] && eval "$tmp_" || eval "$tmp_" 1>/dev/null 2>/dev/null
     done
   }
   modLoad "$modules_to_load"
+  rm -f /modules.load
 
   # loading additional modules
   modLoad sunrpc lockd af_packet nfs
 
-  /static/udhcpc --foreground --quit --script=/static/udhcp-config.sh
-  #echo "press <enter> to start a system shell and configure your system"
-  #sh
+  dhcp_iface_=$(getbootparam dhcp_iface)
+  if [ -z "$dhcp_iface_" ]; then
+       dhcp_iface_=`ifconfig -a | grep '^eth' | sed 's/ .*//'`
+  fi
+
+  for INTERFACE in $dhcp_iface_ ; do
+      log_begin_msg "Requesting network configuration using udhcp for ${INTERFACE}:" ; echo
+      /static/timeout 10 /static/udhcpc --interface="${INTERFACE}" --foreground --quit --script=/static/udhcp-config.sh
+      # echo "press <enter> to start a system shell and configure your system"
+      # sh
+  done
 
   # recreate the old dir structures
   rdir
   #rm -rf /myusr /mylib
 
-  log_begin_msg "${RED}Debug: NFS = ${NFS}${NORMAL}"
-  log_begin_msg -n "${CRE}${BLUE}Looking for GRML in: ${MAGENTA}$NFS${NORMAL}   "
+  log_begin_msg "Looking for GRML in: ${MAGENTA}$NFS${NORMAL}" ; echo "$SUCCESS"
   if mount -t nfs "$NFS" -o "async,ro,nolock" /cdrom #>/dev/null 2>&1
     then
     if test -f /cdrom/$GRML_DIR/$GRML_NAME
       then
-      log_begin_msg -n "${CRE} ${GREEN}Accessing grml CDROM at ${MAGENTA}$NFS${GREEN}...${NORMAL}"
+      log_begin_msg "Accessing grml CDROM at ${MAGENTA}$NFS${NORMAL}" ; echo "$SUCCESS"
       FOUND_GRML="$NFS"
       break
     fi
   fi
 fi
-echo "after NFS"
-
 
 # Now that the right SCSI driver is (hopefully) loaded, try to find CD-ROM
 if test -z $NFS ; then
@@ -879,6 +888,10 @@ mkdir -p /UNIONFS
 if test -n "$UNIONFS" && /bin/mount -t unionfs -o noatime${SECURE},dirs=/ramdisk=rw:/GRML=ro /UNIONFS /UNIONFS; then
  # We now have unionfs, copy some data from the initial ramdisk first
  cp -a /etc/fstab /etc/auto.mnt /etc/filesystems /etc/mtab /UNIONFS/etc/
+ # disable resolvconf on the terminalserver client
+ rm /UNIONFS/etc/resolv.conf
+ cp -a /etc/resolv.conf /UNIONFS/etc
+ echo REPORT_ABSENT_SYMLINK=no >> /UNIONFS/etc/default/resolvconf
  for i in bin boot etc sbin var lib opt root usr; do # Move directories to unionfs
   if test -d /$i; then
    mv /$i /$i.old && \