#!/bin/sh
cd /mnt/us/extensions/hercules/

# Since we have an httproot config that won't play ball. Let's loopmount this puppy


if [ ! -d "/usr/share/hercules" ]; then
# Lets make a mount point that is sensible.
mntroot rw
sleep 1
mkdir /usr/share/hercules
mntroot ro
fi

#LAZY! (let's hide the error this time round)
umount /usr/share/hercules 2>/dev/null

#bind it
mount -o bind,ro /mnt/us/extensions/hercules/share/hercules /usr/share/hercules

#punch a hole for the HHTP, it will die on the next reboot anywho
#these do stack up but meh. live with it.
iptables -I INPUT -p tcp --dport 8081 -j ACCEPT
iptables -I INPUT -p tcp --dport 3270 -j ACCEPT
iptables -I INPUT -p tcp --dport 3990 -j ACCEPT

#now run it.
/mnt/us/extensions/kterm/bin/kterm -e /mnt/us/extensions/hercules/bin/subboot.sh

# let's tidy up

#LAZY!!!!!!!!!!!!!!!!!
umount /usr/share/hercules

# We are done here
