# 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: Sat Dec 2 18:12:39 CET 2006 [mika]
+# Latest change: Thu May 10 11:29:02 CEST 2007 [mika]
#######################################################################################
# hardcoded configurable options
echo "${RED} | |_| | _ <| | | | |___ "
echo "${RED} \____|_| \_\_| |_|_____|"
echo ""
- echo "${WHITE}grml.org - Linux for users of texttools and sysadmins."
+ echo "${WHITE}grml.org - Linux for sysadmins and texttool users."
echo "${NORMAL}"
exec >/dev/null </dev/null 2>&1
fi
#}
log_failure_msg () {
- echo " ${RED}*${NORMAL} $@"
+ echo -n " ${RED}*${NORMAL} $@"
}
#log_warning_msg () {
# echo "$CLEAR"
# Just go to the top of the screen
# echo -n "\e[H\e[J"
+DISTRI="$(getbootparam 'distri' 2>/dev/null)"
+if [ -n "$DISTRI" ] ; then
+SPLASH="
+${RED} $DISTRI
+
+${WHITE}based on grml.org.
+
+${NORMAL}"
+else
+SPLASH="
+${RED} ____ ____ __ __ _
+${RED} / ___| _ \| \/ | |
+${RED} | | _| |_) | |\/| | |
+${RED} | |_| | _ <| | | | |___
+${RED} \____|_| \_\_| |_|_____|
+
+${WHITE}grml.org - Linux for sysadmins and texttool users.
+
+${NORMAL}"
+fi
+
echo ""
echo "${WHITE}Welcome to"
-echo ""
-echo "${RED} ____ ____ __ __ _ "
-echo "${RED} / ___| _ \| \/ | | "
-echo "${RED} | | _| |_) | |\/| | | "
-echo "${RED} | |_| | _ <| | | | |___ "
-echo "${RED} \____|_| \_\_| |_|_____|"
-echo ""
-echo "${WHITE}grml.org - Linux for users of texttools and sysadmins."
-echo "${NORMAL}"
+echo "$SPLASH"
-# We only need the builtin commands and /static at this point
+# We need the builtin commands and /static only starting at this point
PATH=/static
export PATH
GRML_NAME="GRML"
case "$CMDLINE" in *grml_dir=*) GRML_DIR="$grml_dir"; ;; esac
case "$CMDLINE" in *grml_name=*) GRML_NAME="$grml_name"; ;; esac
+case "$CMDLINE" in *small*) GRML_TYPE="small"; ;; esac
+
+# NFS
+for i in $cmdline; do case "$i" in nfsdir=*|NFSDIR=*) eval $i;; esac; done
+[ -n "$nfsdir" ] && NFS="$nfsdir"
if [ -n "$DEBUG" ]; then
log_begin_msg "Bootoption debug detected. Printing kernel command line:"
echo ""
for i in "$@"; do
echo -n " Probing ${TYPE}... ${WHITE}$i${NORMAL}: "
- if test -f /modules/scsi/$i.ko && $INSMOD -f /modules/scsi/$i.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " failed " ; then
+ if test -f /modules/scsi/$i.ko && $INSMOD /modules/scsi/$i.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " failed " ; then
case "$TYPE" in scsi|SCSI) FOUND_SCSI="yes"; ;; esac
fi
done
# New sysfs based SCSI detection (thanks, Jörg Schirottke)
sysfsscsi(){
-SYS=$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x; done|cut -f2 -d:)
+SYS=$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x 2>/dev/null; done|cut -f2 -d:)
while read id driver; do
for sysid in $SYS; do
case $sysid in $id)
if test -z "$NOSCSI" ; then
log_begin_msg "Scanning for SCSI devices."
- $INSMOD -f /modules/scsi/firmware_class.ko 1>/dev/null
+ $INSMOD /modules/scsi/firmware_class.ko 1>/dev/null
test -n "$MODULES" && loadmodules SCSI $MODULES && echo -n "" || echo " ${BLUE}[${NORMAL} none found ${BLUE}]${NORMAL} (try bootoption scsi=probe)"
else
log_warn_msg "Not scanning for SCSI devices as requested on commandline." && echo " $SUCCESS"
if test "$MODULE" = "probe" ; then
log_begin_msg "Bootoption scsi=probe found. Trying to autoprobe SCSI modules:"
echo ""
- echo -n " Trying to load scsi_debug: " ; $INSMOD -f /modules/scsi/scsi_debug.ko 1>/dev/null && echo " $SUCCESS" || echo " [ failed ]"
+ echo -n " Trying to load scsi_debug: " ; $INSMOD /modules/scsi/scsi_debug.ko 1>/dev/null && echo " $SUCCESS" || echo " [ failed ]"
for module in /modules/scsi/*.ko ; do
echo -n " Probing ${WHITE}${module}${NORMAL}..."
- $INSMOD -f ${module} >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
+ $INSMOD ${module} >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
done
elif test "$MODULE" = "ask" ; then
askmodules SCSI $(cd /modules/scsi; echo *.ko)
else
[ -n "$MODULE" ] || echo " ${RED}Neither a specific module nor option probe nor option ask for SCSI module given. Skipping.${NORMAL}"
[ -n "$MODULE" ] && echo -n " Trying to load module ${WHITE}${MODULE}${NORMAL}:" ; \
- $INSMOD -f "/modules/scsi/${MODULE}.ko" 1>/dev/null && echo " $SUCCESS" || echo " [ failed ]"
+ $INSMOD "/modules/scsi/${MODULE}.ko" 1>/dev/null && echo " $SUCCESS" || echo " [ failed ]"
fi
fi
# End of SCSI check
echo ""
for module in mptbase mptscsih mptspi BusLogic ; do
echo -n " Trying to load ${WHITE}${module}${NORMAL}: "
- $INSMOD -f /modules/scsi/${module}.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
+ $INSMOD /modules/scsi/${module}.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
done
fi
# Unfortunately, hotpluggable devices tend to need some time in order to register
if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then
log_begin_msg "Scanning for USB/Firewire devices."
- sleep 4
+ sleep 6
if test -n "$USB"; then
sleep 10
fi
sleep $DELAY && echo " $SUCCESS"
fi
-# boot via pcmcia
+# boot via pcmcia - not yet supported!
if checkbootparam bootpcmcia ; then
log_begin_msg "Bootoption bootpcmcia found. Trying to load ${WHITE}PCMCIA${NORMAL} modules..."
- if $INSMOD -f /modules/div/pcmcia_core.ko 1>/dev/null ; then
- $INSMOD -f /modules/div/firmware_class.ko 1>/dev/null && \
- $INSMOD -f /modules/div/pcmcia.ko 1>/dev/null && \
- $INSMOD -f /modules/div/rsrc_nonstatic.ko 1>/dev/null && \
- $INSMOD -f /modules/div/yenta_socket.ko 1>/dev/null && echo " $SUCCESS"
+ if $INSMOD /modules/div/pcmcia_core.ko 1>/dev/null ; then
+ $INSMOD /modules/div/firmware_class.ko 1>/dev/null && \
+ $INSMOD /modules/div/pcmcia.ko 1>/dev/null && \
+ $INSMOD /modules/div/rsrc_nonstatic.ko 1>/dev/null && \
+ $INSMOD /modules/div/yenta_socket.ko 1>/dev/null && echo " $SUCCESS"
else
echo " [ failed ]"
fi
stage=2
rundebugshell
-# NFS
-for i in $cmdline; do case "$i" in nfsdir=*|NFSDIR=*) eval $i;; esac; done
-[ -n "$nfsdir" ] && NFS="$nfsdir"
if [ -n "$NFS" ]; then
tmp_="$(getbootparam nfsdir)"
log_begin_msg "Bootoption NFS found." ; echo "$SUCCESS"
- # put the mylibs into /lib for discover and udhcpc
- cdir
+ /static/cdir
- # 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
log_begin_msg "Trying to load network driver(s)." ; echo
modLoad()
{
for mod in $@ ; do
- tmp_="`modprobe -vn $mod 2>/dev/null`"
- if [ $? -ne 0 ]; then
- continue
+ if [ -n "$DEBUG" ] ; then
+ echo "Debug: trying to load $mod:"
+ modprobe -v $mod
+ else
+ modprobe $mod 2>/dev/null
fi
- # 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
-
+ # modules.alias and modules.dep are in place so USE IT :)!
+ find /sys/devices/ -name modalias |/static/xargs -r /static/grep -h pci: |while read i; do
+ modLoad "$i"
+ done
# loading additional modules
modLoad sunrpc lockd af_packet nfs
- for INTERFACE in `ifconfig -a | grep '^eth' | sed 's/\ .*//'` ; do
+ dhcp_iface_=$(getbootparam dhcp_iface)
+ if [ -z "$dhcp_iface_" ]; then
+ dhcp_iface_=`ifconfig -a | grep '^eth' | sed 's/ .*//'`
+ fi
+
+ # make sure we have a udhcpc executable, if it's not present
+ # assume that busybox provides one
+ if ! [ -x /static/udhcpc ] ; then
+ ln -s /static/busybox /static/udhcpc
+ 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
+ # recreate dir layout + remove extra modules
+ /static/rdir
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
fi
# Now that the right SCSI driver is (hopefully) loaded, try to find CD-ROM
-if test -z $NFS ; then
- DEVICES="/dev/hd?"
- test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
- # New: Also try parallel port CD-Roms [for Mike].
- DEVICES="$DEVICES /dev/pcd?"
- # New: also check HD partitions for a GRML/GRML image
- # notice: use /dev/sd? for usb-sticks without partition(s)
- test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd?[1-9] /dev/sd?[1-9][0-9] /dev/sd?"
- DEVICES="$DEVICES /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
- case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac
- for i in $DEVICES
- do
- log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in: ${MAGENTA}$i${NORMAL}"
- if mountit $i /cdrom "-o ro" >/dev/null 2>&1
- then
- echo " $SUCCESS"
- if test -f /cdrom/$GRML_DIR/$GRML_NAME
- then
- log_begin_msg "Accessing grml CD-ROM at: ${MAGENTA}$i${NORMAL}" ; echo " $SUCCESS"
- FOUND_GRML="$i"
- break
- fi
- umount /cdrom
+grmlmount()
+{
+ if test -z $NFS ; then
+ DEVICES="/dev/hd?"
+ test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
+ # New: Also try parallel port CD-ROMs
+ DEVICES="$DEVICES /dev/pcd?"
+ # New: also check HD partitions for a GRML/GRML image
+ # notice: use /dev/sd? for usb-sticks without partition(s)
+ test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd?[1-9] /dev/sd?[1-9][0-9] /dev/sd?"
+ DEVICES="$DEVICES /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
+ case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac
+ # make sure we dont' search for the booting device if cdrom=... is present
+ case "$CMDLINE" in *cdrom=/dev/*)
+ CDROMDEV="$(echo $CMDLINE | tr ' ' '\n' | sed -n '/cdrom=/s/.*=//p' | tail -1)"
+ DEVICES="$(echo $CDROMDEV | awk -F/ '{ print $1 "/" $2 "/" $3 }')"
+ ;;
+ esac
+ for i in $DEVICES ; do
+ log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in: ${MAGENTA}$i${NORMAL}"
+ if mountit $i /cdrom "-o ro" >/dev/null 2>&1 ; then
+ echo " $SUCCESS"
+ if test -f /cdrom/$GRML_DIR/$GRML_NAME ; then
+ log_begin_msg "Accessing grml CD-ROM at: ${MAGENTA}$i${NORMAL}" ; echo " $SUCCESS"
+ FOUND_GRML="$i"
+ break
+ fi
+ umount /cdrom
+ fi
+ done
fi
- done
+}
+
+# Rerun the grml-CDROM part 3 times at total
+grmlmount
+if [ -z "$FOUND_GRML" ] ; then
+ echo
+ log_warn_msg "grml CD-ROM not yet found, sleeping for 5 seconds and trying again then."
+ sleep 5 && echo " $SUCCESS"
+ grmlmount
+ if [ -z "$FOUND_GRML" ] ; then
+ echo
+ log_warn_msg "grml CD-ROM still not yet found, sleeping for 5 more seconds and trying once more again."
+ sleep 5 && echo " $SUCCESS"
+ fi
fi
# Harddisk-installed script part version has been removed
# (GRML can be booted directly from HD now).
mount_grml()
{
- if test -n "$FOUND_GRML" -a -f $1/$GRML_DIR/$GRML_NAME; then
+ if test -n "$FOUND_GRML" -a -f $1/$GRML_DIR/$GRML_NAME ; then
# echo "6" > /proc/sys/kernel/printk
mount -t squashfs $1/$GRML_DIR/$GRML_NAME /GRML -o loop,ro$SECURE || FOUND_GRML=""
fi
[ -n "$SOURCE2" ] && umount $SOURCE2 # umount possible loop-device
mount_grml $TARGET
else
- log_failure_msg "Warning: Changing to $TARGET failed."
+ log_failure_msg "Warning: Changing to $TARGET failed." ; echo "$FAILED"
return 1
fi
# load filesystems
/GRML/sbin/modprobe fuse
/GRML/sbin/modprobe ntfs
- $INSMOD -f /modules/div/ntfs.ko 1>/dev/null
+ if [ -r /modules/div/ntfs.ko ] ; then
+ grep -q ntfs /proc/modules || $INSMOD /modules/div/ntfs.ko 1>/dev/null
+ else
+ log_failure_msg "No NTFS kernel module found." ; echo "$FAILED"
+ fi
if [ -n "$ISO_PATH" ]; then
LOOP_SOURCE="$TARGET.loop"
fi
if [ $? -ne 0 ]; then
[ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
- log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable."
+ log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable." ; echo "$FAILED"
sleep 2
return 1
fi
- if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then
+ if [ -f "$TARGET/$GRML_DIR/$GRML_NAME" ]; then
log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo " $SUCCESS"
else
- log_failure_msg "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}" ; echo "$FAILED"
[ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
umount $TARGET
sleep 2
fi
done
if test -z "$MOUNTED"; then
- log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable."
+ log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable." ; echo "$FAILED"
sleep 2
return 1
fi
esac
# sanity check
-
- if [ $FOUNDSPACE -lt $SIZE ]
- then
- 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}"
+ if [ $FOUNDSPACE -lt $SIZE ] ; then
+ log_failure_msg "Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${NORMAL}:" ; echo "$FAILED"
+ log_failure_msg "Found: ${MAGENTA}${FOUNDSPACE}k${NORMAL} Need: ${MAGENTA}${SIZE}k${NORMAL}" ; echo "$FAILED"
sleep 2
umount $TARGET
return 1
fi
# do the real copy
-
log_begin_msg "Copying grml CD-ROM to ${TARGET_DEV_DESC}... Please be patient."
echo
- if [ -z "$use_cp" -a -x /usr/bin/rsync ]
- then
+ if [ -z "$use_cp" -a -x /usr/bin/rsync ] ; then
# first cp the small files
/usr/bin/rsync -a --exclude="$GRML_DIR/$GRML_NAME" $COPY $TARGET # Copy grml to $TARGET
# then the big file with nice progress meter
else
/bin/cp -a -f $COPY $TARGET # Copy grml to $TARGET
fi
- if [ $? -ne 0 ]
- then
- log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left."
+ if [ $? -ne 0 ] ; then
+ log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left." ; echo "$FAILED"
sleep 2
return 1
fi
fi
# Final test if everything succeeded.
-if test -n "$FOUND_GRML"
-then
+if test -n "$FOUND_GRML" ; then
# copy library cache
cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
UNIONFS=""
-$INSMOD /modules/unionfs.ko 1>/dev/null
-grep -q unionfs /proc/filesystems && UNIONFS=yes
-
-# Enable kernel messages
-echo "6" > /proc/sys/kernel/printk
+if checkbootparam "unionfs" || test ! -r /modules/aufs.ko ; then
+ $INSMOD /modules/unionfs.ko 1>/dev/null
+ grep -q unionfs /proc/filesystems && UNIONFS=yes
+ unionfs='unionfs'
+ UNIONFS_FILETYPE='unionfs'
+ AUFS=''
+else
+ $INSMOD /modules/aufs.ko 1>/dev/null
+ grep -q aufs /proc/filesystems && UNIONFS=yes
+ unionfs='unionfs (using aufs)'
+ UNIONFS_FILETYPE='aufs'
+ AUFS='yes'
+fi
# Set paths
log_begin_msg "Setting paths"
# At least this much memory minus 30% should remain when home and var are full.
MINLEFT=16000
# Maximum ramdisk size
-[ -n "$TOTALMEM" ] && MAXSIZE="$(expr $TOTALMEM - $MINLEFT)"
+[ -n "$TOTALMEM" ] && MAXSIZE="$(/usr/bin/expr $TOTALMEM - $MINLEFT)"
# Default ramdisk size for ramdisk
-[ -n "$TOTALMEM" ] && RAMSIZE="$(expr $TOTALMEM / 5)"
+[ -n "$TOTALMEM" ] && RAMSIZE="$(/usr/bin/expr $TOTALMEM / 5)"
+
+# check for available RAM
+# check for bootoption small and/or grml-small
+if [ -n "$FOUNDMEM" ] ; then
+ if [ "$GRML_TYPE" = "small" ] ; then
+ if [ "$FOUNDMEM" -lt 25000 ] ; then
+ log_begin_msg "Bootoption *small detected, but you need at least 32MB of RAM available." ; echo " $FAILED"
+ log_begin_msg "Dropping you to a shell, continue on your own risk." ; echo " $FAILED"
+ /bin/bash
+ fi
+ else
+ if [ "$FOUNDMEM" -lt 58000 ] ; then
+ log_begin_msg "You need at least 64MB of RAM available for grml." ; echo " $FAILED"
+ log_begin_msg "Dropping you to a shell, continue on your own risk." ; echo " $FAILED"
+ /bin/bash
+ fi
+ fi
+fi
# Create additional dynamic ramdisk.
test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
mkdir -p /ramdisk
# tmpfs/varsize version, can use swap
-RAMSIZE=$(expr $RAMSIZE \* 4)
+RAMSIZE=$(/usr/bin/expr $RAMSIZE \* 4)
log_begin_msg "Creating /ramdisk (dynamic size=${RAMSIZE}k) on shared memory"
# We need /bin/mount here for the -o size= option
/bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk && echo "$SUCCESS"
-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
+mkdir -p /ramdisk/tmp /ramdisk/home/grml && chmod 1777 /ramdisk/tmp && chown grml.grml /ramdisk/home/grml && ln -snf /ramdisk/home /home && /bin/mv /tmp /tmp.old && ln -s /ramdisk/tmp /tmp && rm -rf /tmp.old
stage=3
rundebugshell
# unionfs
-log_begin_msg "Creating unionfs and symlinks on ramdisk"
+log_begin_msg "Creating $unionfs and symlinks on ramdisk"
mkdir -p /UNIONFS
-if test -n "$UNIONFS" && /bin/mount -t unionfs -o noatime${SECURE},dirs=/ramdisk=rw:/GRML=ro /UNIONFS /UNIONFS; then
+if test -n "$UNIONFS" && /bin/mount -t $UNIONFS_FILETYPE -o noatime${SECURE},dirs=/ramdisk=rw:/GRML=ro /UNIONFS /UNIONFS ; then
+ # check architecture
+ if [ -f /GRML/lib/ld-linux.so.2 ] ; then
+ LDLINUX=/GRML/lib/ld-linux.so.2
+ GRMLLIB=/GRML/lib
+ elif [ -f /GRML/lib64/ld-linux-x86-64.so.2 ] ; then
+ LDLINUX=/GRML/lib64/ld-linux-x86-64.so.2
+ EMUL='emul'
+ LIB64='lib64'
+ GRMLLIB=/GRML/lib64
+ fi
# 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/
- for i in bin boot etc sbin var lib opt root usr; do # Move directories to unionfs
+ # disable resolvconf on the terminalserver client
+ if [ -n "$NFS" ] ; then
+ rm /UNIONFS/etc/resolv.conf
+ cp -a /etc/resolv.conf /UNIONFS/etc
+ echo REPORT_ABSENT_SYMLINK=no >> /UNIONFS/etc/default/resolvconf
+ fi
+ for i in bin boot etc sbin var opt root usr $EMUL $LIB64 lib ; do # Move directories to unionfs
if test -d /$i; then
- mv /$i /$i.old && \
- /GRML/lib/ld-linux.so.2 --library-path /GRML/lib /GRML/bin/ln -snf /UNIONFS/$i /$i && \
+ /bin/mv /$i /$i.old && \
+ # /GRML/lib/ld-linux.so.2 --library-path /GRML/lib /GRML/bin/ln -snf /UNIONFS/$i /$i && \
+ $LDLINUX --library-path $GRMLLIB /GRML/bin/ln -snf /UNIONFS/$i /$i 1>/dev/null 2>/dev/null
rm -rf /$i.old
else
ln -snf /UNIONFS/$i /$i
fi
done
- echo " $SUCCESS"
+ [ -n "$AUFS" ] && echo " $SUCCESS" || 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
test "$i" = "home" -o "$i" = "tmp" && continue
done && echo " $SUCCESS" || echo " $FAILED"
else
echo ""
- log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!"
- echo "$FAILED"
- NOUNIONFS="yes"
- /GRML/sbin/halt -f -n
+ log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!" ; echo "$FAILED"
+ log_failure_msg "Can not continue booting, dropping you to a shell." ; echo "$FAILED"
+ /bin/bash
fi
chown grml.grml /home/grml
# Change root device from /dev/fd0 to /dev/ram0
echo "0x100" > /proc/sys/kernel/real-root-dev
-umount /sys # (remount in grml-autoconfig)
+/bin/umount /sys # (remount in grml-autoconfig)
stage=4
rundebugshell