X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=linuxrc;fp=linuxrc;h=8ceb9c63bbd7bf656c997a8893e71299a5bf8008;hb=58b2b0446f39c1b038b6ffa9e9fb15f1901e303f;hp=85ae3efaa63c76d35f575dac839f41f35555e524;hpb=b3447b520d1749e1d573664309165671bd78c4a9;p=grml-terminalserver.git diff --git a/linuxrc b/linuxrc index 85ae3ef..8ceb9c6 100755 --- a/linuxrc +++ b/linuxrc @@ -2,7 +2,11 @@ # Filename: /linuxrc # Purpose: minirt for kernel 2.6 running on grml live-cd # Authors: (c) Klaus Knopper , (c) Michael Prokop +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc +# Latest change: Don Nov 16 14:46:00 CET 2006 [mika] +======= # Latest change: Mon Sep 18 23:19:53 CEST 2006 [mika] +>>>>>>> /tmp/linuxrc~other.LuZLNY ####################################################################################### # hardcoded configurable options @@ -264,6 +268,22 @@ echo "${GREEN}DONE.${NORMAL}" # Ask user for modules askmodules(){ +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + TYPE="$1"; shift + echo "${TYPE} modules available:${WHITE}" + c="" + for m in "$@"; do + if test -f "/modules/scsi/$m"; then + test -z "$c" && { echo -n " $m"; c="1"; } || { echo " $m"; c=""; } + fi + done + [ -n "$c" ] && echo "" + echo "Load ${TYPE} Modules?" + echo "[Enter full filename(s) (space-separated), Return for autoprobe, n for none] " + echo -n "insmod module(s)> " + read MODULES + case "$MODULES" in n|N) MODULES=""; ;; y|"") MODULES="$*"; ;; esac +======= TYPE="$1"; shift echo "${TYPE} modules available:${WHITE}" c="" @@ -278,6 +298,7 @@ askmodules(){ echo -n "insmod module(s)> " read MODULES case "$MODULES" in n|N) MODULES=""; ;; y|"") MODULES="$*"; ;; esac +>>>>>>> /tmp/linuxrc~other.LuZLNY } # Try to load the given modules (full path or current directory) @@ -509,6 +530,51 @@ esac stage=2 rundebugshell # NFS +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc +if [ -n "$NFS" ]; then + tmp_="$(getbootparam nfsdir)" + echo -n "checkbootparam nfsdir " + checkbootparam "nfsdir" && echo "OK" || echo "FAILED" + echo "getbootparam nfsdir=\"$tmp_\"" + + # 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\"" + + # FIXME modprobe is buggy from busybox + modules_to_load=`echo $modules_to_load | xargs` + modLoad() + { + for mod in $@ ; do + tmp_="`modprobe -vn $mod`" + if [ $? -ne 0 ]; then + continue + fi + eval "$tmp_" + done + } + modLoad "$modules_to_load" + + # loading additional modules + modLoad sunrpc lockd af_packet nfs + + /static/udhcpc --foreground --quit --script=/static/udhcp-config.sh + #echo "press to start a system shell and configure your system" + #sh + + # 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} " + if mount -t nfs "$NFS" -o "async,ro,nolock" /cdrom #>/dev/null 2>&1 +======= if checkbootparam "nfsdir" ; then NFS="$(getbootparam nfsdir)" # if test -z $NFS @@ -519,6 +585,7 @@ if checkbootparam "nfsdir" ; then echo "${RED}Debug: NFS = ${NFS}${NORMAL}" log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in: ${MAGENTA}$NFS${NORMAL}" if mountit -t nfs $NFS "-o ro" >/dev/null 2>&1 +>>>>>>> /tmp/linuxrc~other.LuZLNY then if test -f /cdrom/$GRML_DIR/$GRML_NAME then @@ -576,7 +643,7 @@ remount_grml() [ -n "$SOURCE2" ] && umount $SOURCE2 # umount possible loop-device mount_grml $TARGET else - echo "${CRE} ${RED}Warning: Changing to $TARGET failed.${NORMAL}" + log_failure_msg "Warning: Changing to $TARGET failed." return 1 fi @@ -613,7 +680,7 @@ boot_from() fi if [ $? -ne 0 ]; then [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE - echo -n "${CRE} ${RED}Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${RED} is not mountable.${NORMAL}" + log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable." sleep 2 return 1 fi @@ -621,7 +688,7 @@ boot_from() if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo " $SUCCESS" else - echo -n "${CRE} ${RED}Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}" + log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}" [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE umount $TARGET sleep 2 @@ -652,6 +719,22 @@ copy_to() TARGET_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1) TARGET_DEV_DESC="$TARGET_DEV" # load filesystems +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + /GRML/sbin/modprobe fuse + /GRML/sbin/modprobe ntfs + FS="ext3 ext2 reiserfs reiser4 vfat ntfs" + + MOUNTED="" + for i in $FS; do + if /GRML/bin/mount -o rw -t "$i" "$TARGET_DEV" "$TARGET"; then + MOUNTED="true" + break + fi + done + if test -z "$MOUNTED"; then + log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable." + sleep 2 +======= /GRML/sbin/modprobe fuse /GRML/sbin/modprobe ntfs FS="ext3 ext2 reiserfs reiser4 vfat ntfs" @@ -666,6 +749,7 @@ copy_to() if test -z "$MOUNTED"; then echo -n "${CRE} ${RED}Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${RED} is not mountable.${NORMAL}" sleep 2 +>>>>>>> /tmp/linuxrc~other.LuZLNY return 1 fi # check for enough free space @@ -682,15 +766,21 @@ copy_to() if [ $FOUNDSPACE -lt $SIZE ] then - echo -n "${CRE} ${RED}Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${RED}. Found: ${MAGENTA}${FOUNDSPACE}k${RED} Need: ${MAGENTA}${SIZE}k${RED} ${NORMAL}" + 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}" sleep 2 umount $TARGET return 1 fi # do the real copy +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + + log_begin_msg "Copying grml CD-ROM to ${TARGET_DEV_DESC}... Please be patient." + echo +======= echo "${CRE} ${GREEN}Copying grml CD-ROM to ${MAGENTA}$TARGET_DEV_DESC${GREEN}... Please be patient. ${NORMAL}" +>>>>>>> /tmp/linuxrc~other.LuZLNY if [ -z "$use_cp" -a -x /usr/bin/rsync ] then # first cp the small files @@ -699,17 +789,28 @@ copy_to() [ -f $TARGET/$GRML_DIR/$GRML_NAME ] && /bin/rm -f $TARGET/$GRML_DIR/$GRML_NAME /usr/bin/rsync -a --progress --include="$GRML_DIR/$GRML_NAME" --include="$GRML_DIR/" --exclude="*" $COPY $TARGET # Copy grml to $TARGET #/usr/bin/rsync -avP $COPY $TARGET # Copy grml to $TARGET + # make sure to support directories from http://grml.org/config/ + for dir in scripts bootparams config debs ; do + if [ -d "/cdrom/$dir" ] ; then + log_begin_msg "Customization directory $dir found, copying to $TARGET" + cp -a /cdrom/$dir $TARGET/ && echo "$SUCCESS" || echo "$FAILED" + fi + done else /bin/cp -a -f $COPY $TARGET # Copy grml to $TARGET fi if [ $? -ne 0 ] then - echo -n "${CRE} ${RED}Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${RED} possibly has not enough space left.${NORMAL}" + log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left." sleep 2 return 1 fi # remount r/o +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + /bin/mount -n -o remount,ro $TARGET 1>/dev/null 2>&1 +======= /bin/mount -n -o remount,ro $TARGET +>>>>>>> /tmp/linuxrc~other.LuZLNY remount_grml } @@ -734,6 +835,21 @@ if test -n "$DO_REMOUNT" -a -n "$FOUND_GRML" ; then SOURCE="/cdrom" TARGET="/cdrom2" +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + + # first copy_to, then boot_from + if [ -n "$COPYTO" ]; then + copy_to $COPYTO && REAL_TARGET="$TARGET" + fi + if [ -n "$BOOTFROM" ]; then + boot_from + if [ "$?" -eq "0" ]; then + # set new source / target paths + REAL_TARGET="$TARGET" + SOURCE2="$LOOP_SOURCE" + SOURCE="/cdrom2" + TARGET="/cdrom3" +======= # first copy_to, then boot_from if [ -n "$COPYTO" ]; then @@ -747,6 +863,7 @@ if test -n "$DO_REMOUNT" -a -n "$FOUND_GRML" ; then SOURCE2="$LOOP_SOURCE" SOURCE="/cdrom2" TARGET="/cdrom3" +>>>>>>> /tmp/linuxrc~other.LuZLNY fi fi fi @@ -781,10 +898,16 @@ export PATH # From here, we should have all essential commands available. hash -r +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc +# Did we remount the source media? +if test -n "$REAL_TARGET"; then + /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot +======= # Did we remount the source media ? if test -n "$REAL_TARGET"; then /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot +>>>>>>> /tmp/linuxrc~other.LuZLNY fi # Clean up /etc/mtab (and - just in case - make a nice entry for looped ISO) @@ -843,7 +966,6 @@ if test -n "$UNIONFS" && /bin/mount -t unionfs -o noatime${SECURE},dirs=/ramdisk ln -snf /UNIONFS/$i /$i fi done - #echo "${GREEN}done${NORMAL}" echo " $SUCCESS" log_begin_msg "Merging read-only system with read-writeable /ramdisk." for i in $(cd /UNIONFS; echo *); do # Create links for new stuff on /UNIONFS @@ -904,6 +1026,53 @@ rm -f /linuxrc exit 0 else +<<<<<<< /home/mika/grml/hg/grml-terminalserver/linuxrc + log_failure_msg "Error: Can't find grml filesystem, sorry." + echo " +Are you booting via USB or firewire? +==================================== +Try to boot with bootparam scandelay which delays the +bootup sequence so modules should have enough time +to initialize devices. + +Usage examples on bootprompt of grml-iso: + +grml scandelay -> adds the default delay of 10 seconds +grml scandelay=13 -> adds a delay of 13 seconds + +Are you booting via SCSI? +==================================== +Use the bootparam scsi. +Usage examples on bootprompt of grml-iso: + +grml scsi=probe -> autoprobing of scsi modules +grml scsi=ask -> list modules and prompt for module which should be loaded +grml scsi=modulename -> loads specified module (without .ko extension) +expert -> activate expert mode, similar to scsi=ask + +Are you getting SquashFS/zlib errors? +===================================== +Try to boot with \"grml nodma\" + +Still problems? +=============== +Make sure the ISO itself is ok. +Check the md5sum of downloaded ISO. +Used a CD-RW? Make sure the medium is ok! + +Please report any problems you notice to the grml-team! +http://grml.org/contact/ +" + echo "${RED}Now dropping you to the busybox shell.${NORMAL}" + echo "${RED}Press reset button to quit.${NORMAL}" + echo "" + PS1="grml# " + export PS1 + echo "6" > /proc/sys/kernel/printk + # Allow signals + trap 1 2 3 15 + exec /static/sh +======= echo "${CRE}${RED}Can't find grml filesystem, sorry.${NORMAL}" echo " Are you booting via USB or firewire? @@ -949,5 +1118,6 @@ http://grml.org/contact/ # Allow signals trap 1 2 3 15 exec /static/sh +>>>>>>> /tmp/linuxrc~other.LuZLNY fi # EOF