You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.4 KiB
Bash
93 lines
2.4 KiB
Bash
#!/bin/sh
|
|
|
|
# Directories and static values
|
|
DEFZONE=2
|
|
# Default outbound
|
|
# OUTBOUND="."
|
|
# Our AKA
|
|
# AKA="2:5030/723@fidonet"
|
|
# FLO Extension
|
|
FLOEXT="dlo"
|
|
# BFCONFIG=/opt/fidonms/etc/bforce.conf
|
|
|
|
if [ "${BFCONFIG}" == "" ]; then
|
|
BFCONF="/etc/bforce/bforce.conf"
|
|
else
|
|
BFCONF=${BFCONFIG}
|
|
fi
|
|
|
|
if [ "$1" == "" ]; then
|
|
echo "No FTN provided. Usage: mkpoll <address>"
|
|
exit 1
|
|
fi
|
|
|
|
# Address to create poll
|
|
FTNA=$1
|
|
|
|
# Outbound address
|
|
OUTB=""
|
|
if [ -f "${BFCONF}" ]; then
|
|
# We have config!
|
|
OUTB=$(grep -E "^outbound_directory" ${BFCONF} | awk '{print $2}')
|
|
else
|
|
OUTB=${OUTBOUND}
|
|
fi
|
|
|
|
#echo "FTNA: ${FTNA} OUTB: ${OUTB}"
|
|
|
|
FZONE=$(echo -n ${FTNA}| awk -F':' '{print $1}')
|
|
FNET=$(echo -n ${FTNA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
|
|
FNODE=$(echo -n ${FTNA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
|
|
FPNT=$(echo -n ${FTNA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
|
|
FDOM=$(echo -n ${FTNA} | awk -F'@' '{print $2}')
|
|
|
|
# echo "Dest ZONE: ${FZONE}, NET: ${FNET}, NODE: ${FNODE}, PNT: ${FPNT} DOM: ${FDOM}"
|
|
|
|
# Our AKA
|
|
FAKA=""
|
|
if [ -f "${BFCONF}" ]; then
|
|
# We have config!
|
|
FAKA=$(grep -E "^address" ${BFCONF} | awk '{print $2}')
|
|
else
|
|
FAKA=${AKA}
|
|
fi
|
|
|
|
AZONE=$(echo -n ${FAKA}| awk -F':' '{print $1}')
|
|
ANET=$(echo -n ${FAKA} | awk -F':' '{print $2}' | awk -F'/' '{ print $1 }')
|
|
ANODE=$(echo -n ${FAKA}| awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $1 }')
|
|
APNT=$(echo -n ${FAKA} | awk -F'/' '{print $2}' | awk -F'@' '{ print $1 }'| awk -F'.' '{ print $2 }')
|
|
ADOM=$(echo -n ${FAKA} | awk -F'@' '{print $2}')
|
|
|
|
# echo "Our ZONE: ${AZONE}, NET: ${ANET}, NODE: ${ANODE}, PNT: ${APNT} DOM: ${ADOM}"
|
|
|
|
|
|
FTNB=$( printf "%04x%04x" ${FNET} ${FNODE} )
|
|
|
|
if [ "${FPNT}" == "" ]; then
|
|
FPNT="0"
|
|
fi
|
|
|
|
FFLO=""
|
|
if [ "${AZONE}" == "${FZONE}" ] && [ "${FNET}" == "${ANET}" ] && [ "${FNODE}" == "${ANODE}" ] && [ ! "${FPNT}" == "0" ]; then
|
|
# echo "Point operations!"
|
|
FLOFIL=$( printf "%08x.${FLOEXT}" ${FPNT} )
|
|
PNTDIR=$( echo -n "${OUTB}/${FTNB}.pnt")
|
|
FFLO=$( echo -n "${PNTDIR}/${FLOFIL}" )
|
|
elif [ ! "${DEFZONE}" == "${FZONE}" ]; then
|
|
# Interzonal poll
|
|
FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
|
|
FDIR=$( printf "%03x" ${FZONE} )
|
|
FFLO=$( echo -n "${OUTB}.${FDIR}/${FLOFIL}" )
|
|
else
|
|
# Normal in-zone poll
|
|
FLOFIL=$( echo -n "${FTNB}.${FLOEXT}" )
|
|
FFLO=$( echo -n "${OUTB}/${FLOFIL}" )
|
|
fi
|
|
|
|
# echo "FloFile: ${FFLO}"
|
|
|
|
if [ ! -f "${FFLO}" ]; then
|
|
touch "${FFLO}"
|
|
fi
|
|
|