#!/bin/bash # # hacked rc.rofilesys for SL-C3100 only! # LINUXFMT=ext3 MKE2FSOPT=-j # # get device pcmcia_slot # format: get_dev_pcmcia_slot [slot number] # slot number: 0, 1 # output: device name (hda or hdc) # get_dev_pcmcia() { while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR; do echo $DEVS done } get_dev_pcmcia_slot() { grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia } RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1` if [ "$RW_MTD_LINE" = "" ]; then RW_MTD_LINE=`cat /proc/mtd | grep "\.*\<2\>" | tail -n 1` fi RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2` RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2` RW_MTD=/dev/mtd$RW_MTD_NO RW_MTDBLK=/dev/mtdblock$RW_MTD_NO RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /` initlog -s $"found $RW_MTD ${RW_MTD_SIZE}\"Kbyte\"" echo "mounting /home from /dev/mtdblock${RW_MTD_NO} : ${RW_MTD_SIZE} Kbyte" if [ "$ZAURUS_RESET" = "HARD" ]; then STRING=$"Starting filesystem: " msg -n $STRING # mount /home /sbin/eraseall $RW_MTD 2> /dev/null > /dev/null mount -t jffs2 -o rw,noatime $RW_MTDBLK /home cd / tar xf /root/.home_default.tar # mount /dev dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null mount -t minix /dev/ram1 /dev (cd /home ; tar cf - dev | (cd / ; tar xf -)) # mount /tmp mount -t tmpfs -o size=2m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb /etc/ledmode reset # mount HDD /etc/rc.d/init.d/pcmcia start while [ "$IDE1" = "" ]; do IDE1=`get_dev_pcmcia_slot 1` done mount -t vfat -o noatime,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3 rc=$? if [ "$rc" != "0" ]; then echo -n "HDD3 Error!! " /bin/ledctl ledmode 0 /bin/ledctl alarm 1 while [ "$DUMMY" = "" ]; do sleep 1 done fi mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}2 not found " fi swapon /dev/${IDE1}1 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}1 not found " fi sltime -clear rc=$? if [ "$rc" = "0" ]; then success "$STRING" else failure "$STRING" fi msg else ### SW Reset ! #STRING=$"Checking filesystem: " # mount /home mount -t jffs2 -o rw,noatime $RW_MTDBLK /home # mount /dev dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null mount -t minix /dev/ram1 /dev (cd /home ; tar cf - dev | (cd / ; tar xf -)) if [ -f /home/etc/restorepc ]; then RESTORE_CONNECTION=`cat /home/etc/restorepc` else RESTORE_CONNECTION="" fi if [ "$RESTORE_CONNECTION" != "" ]; then cp /home/etc/restoreip /dev/restoreip 2> /dev/null > /dev/null cp /home/zaurus/Settings/Security.conf /dev/Security.conf 2> /dev/null > /dev/null umount $RW_MTDBLK /sbin/eraseall $RW_MTD 2> /dev/null > /dev/null mount -t jffs2 -o rw,noatime $RW_MTDBLK /home mount -t tmpfs -o size=2m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb cd / tar xf /root/.home_default.tar rm -rf /home/zaurus/Applications/Contents/ /etc/ledmode reset # mount HDD /etc/rc.d/init.d/pcmcia start while [ "$IDE1" = "" ]; do IDE1=`get_dev_pcmcia_slot 1` done echo "mounting /hdd3 (for shared data)" mount -t vfat -o noatime,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3 rc=$? if [ "$rc" != "0" ]; then echo -n "HDD3 Error!! " /bin/ledctl ledmode 0 /bin/ledctl alarm 1 while [ "$DUMMY" = "" ]; do sleep 1 done fi echo "mounting /hdd2 (for applications)" mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}2 not found " fi echo "enabling swap partition" swapon /dev/${IDE1}1 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}1 not found " fi rm /home/zaurus/Settings/route.conf 2>/dev/null >/dev/null echo -n $RESTORE_CONNECTION > /home/zaurus/Settings/route.conf touch /home/etc/restorepc mv /dev/restoreip /etc/hotplug/usbdnet.conf 2> /dev/null > /dev/null mv /dev/Security.conf /home/zaurus/Settings/Security.conf 2> /dev/null > /dev/null else echo "mounting /tmp (2MB)" mount -t tmpfs -o size=2m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb /etc/ledmode reset /etc/rc.d/init.d/pcmcia start while [ "$IDE1" = "" ]; do IDE1=`get_dev_pcmcia_slot 1` done echo "mounting /hdd3 (for shared data)" mount -t vfat -o noatime,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3 rc=$? if [ "$rc" != "0" ]; then echo -n "HDD3 Error!! " /bin/ledctl ledmode 0 /bin/ledctl alarm 1 while [ "$DUMMY" = "" ]; do sleep 1 done fi echo "mounting /hdd2 (for applications)" mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}2 not found " fi echo "enabling swap partition" swapon /dev/${IDE1}1 rc=$? if [ "$rc" != "0" ]; then echo "/dev/${IDE1}1 not found " fi fi fi echo $LAUNCH > /home/sharp/etc/launch.default