#additional software to install with build-a-pi #20200513 km4ack TEMPCRON=$MYPATH/cron.tmp DIR=$MYPATH/temp WHO=$(whoami) mkdir -p $DIR source $MYPATH/config ################################## # PAT WINLINK ################################## PAT(){ echo "##################" echo "installing pat" echo "##################" PORT=8080 cd $DIR if [ -f $HOME/.wl2k/config.json ]; then cp $HOME/.wl2k/config.json $DIR/config.json fi 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 pat http & sudo killall pat sudo systemctl start pat@$WHO sudo systemctl enable pat@$WHO cd $DIR FIG=$HOME/.wl2k/config.json #set callsign sed -i "s/\"mycall\": \".*\",/\"mycall\": \"$CALL\",/" $FIG #set password WL2KPASS=$(grep "WL2KPASS" $MYPATH/config | 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 sed -i "s/\"http_addr\": \".*\",/\"http_addr\": \"0.0.0.0:$PORT\",/" $FIG jq '.ax25.rig = '\"my-rig\"'' $HOME/.wl2k/config.json | jq '.ardop.rig = '\"my-rig\"'' | 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 if [ -f $DIR/config.json ]; then mv $DIR/config.json $HOME/.wl2k/ fi } ################################## # PAT MENU ################################## PAT-MENU(){ #backup config files (Issue #119) if [ -f $HOME/patmenu2/config ]; then mkdir -p $DIR/patconfig cp $HOME/patmenu2/*config* $DIR/patconfig/ fi #update pat menu if [ -d $HOME/patmenu2 ]; then rm -rf $HOME/patmenu2 fi cd $HOME git clone https://github.com/km4ack/patmenu2.git $HOME/patmenu2 && bash $HOME/patmenu2/setup sed -i "s/N0CALL/$CALL/" $HOME/patmenu2/config sed -i 's/1,0/2,0/g' $HOME/patmenu2/config #restore config files if [ -d $DIR/patconfig/ ]; then mv $DIR/patconfig/* $HOME/patmenu2/ fi } ################################## # JS8Call ################################## JS8CALL(){ cd $DIR JS8LATE=$(curl -s http://files.js8call.com/latest.html | grep armhf | awk '{ print $2 }' | sed 's/href=//' | sed 's/"//g') JS8PKG=$(curl -s http://files.js8call.com/latest.html | grep armhf | awk '{ print $2 }' | sed 's/\///g' | sed 's/href="http:files.js8call.com[0-9].[0-9].[0-9]//' | sed 's/"//') wget --tries 2 --connect-timeout=60 $JS8LATE || echo "Can't Download JS8Call" >> $BUILDLOG sudo dpkg -i $JS8PKG sudo apt-get --fix-broken -y install sudo dpkg -i $JS8PKG } ################################## # WSJTX ################################## WSJTX(){ cd $DIR WSPKG=$(curl -s https://physics.princeton.edu/pulsar/k1jt/wsjtx.html | grep armhf.deb | sed 's/^.*wsjtx/wsjtx/' | sed 's/deb.*$/deb/' | head -1) wget --tries 2 --connect-timeout=60 --no-check-certificate https://physics.princeton.edu/pulsar/k1jt/$WSPKG WSJTXSUCCESS=$? sudo dpkg -i $WSPKG sudo apt-get --fix-broken -y install sudo dpkg -i $WSPKG #try sourcegorge if princeton.edu fails WSJTX2(){ if [ "$WSJTXSUCCESS" ! = 0 ]; then cd $DIR wget --tries 2 --connect-timeout=60 https://sourceforge.net/projects/wsjt/files/wsjtx-2.2.2/wsjtx_2.2.2_armhf.deb sudo dpkg -i wsjtx_2.2.2_armhf.deb sudo apt-get --fix-broken -y install sudo dpkg -i wsjtx_2.2.2_armhf.deb fi } WSJTX2 } ################################## # CONKY ################################## CONKY(){ if ! hash conky 2>/dev/null; then sudo apt install -y conky fi touch $HOME/Documents/mylog.txt #conky will fail to load if this file doesn't exist touch /var/lib/misc/dnsmasq.leases #conky will fail to load if this file doesn't exist sudo apt-get install -y ruby2.5 sudo gem install gpsd_client sudo gem install maidenhead cp $MYPATH/conky/.conkyrc $HOME/.conkyrc mkdir -p $HOME/bin/conky cp $MYPATH/conky/* $HOME/bin/conky/ chmod +x $HOME/bin/conky/get-grid $HOME/bin/conky/temp-conv $HOME/bin/conky/get-freq $HOME/bin/conky/grid sed -i "s/N0CALL/$CALL/" $HOME/.conkyrc #Line below is for https://github.com/km4ack/pi-build/issues/198 #echo "*/5 * * * * home/pi/bin/conky/grid > /home/pi/bin/conky/gridsquare.txt" >> $TEMPCRON #Create files needed for autostart at login #Fix issue https://github.com/km4ack/pi-build/issues/83 cat < $HOME/.local/share/applications/conky.desktop [Desktop Entry] Name=Conky Comment=Conky GenericName=Conky Screen Background Monitor Exec=conky Icon=/home/pi/pi-build/conky/conky-logo.png Type=Application Encoding=UTF-8 Terminal=false Categories=HamRadio Keywords=Radio EOF ln -sf $HOME/.local/share/applications/conky.desktop $HOME/.config/autostart/conky.desktop #####Add setconky to main menu chmod +x $HOME/pi-build/conky/setconky cat < $HOME/.local/share/applications/setconky.desktop [Desktop Entry] Name=Conky-Prefs Comment=Conky-Prefs GenericName=Change Conky Preferences Exec=/home/pi/pi-build/conky/setconky Icon=/home/pi/pi-build/conky/conky-logo.png Type=Application Encoding=UTF-8 Terminal=false Categories=Settings;DesktopSettings;GTK;X-LXDE-Settings; Keywords=Radio,Conky EOF } ################################## # M0IAX Tools ################################## M0IAX(){ cd $DIR wget http://m0iax.com/wp-content/uploads/2020/08/JS8CallUtils_RaspberryPi.zip unzip JS8CallUtils_RaspberryPi.zip rm JS8CallUtils_RaspberryPi.zip chmod +x JS8CallUtils_v2 sudo mv JS8CallUtils_v2 /usr/local/bin cat > m0iax.desktop <//' | sed 's/[<].*$//') sudo apt-get -y install python-gtk2 python-serial python-libxml2 mkdir $HOME/chirp cd $HOME/chirp wget --tries 2 --connect-timeout=60 https://trac.chirp.danplanet.com/chirp_daily/LATEST/$CHIRPBUILD tar -xzf $CHIRPBUILD CHIRPDIR=$(echo $CHIRPBUILD | sed 's/[.].*$//') cd $CHIRPDIR sudo python setup.py install pip install future } ################################## # GARIM ################################## GARIM(){ GPKG=$(curl -s https://www.whitemesa.net/garim/src/ | grep tar.gz | tail -1 | sed 's/^.*garim/garim/' | sed 's/tar.gz.*$/tar.gz/') cd $DIR wget --tries 2 --connect-timeout=60 https://www.whitemesa.net/garim/src/$GPKG tar -xzvf $GPKG DIRR=$(echo $GPKG | sed 's/.tar.gz//') cd $DIRR ./configure make sudo make install } ################################## # QSSTV ################################## QSSTV(){ sudo apt-get install -y g++ libfftw3-dev qt5-default libpulse-dev libhamlib-dev libasound2-dev libv4l-dev libopenjp2-7 libopenjp2-7-dev cd $HOME/Downloads TAR=$(curl -s http://users.telenet.be/on4qz/qsstv/downloads/ | grep tar.gz | sed 's/.*href="//' | sed 's/">.*$//') wget --tries 2 --connect-timeout=60 http://users.telenet.be/on4qz/qsstv/downloads/$TAR SSTVTAR=$(echo $TAR | sed 's/.tar.gz//') tar -xvzf $TAR cd $SSTVTAR qmake make sudo make install sudo sed -i 's/Education;/Network;HamRadio;/' /usr/local/share/applications/qsstv.desktop } ################################## # GRIDTRACKER ################################## GRIDTRACKER(){ cd $HOME sudo apt-get install -y libgconf-2-4 GRIDDLL=$(curl -s https://tagloomis.com/downloads/ | grep Arm | head -1 | sed 's/.*href="//' | sed 's/.gz.*$/.gz/') wget --tries 2 --connect-timeout=60 $GRIDDLL GRIDTAR=$(echo $GRIDDLL | sed 's/.*\///g') tar -xzvf $GRIDTAR rm *.gz cat > gridtracker.desktop <> YAAC echo "java -jar $HOME/YAAC/YAAC.jar" >> YAAC chmod +x YAAC cat > yaac.desktop </dev/null; then sudo apt install -y php7.3 fi #install ghostwriter if needed #this is used to mod the new index.html #page. 20200229 if ! hash ghostwriter 2>/dev/null; then sudo apt-get install -y ghostwriter fi #Install the KM4ACK EES cd $DIR git clone https://github.com/km4ack/EES-LITE.git cd $DIR/EES-LITE #git dev branch of code git checkout dev sudo cp -r $DIR/EES-LITE/* /var/www/html/ rm -rf $DIR/EES-LITE cd /var/www/html sudo chmod +x /var/www/html/firstrun sudo /var/www/html/./firstrun sudo sed -i "s/N0CALL/$CALL/" /var/www/html/config.php sudo sed -i 's/REMINDER\ FOR\ OPERATOR\ TO\ DO\ SOMETHING/ENABLE\ AUTO\ POST\ REPLY\ IN\ CRON/' /var/www/html/config.php cd $DIR #Change Pat Winlink port so it won't interfer with the EES sed -i 's/0.0.0.0:8080/0.0.0.0:5000/' $HOME/.wl2k/config.json sed -i 's/PORT=8080/PORT=5000/' $HOME/patmenu2/config sudo killall pat sudo systemctl start pat@$WHO #Move info.markdown from EES folder to Documents sudo mv /var/www/html/info.markdown $HOME/Documents/ sudo chown $WHO:$WHO $HOME/Documents/info.markdown #move info.html to pi documents folder sudo cp /var/www/html/index.html $HOME/Documents/info.html sudo chown $WHO:$WHO $HOME/Documents/info.html #move script to be run by cron to bin dir sudo mv /var/www/html/webcopy $HOME/bin/ sudo chown $WHO:$WHO $HOME/bin/webcopy sudo chmod +x $HOME/bin/webcopy #set up cron job for EES echo "#-----Start EES Server Options------" >> $TEMPCRON echo "#Move EES email to Pat Winlink Outbox" >> $TEMPCRON echo "*/1 * * * * /var/www/html/movetopat" >> $TEMPCRON echo " " >> $TEMPCRON echo "#Auto post replies for EES server" >> $TEMPCRON echo "#Default is off. Activate by removing # on line below" >> $TEMPCRON echo "#*/1 * * * * /var/www/html/autopostreply" >> $TEMPCRON echo "#Line below moves info.html to index.html when modified" >> $TEMPCRON echo "*/1 * * * * $HOME/bin/webcopy" >> $TEMPCRON echo "#-----End EES Server Options------" >> $TEMPCRON } ################################## # Pi-APRS ################################## PI-APRS(){ cd $HOME git clone https://github.com/km4ack/Pi-APRS.git sudo cp ~/Pi-APRS/piaprs.desktop /usr/share/applications } ################################## # HamClock Small ################################## SMALL(){ sudo apt-get -y install make g++ libx11-dev cd $DIR curl -o ESPHamClock.zip http://www.clearskyinstitute.com/ham/HamClock/ESPHamClock.zip unzip ESPHamClock.zip rm ESPHamClock.zip cd ESPHamClock sudo make -j 4 hamclock sudo chmod +s hamclock sudo mv hamclock /usr/local/bin/hamclock rm -rf $DIR/ESPHamClock cat > $HOME/Downloads/hamclock.desktop < $HOME/Downloads/hamclock.desktop </dev/null; then cat < $HOME/Desktop/XLOG.txt Xlog could not be installed because hamlib wasn't found on the system. Use the build a pi script to install hamlib and then try installing xlog again. EOF else TARXLOG=$(curl -s https://download.savannah.nongnu.org/releases/xlog/ | \ grep 2.[0-9].[0-9][0-9].tar | sort | tail -1 | sed 's/.*xlog/xlog/' | sed 's/.sig.*$//') DIRXLOG=$(echo $TARXLOG | sed 's/.tar.gz//') cd $HOME sudo apt-get install -y libgtkgl2.0-dev libusb-1.0-0-dev wget https://download.savannah.nongnu.org/releases/xlog/$TARXLOG tar -xzvf $TARXLOG rm $TARXLOG cd $DIRXLOG ./configure make sudo make install cd $HOME rm -rf $DIRXLOG fi } ################################## # JTDX ################################## #This code is left in place but no option is given during inital #run or update because the jtdx website is down. #see https://github.com/km4ack/pi-build/issues/153 #14OCT2020 KM4ACK JTDX(){ cd $HOME #curl won't work here. Returns "forbidden" Use wget instead wget -qO jtdx.txt https://www.jtdx.tech/en/ VER=$(grep armhf.deb jtdx.txt | awk '{print $2}' | sed 's/"//g' | sed 's/href=\/downloads\/Linux\///') rm jtdx.txt wget https://www.jtdx.tech/downloads/Linux/$VER sudo dpkg -i $VER sudo apt-get --fix-broken -y install sudo dpkg -i $VER rm $VER }