#! /bin/sh ############################################################################## # # Yoshinori OKUJI # # Copyright (C) 2003 Nexedi SARL # # This program is Free Software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # 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. # ############################################################################## INTERFACE="%(interface)s" IP_ADDRESS="%(ip_address)s" GATEWAY="%(gateway)s" NFS_SERVER="%(nfs_server)s" NFS_OPTIONS="hard,rsize=8192,wsize=8192,nolock" MODULES="%(modules)s" for module in $MODULES; do echo Inserting /lib/$module.ko... insmod /lib/$module.ko done #echo "Remount / in read-write..." #mount -n -o remount,rw / echo "Mounting /proc filesystem..." mount -n -t proc none /proc echo "Mounting /sys filesystem..." mount -n -t sysfs none /sys echo "Starting udev..." udevstart echo -n /sbin/hotplug > /proc/sys/kernel/hotplug echo "INTERFACE = $INTERFACE" echo "IP_ADDRESS = $IP_ADDRESS" echo "GATEWAY = $GATEWAY" echo "NFS_SERVER = $NFS_SERVER" echo "Configuring $INTERFACE..." ifconfig $INTERFACE $IP_ADDRESS up if test x$GATEWAY = x; then : else echo "Adding the default gateway $GATEWAY..." route add default gw $GATEWAY $INTERFACE fi echo "Here is the current routing table:" route -n echo "Mounting root filesystem..." mount -n -t tmpfs none /sysroot/ echo "Mounting the nfs filesystem from $NFS_SERVER..." mkdir /sysroot/nfsroot mount -n -t nfs -o ro,$NFS_OPTIONS $NFS_SERVER:/ /sysroot/nfsroot # create necessary directories echo "Setting root symlinks..." cd /sysroot find ./nfsroot -maxdepth 1 -mindepth 1 -exec ln -s \{\} \; cd / # 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 chmod 1777 /sysroot/tmp rm -f /sysroot/proc mkdir /sysroot/proc rm -f /sysroot/dev mkdir /sysroot/dev cp -ax /dev/* /sysroot/dev rm -f /sysroot/mnt mkdir /sysroot/mnt rm -f /sysroot/etc cp -a /sysroot/nfsroot/etc /sysroot rm -f /sysroot/etc/mtab cp /dev/null /sysroot/etc/mtab rm -f /sysroot/etc/mtab~ rm -f /sysroot/sbin mkdir /sysroot/sbin cd /sysroot/sbin find ../nfsroot/sbin -maxdepth 1 -mindepth 1 -exec ln -s \{\} \; cd / # This is necessary because bigleon uses a different filesystem for /var, # and kernel nfs manages exports on per-filesystem basis. #rm -f /sysroot/var #mkdir /sysroot/var #mount -n -t nfs -o ro,$NFS_OPTIONS $NFS_SERVER:/var /sysroot/var # Likewise. #rm -f /sysroot/usr #mkdir /sysroot/usr #mount -n -t nfs -o ro,$NFS_OPTIONS $NFS_SERVER:/usr /sysroot/usr echo 0x100 > /proc/sys/kernel/real-root-dev # do a "pivot_root" so as to change the place of / echo "Changing the root directory to /sysroot..." pivot_root /sysroot /sysroot/initrd umount -n /initrd/proc umount -n /initrd/sys echo "Checking config.sh..." if test -r /etc/umiboot/config.sh; then echo "Running config.sh..." /bin/sh /etc/umiboot/config.sh fi echo "Leaving from linuxrc..."