#!/bin/sh
# Aus den Debian-Boot-Floppies 3.0.18, leicht modifiziert.
#
# From Debian's 3.0.18 boot floppies, slightly modified.

. /etc/rc.conf

# must mount proc first
mount proc /proc -t proc

# now devfsd
devfsd /dev

# disable modprobe calls
echo "/bin/true" >/proc/sys/kernel/modprobe

# mount root writable
mount /dev/root / -o remount,rw >/dev/null 2>&1

# give ourselves 256k of ramdisk for /tmp on readonly filesystems.
# we use ram0 since /dev/ram == ram1, and dboostrap uses that for
# other things. We test this with a simple check.
if touch /ro-test >/dev/null 2>&1; then
    rm -f /ro-test # nothing
else
    # We need to make sure that whatever is in /tmp, gets copied
    # to the new ramdisk first. We make a 512 ramdisk with 1024 bytes per
    # inode. This should give us ~500 inodes.
    dd if=/dev/zero of=/dev/ram0 bs=1024 count=512
    mkfs.minix /dev/ram0 >/dev/null 2>&1
    mount /dev/ram0 /mnt -o rw -t minix
    rm -rf /mnt/lost+found
    cp -a /tmp/. /mnt >/dev/null 2>&1
    rm -f `find /mnt | grep TRANS`
    umount /mnt
    mount /dev/ram0 /tmp -o rw -t minix
fi

# insmod seems to want this
mkdir -p /lib/modules/`uname -r` >/dev/null 2>&1

# start syslogging
/sbin/syslogd -m 0

# nfsroot cleanup (persistent files between runs)
rm -f /tmp/keybd_settings
rm -f -r /tmp/notarget

loadkeys /etc/boottime.kmap.gz
export TERM=5250

if [ -z "$IPADDR" ] ; then
	dialog --backtitle "$BACKTITLE"  \
		--title "$IPADDR_TITLE" --inputbox \
		"$IPADDR_TEXT" 12 60 2> /tmp/IPADDR
	dialog --backtitle "$BACKTITLE" \
		--title "$GATEWAY_TITLE" --inputbox \
		"$GATEWAY_TEXT" 12 60 2> /tmp/GATEWAY
	IPADDR=`cat /tmp/IPADDR`
	GATEWAY=`cat /tmp/GATEWAY`
fi

ifconfig eth0 $IPADDR netmask 255.255.255.0 up
route add default gw $GATEWAY

exit 0
