# 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: Fri Mar 16 11:35:19 CET 2007 [mika]
+# Latest change: Tue Mar 27 23:05:51 CEST 2007
#######################################################################################
# hardcoded configurable options
tmp_="$(getbootparam nfsdir)"
log_begin_msg "Bootoption NFS found." ; echo "$SUCCESS"
- cdir
+ /static/cdir
- # 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
- echo "$tmp_" | while read i; do
- # be quiet by default, be verbose only with bootoption debuglinuxrc
- [ -n "$DEBUG" ] && eval "$i" || eval "$i" 1>/dev/null 2>/dev/null
- done
done
}
# modules.alias and modules.dep are in place so USE IT :)!
- modLoad "$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x; done |xargs)"
-
+ 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
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
done
# recreate dir layout + remove extra modules
- rdir
- #rm -rf /mylib
+ /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
log_begin_msg "Creating $unionfs and symlinks on ramdisk"
mkdir -p /UNIONFS
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/
-
# 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 lib opt root usr; do # Move directories to unionfs
+ for i in bin boot etc sbin var opt root usr $EMUL $LIB64 lib ; do # Move directories to unionfs
if test -d /$i; then
/bin/mv /$i /$i.old && \
- /GRML/lib/ld-linux.so.2 --library-path /GRML/lib /GRML/bin/ln -snf /UNIONFS/$i /$i && \
+ # /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
stage=4
rundebugshell
# Give control to the init process.
-log_begin_msg "Starting init process."
+log_begin_msg "Starting init process. "
[ -r /mountit ] && rm -f /mountit
rm -f /linuxrc
exit 0