mirror of
https://github.com/km4ack/73Linux
synced 2026-08-13 17:51:54 -04:00
98 lines
No EOL
3.8 KiB
Text
98 lines
No EOL
3.8 KiB
Text
BAPP=4.0
|
|
ID=PAT
|
|
Name=Pat
|
|
Comment='Pat Winlink Client'
|
|
Ver=Update:0.13.1
|
|
localVer=0.12.1
|
|
|
|
|
|
INSTALL(){
|
|
PORT=8080
|
|
DIR=${BUILDDIR}
|
|
cd ${DIR}
|
|
WHO=`whoami`
|
|
if [ -f ${HOME}/.wl2k/config.json ]; then
|
|
cp ${HOME}/.wl2k/config.json ${DIR}/config.json
|
|
elif [ -f ${XDG_CONFIG_HOME}/pat/config.json ]; then
|
|
cp $XDG_CONFIG_HOME/pat/config.json ${DIR}/config.json
|
|
fi
|
|
|
|
if [ `getconf LONG_BIT` = '64' ]; then
|
|
#install deb file for 64 bit systems
|
|
NEWPATV=$(curl -s https://github.com/la5nta/pat/releases | grep arm64 | head -1 | sed 's/.*pat_/pat_/' | sed 's/<\/a>.*$//')
|
|
NEWPAT=$(echo ${NEWPATV} | sed 's/pat_//' | sed 's/_linux_arm64.deb//' | sed 's/0\.//')
|
|
echo "new pat v ${NEWPATV}"
|
|
echo "new pat ${NEWPAT}"
|
|
wget --tries 2 --connect-timeout=60 https://github.com/la5nta/pat/releases/download/v0.${NEWPAT}/${NEWPATV}
|
|
sudo dpkg -i ${DIR}/${NEWPATV}
|
|
|
|
else
|
|
|
|
#install deb file for 32 bit systems
|
|
NEWPATV=$(curl -s https://github.com/la5nta/pat/releases | grep armhf | head -1 | sed 's/.*pat_/pat_/' | sed 's/<\/a>.*$//')
|
|
NEWPAT=$(echo ${NEWPATV} | sed 's/pat_//' | sed 's/_linux_armhf.deb//' | sed 's/0\.//')
|
|
echo "new pat v ${NEWPATV}"
|
|
echo "new pat ${NEWPAT}"
|
|
wget --tries 2 --connect-timeout=60 https://github.com/la5nta/pat/releases/download/v0.${NEWPAT}/${NEWPATV}
|
|
sudo dpkg -i ${DIR}/${NEWPATV}
|
|
fi
|
|
|
|
#lines below configure pat with user info
|
|
pat http &
|
|
sudo killall pat
|
|
sudo systemctl enable pat@${WHO}
|
|
cd ${DIR}
|
|
PAT_VERSION=$(pat version | awk '{print $2}' | sed 's/v0.//;s/.0//')
|
|
#The Pat Winlink config file will change location in version 0.12. The below if statement
|
|
#checks to see which version is installed.
|
|
#check to see if pat version is 12 or greater. Change config file location
|
|
#depending on which version.
|
|
if [ "$PAT_VERSION" -le 11 ]; then
|
|
echo "pat version 11 detected"
|
|
FIG=$HOME/.wl2k/config.json
|
|
else
|
|
echo "pat version 12 or greater detected"
|
|
FIG=$HOME/.config/pat/config.json
|
|
fi
|
|
#set callsign
|
|
sed -i "s/\"mycall\": \".*\",/\"mycall\": \"${CALL}\",/" ${FIG}
|
|
#set password
|
|
WL2KPASS=$(grep "WL2KPASS" ${BAPDIR}/cache/config.txt | sed 's/"//g' | sed 's/WL2KPASS=//')
|
|
sed -i "s/\"secure_login_password\": \".*\",/\"secure_login_password\": \""$WL2KPASS"\",/" ${FIG}
|
|
#set locator
|
|
sed -i "s/\"locator\": \".*\",/\"locator\": \"$GRID\",/" ${FIG}
|
|
#Change localhost to 0.0.0.0
|
|
#This is a secutiry risk. See https://github.com/km4ack/pi-build/issues/299
|
|
#Changed to 127.0.0.1 on 11OCT2021 KM4ACK
|
|
sed -i "s/\"http_addr\": \".*\",/\"http_addr\": \"127.0.0.1:$PORT\",/" ${FIG}
|
|
#jq '.ax25.rig = '\"my-rig\"'' ${FIG} | jq '.ardop.rig = '\"my-rig\"'' | jq '.hamlib_rigs = {'\"my-rig\"': {"address": "127.0.0.1:4532", "network": "tcp"}}' >~/Desktop/config.json
|
|
jq '.ax25.rig = '\"my-rig\"'' ${FIG} | jq '.varafm.rig = '\"my-rig\"'' | jq '.varahf.rig = '\"my-rig\"'' | jq '.ardop.rig = '\"my-rig\"'' | \
|
|
jq '.varafm.ptt_ctrl = 'true'' | jq '.varahf.ptt_ctrl = 'true'' | \
|
|
jq '.hamlib_rigs = {'\"my-rig\"': {"address": "127.0.0.1:4532", "network": "tcp"}}' >~/Desktop/config.json
|
|
mv ${HOME}/Desktop/config.json ${FIG}
|
|
sed -i 's/"enable_http": false,/"enable_http": true,/' ${FIG}
|
|
sudo systemctl start pat@${WHO}
|
|
|
|
if [ -f ${DIR}/config.json ]; then
|
|
mv ${DIR}/config.json ${HOME}/.wl2k/
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
VERSION(){
|
|
if ! hash pat 2>/dev/null; then
|
|
CURRENT=0
|
|
NEWPATV=$(curl --max-time 20 -s https://github.com/la5nta/pat/releases | grep armhf | head -1 | sed 's/.*pat_/pat_/' | sed 's/<\/a>.*$//')
|
|
NEWVER=$(echo ${NEWPATV} | sed 's/pat_//' | sed 's/_linux_armhf.deb//')
|
|
else
|
|
CURRENT=$(pat version | awk '{print $2}' | sed 's/v//')
|
|
NEWPATV=$(curl --max-time 20 -s https://github.com/la5nta/pat/releases | grep armhf | head -1 | sed 's/.*pat_/pat_/' | sed 's/<\/a>.*$//')
|
|
NEWVER=$(echo ${NEWPATV} | sed 's/pat_//' | sed 's/_linux_armhf.deb//')
|
|
fi
|
|
}
|
|
|
|
REMOVE(){
|
|
sudo killall pat
|
|
sudo dpkg --remove pat
|
|
} |