FREIHEIT FÜR HASEN

#!/bin/sh

echo "Mounting /proc"
/bin/mount -t proc proc /proc

echo "Mounting /sys"
/bin/mount -t sysfs none /sys

echo "Mounting /var"
/bin/mount -t ramfs ramfs /var

echo "Creating /var entries"
/bin/mkdir -p /var/tmp
/bin/mkdir -p /var/run
/bin/mkdir -p /var/log
/bin/mkdir -p /var/lock
/bin/mkdir -p /var/empty
/bin/mkdir -p /var/run/karotz

echo "Mounting /dev/"
/bin/mount -o mode=0755 -t tmpfs none /dev

echo "Creating /dev/ basic inputs"
/bin/mknod /dev/console c 5 1
/bin/mknod /dev/ttySAC0 c 5 1
/bin/mknod /dev/null c 1 3
/bin/mknod /dev/zero c 1 5
/bin/mknod /dev/uba b 180 0
/bin/mknod /dev/uba1 b 180 1
/bin/mknod /dev/ubb b 180 16
/bin/mknod /dev/ubb1 b 180 17
/bin/mknod /dev/ptmx c 5 2
/bin/mknod /dev/rtc0 c 254 0
/bin/mkdir /dev/pts
/bin/mkdir /dev/shm

/bin/mknod /dev/rabbit_ears c 60 0
/bin/mknod /dev/rabbit_button c 52 0
/bin/mknod /dev/rabbit_power c 53 0

/bin/mknod /dev/s3c2410_serial0 c 204 64
/bin/mknod /dev/s3c2410_serial1 c 204 65
/bin/mknod /dev/s3c2410_serial2 c 204 66

echo /karotz/scripts/hotplug.sh > /proc/sys/kernel/hotplug
/sbin/mdev -s

/bin/ln -s /dev/s3c2410_serial0 /dev/ttyS0
/bin/ln -s /dev/s3c2410_serial1 /dev/ttyS1
/bin/ln -s /dev/s3c2410_serial2 /dev/ttyS2

/bin/ln -s /dev/mtdblock1 /dev/kernel
/bin/mount -t yaffs /dev/mtdblock6 /usr

[ ! -d "/usr/etc" ] && mkdir -p /usr/etc
[ ! -d "/usr/etc/conf" ] && mkdir -p /usr/etc/conf

# Linking /etc from the yaffs to the rootfs

FILES_LIST="/etc/fstab \
            /etc/group \
            /etc/hosts \
            /etc/inetd.conf \
            /etc/inittab \
            /etc/ld.so.conf
            /etc/modules.conf \
            /etc/motd \
            /etc/passwd \
            /etc/profile \
            /etc/services"
for i in $(echo $FILES_LIST); do
    [ -e $i ] && /bin/rm $i
    /bin/ln -s /karotz$i $i
done

[ -e /etc/conf/rootfs_version ] && /bin/rm /etc/conf/rootfs_version

rm -rf /etc/conf/rootfs_version

/bin/ln -s /karotz/etc/rootfs_version /etc/conf/rootfs_version 

[ -e /etc/resolv.conf ] && /bin/rm /etc/resolv.conf
cat << EOF > /etc/resolv.conf
nameserver 8.8.8.8
EOF

[ -f "/dev/rtc" ] && /bin/rm /dev/rtc
/bin/ln -s /dev/rtc0 /dev/rtc

/bin/hostname karotz

[ ! -e /etc/ld.so.cache ] && /sbin/ldconfig

/bin/mount -a

[ -f /usr/etc/profile ] && . /usr/etc/profile

export GST_REGISTRY=/usr/karotz/registry
export GST_REGISTRY_UPDATE=no
export AUTO_UPDATE=yes

[ -f /etc/conf/enable_syslogd ] && /sbin/syslogd

/sbin/inetd

/bin/cat /karotz/etc/motd

echo "Rootfs version : $(cat /karotz/etc/rootfs_version)"
if [ -e /etc/conf/sys_version ]; then
    echo "System version : $(cat /etc/conf/sys_version)"
else
    [ ! -e /usr/etc/conf ] && mkdir -p /usr/etc/conf
    touch /usr/etc/conf/sys_version
    echo "10.10.10.10" > /usr/etc/conf/sys_version
    echo "System version : 10.10.10.10"
fi

echo "NAND status : $(dmesg | grep "is bad" | wc -l) bad blocks"
echo -e "Auto Update : $AUTO_UPDATE\n"

# if there is a signed autorun in a usb key, let's run it
# the directory in which the autorun is located
GNUPGHOME=/karotz/etc/gpg
GPG="/bin/gpg -quiet --lock-never --ignore-time-conflict --homedir $GNUPGHOME"
if [ -x /mnt/usbkey/autorun -a -f /mnt/usbkey/autorun.sig ] ; then
    echo "Launching autorun if present"
	$GPG --verify /mnt/usbkey/autorun.sig 2>/dev/null && /mnt/usbkey/autorun
fi

# WICHTIG: die folgende Zeile nicht ausführen!!!
# exec /sbin/init