#!/bin/sh # (C) Copyright 2003 by Gerd v. Egidy # # Modified for NexediDLS by Alexandre Bulte # Updated By Christophe Dumez # # PCI autodetect Copyright 2001-2003 by Diego Torres Milano # PCI autodetect adapted from PXES by Gerd v. Egidy # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MODULES="%(modules)s" BOOT_PARTITION="%(boot_partition)s" BOOT_DEVICE="%(boot_device)s" COMPRESSION="%(compression)s" for module in $MODULES; do echo Inserting /lib/$module.ko... insmod /lib/$module.ko done echo "Mounting /proc filesystem" mount -n -t proc /proc /proc echo "Mounting /sys filesystem..." mount -n -t sysfs none /sys echo "Starting udev..." udevstart || echo "UDEV FAILED" echo -n /sbin/hotplug > /proc/sys/kernel/hotplug echo "Bringing up loopback interface" ifconfig lo 127.0.0.1 up route add -net 127.0.0.0 netmask 255.0.0.0 lo echo "Configuring eth0" udhcpc -n -q -i eth0 -s /bin/udhcpc.script if [ $? -ne 0 ]; then echo "ERROR: can't get DHCP lease" exit 0 fi # load DHCP parameters . /etc/udhcpc-eth0.info # Location of thin client image on DLS (NFS) ROOTPATH=/mnt/storage/var/tc_nfsroot echo "Mounting nfs root filesystem" if ! echo $ROOTPATH | grep -q ":/" ; then # we haven't got a full path, use next-server ROOTPATH="${NEXTSERVER}:${ROOTPATH}" fi echo "Display ROOTPATH : $ROOTPATH" if echo $ROOTPATH | grep -q "," ; then # we have options NFSOPTIONS=`echo $ROOTPATH | sed -e "s/\(.*\)\(,.*\)/\2/"` ROOTPATH=`echo $ROOTPATH | sed -e "s/\(.*\)\(,.*\)/\1/"` fi echo "Mounting root filesystem" mount -rw -t tmpfs none /sysroot/ echo "Mounting NFS root-base" mkdir /sysroot/nfsroot mount -n -o "ro,nolock${NFSOPTIONS}" -t nfs "$ROOTPATH" /sysroot/nfsroot if [ $? -ne 0 ]; then echo "ERROR: can't mount root filesystem via NFS" exit 0 fi echo "Mounting thin client sqfs image" mkdir /sysroot/tcroot mount -t squashfs -o loop /sysroot/nfsroot/tc.sqfs /sysroot/tcroot echo "Setting root symlinks" cd /sysroot ln -s ./tcroot/bin ln -s ./tcroot/boot #ln -s ./tcroot/etc #ln -s ./tcroot/home # We need rw home for wengo mkdir ./home 2>/dev/null cp -rf ./tcroot/home/wengo ./home/ # End of Wengo Part ln -s ./tcroot/lib #ln -s ./tcroot/mnt ln -s ./tcroot/opt ln -s ./tcroot/root ln -s ./tcroot/sbin #ln -s ./tcroot/sys ln -s ./tcroot/usr # Prevent fsck from running. rm -f /sysroot/.autofsck cp -f /dev/null /sysroot/fastboot echo "Handling special directories" rm -f /sysroot/initrd mkdir /sysroot/initrd rm -f /sysroot/tmp mkdir /sysroot/tmp rm -f /sysroot/proc mkdir /sysroot/proc echo "Copying /var" rm -f /sysroot/var mkdir /sysroot/var cp -a /sysroot/tcroot/var /sysroot cp /etc/resolv.conf /sysroot/var/resolv.conf echo "Copying /dev" #ls /sysroot/tcroot/dev cp -a /dev /sysroot #cp -a /sysroot/tcroot/dev /sysroot echo "Copying /etc" rm -f /sysroot/etc mkdir /sysroot/etc cp -a /sysroot/tcroot/etc /sysroot echo 0x0100 > /proc/sys/kernel/real-root-dev echo "Unmounting temporary mounts" umount /proc umount /sys echo "Changing to new NFS root" pivot_root /sysroot /sysroot/initrd chown -R wengo:wengo /home/wengo echo "Mounting /proc filesystem" mount -n -t proc /proc /proc # bug fix by Christophe Dumez mkdir /sys rm -rf /mnt 2>/dev/null mkdir /mnt echo "Using local config.tgz / config.sh" MOUNT_DIR=/nfsroot if test -f $MOUNT_DIR/config.tgz; then (cd /; tar zxvf $MOUNT_DIR/config.tgz) fi if test -f $MOUNT_DIR/config.sh; then (cd /; /bin/sh $MOUNT_DIR/config.sh) fi