#!/bin/sh
# This script startAX25.sh will install AX.25 port ax0
#
# Command for script startAX25.sh to be executable is 
# sudo chmod a+x startAX25.sh
# 
# needs /usr/local/etc/ax25/axports (for ax0 callsign)
# needs /usr/local/etc/ax25/ax25ipd.conf (setting socket UDP # and IP routes address)
#
# then execute : 
# ./startAX25.sh
#
# A connection test can be performed using AX.25 tool application 'call'
# Examples : call axudp f6bvp-8          (to node station)
#            call axudp f6bvp-1 f6bvp-8  (to BBS via node station)
#
echo "Installing ax25ipd Unix98 master pseudo tty"
/bin/date > /var/log/ax25ipd.log
/usr/local/sbin/ax25ipd  > /tmp/unix98
echo $! > /var/run/ax25ipd.pid
export AXUDP=`tail -1 /tmp/unix98`
#
echo "Installing a KISS link on ethernet port"
/usr/local/sbin/kissattach  $AXUDP axudp  > /tmp/ax25-config.tmp
 awk '/device/ { print $7 }' /tmp/ax25-config.tmp > /tmp/ax25-config-tmp
read Device < /tmp/ax25-config-tmp
# Check for Device
 if [ -d /proc/sys/net/ax25/$Device ] ; then 
 echo "Port axudp attached to $Device"
 fi
#

