#!/bin/sh
# post-atalkd.ini
#
# AppleTalk routing between internal networks

. /etc/config

[ $INSIDE_TITLE ] && ZONE="-zone \"$INSIDE_TITLE\""
[ $INSIDE2_TITLE ] && ZONE2="-zone \"$INSIDE2_TITLE\""
[ $INSIDE3_TITLE ] && ZONE3="-zone \"$INSIDE3_TITLE\""
[ $INSIDE4_TITLE ] && ZONE4="-zone \"$INSIDE4_TITLE\""
[ $INSIDE5_TITLE ] && ZONE5="-zone \"$INSIDE5_TITLE\""

if [ ${INSIDE2_DEV} ]; then
	echo "${INSIDE2_DEV} -seed -phase 2 -net 1200-1201 -addr 1200.50 $ZONE2" >> /etc/atalkd.conf
	[ ${INSIDE3_DEV} ] && echo "${INSIDE3_DEV} -seed -phase 2 -net 1300-1301 -addr 1300.50 $ZONE3" >> /etc/atalkd.conf
	[ ${INSIDE4_DEV} ] && echo "${INSIDE4_DEV} -seed -phase 2 -net 1400-1401 -addr 1400.50 $ZONE4" >> /etc/atalkd.conf
	[ ${INSIDE5_DEV} ] && echo "${INSIDE5_DEV} -seed -phase 2 -net 1500-1501 -addr 1500.50 $ZONE5" >> /etc/atalkd.conf
	echo "${INSIDE_DEV} -seed -phase 2 -net 1100-1101 -addr 1100.50 $ZONE" >> /etc/atalkd.conf
else
	echo "${INSIDE_DEV} -router -phase 2 -net 1100-1101 -addr 1100.50 $ZONE" >> /etc/atalkd.conf
fi

# Temporary hack - too lazy to recompile with the right one builtin...
[ -d /var/lock ] || ln -s run /var/lock

/bin/atalkd -f /etc/atalkd.conf
