Here's mine :
#!/bin/bash
#
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/root/bin:/usr/local/root/sbin
TERM=vt100
export PATH TERM
IMGDIR=/usr/local/images
mount -n -o remount,ro /
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
INETD=0
RW=0
while :
do
/empeg/bin/player
if grep -q '0 (AC Power)' /proc/empeg_power
then
if [ "$RW" = "0" ]
then
echo "Mounting readwrite"
blitraw < $IMGDIR/readwrite.raw
mount -n -o remount,rw /
mount -n -o remount,rw /drive0
echo "Activating swap"
blitraw < $IMGDIR/swapon.raw
sleep 1
swapon /usr/local/root/swapfile
RW=1
hostname empeg
if [ "$INETD" = "0" ]
then
blitraw < $IMGDIR/inetd.raw
echo "Starting inetd"
sleep 1
/sbin/inetd
INETD=1
/usr/local/sbin/fidstreamer&
fi
else
blitraw < $IMGDIR/swapoff.raw
echo "Turning off swap"
sleep 1
swapoff /usr/local/root/swapfile
blitraw < $IMGDIR/readonly.raw
echo "Mounting readonly"
sleep 1
mount -n -o remount,ro /
mount -n -o remount,ro /drive0
RW=0
fi
fi
echo "Press q to terminate to a shell"
/usr/local/sbin/getkey q && /bin/bash
done
getkey is a program I knew from redhat. It didn't work for me on a serial console so I put in an alarm which waits for 5 seconds.
source is at
http://fvgestel.dyndns.org/empeg/getkeyFrank van Gestel