fuckeduppdp/docker/startup.sh

26 lines
796 B
Bash
Executable File

#!/bin/sh
set -ex
[ -n "$DISK_FILENAME" ] || DISK_FILENAME="rq0.dsk"
[ -f "/mnt/$DISK_FILENAME" ] || { echo "Unable to find tape /mnt/$DISK_FILENAME"; exit 1; }
[ -w "/mnt/$DISK_FILENAME" ] || { echo "Tape /mnt/$DISK_FILENAME is not writable"; exit 1; }
# Set exit command only if NOEXIT not set
[ -z "$NOEXIT" ] && EXIT_CMD="exit" || EXIT_CMD=""
sed -e "s/<DISK_FILENAME>/${DISK_FILENAME}/" \
-e "s/<EXIT>/${EXIT_CMD}/" /boot.ini.template > /boot.ini
cidr=28
hostip=1.3.3.1
pdpip=1.3.3.7
ip tuntap add pdp mode tap
ip link set pdp up
ip addr add "${hostip}/${cidr}" dev pdp
iptables -t nat -A PREROUTING ! -i pdp -p tcp --dport 4000 -j ACCEPT
iptables -t nat -A PREROUTING ! -i pdp -j DNAT --to-destination 1.3.3.7
iptables -t nat -A POSTROUTING ! -o pdp -j MASQUERADE
pdp11 /boot.ini