#!/bin/bash #MAIN SCRIPT FOR NEW PI BUILD #20191210 KM4ACK #Credit to TB-14 for the inspiration for this script MYDIR=$HOME/pi-build DIR=$HOME/temp mkdir -p $DIR TEMPCRON=$DIR/tempcron touch $TEMPCRON WHO=$(whoami) RB=$(ls $HOME/.config/ | grep KM4ACK) LOG=$HOME/Documents/mylog.txt APPLIST=app-list BUILDLOG=$HOME/Documents/build-log.txt chmod +x $MYDIR/addon-build-a-pi #put info in build log echo "###########SYSTEM INFO##############" >> $BUILDLOG cat /etc/os-release >> $BUILDLOG uname -a >> $BUILDLOG free -m | grep Mem: | awk '{ print $2 }' >> $BUILDLOG echo "###########END SYSTEM INFO##############" >> $BUILDLOG #Backup cron just in case script is run twice crontab -l > $TEMPCRON #add part 2 to be called from cron at boot echo "@reboot sleep 20 && export DISPLAY=:0 && lxterminal -e $HOME/pi-build/addon-build-a-pi" >> $TEMPCRON #create primary log touch $LOG #create buld log touch $BUILDLOG if [ $WHO = "root" ] then echo "No need for sudo with this script" exit 0 fi if [ -z "$RB" ] then echo else cat < $MYDIR/callsign.txt cat <> $HOME/.bashrc #grab add-wifi tool cd $HOME/bin wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/add-wifi chmod +x add-wifi cd $HOME if ! hash yad 2>/dev/null; then sudo apt install -y yad fi if ! hash jq 2>/dev/null; then sudo apt install -y jq fi clear;echo;echo cat < $MYDIR/appchoices BUTTON=$? if [ $BUTTON = "3" ] then yad --width=500 --height=500 --center --button="Close:1" --wrap --text-info < info.txt MAIN elif [ $BUTTON = "252" ] then exit 0 elif [ $BUTTON = "1" ] then exit 0 fi echo $BUTTON cat $MYDIR/appchoices | sed 's/TRUE,//g' | sed 's/,//' | sed 's/$/=yes/' > $MYDIR/config rm $MYDIR/appchoices };export -f MAIN MAIN ############################################################################ source $MYDIR/config if [ $HOTSPOT = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING AUTOHOTSPOT" echo "##################################################" sleep 2 cd $DIR wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/autohotspotN-setup || echo "Can't download autohotspot script" >> $BUILDLOG chmod +x $DIR/autohotspotN-setup sudo $DIR/autohotspotN-setup echo "*/5 * * * * sudo /usr/bin/autohotspotN >/dev/null 2>&1" >> $TEMPCRON rm $DIR/autohotspotN-setup echo "Hot spot installed" >> $BUILDLOG fi if [ $GPS = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING GPS Tools" echo "##################################################" cd $DIR wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/gpsinstall || echo "Can't download GPS Tools" >> $BUILDLOG chmod +x $DIR/gpsinstall sudo $DIR/gpsinstall rm $DIR/gpsinstall echo "GPS Tools installed" >> $BUILDLOG fi if [ $PAT = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING PAT WINLINK" echo "##################################################" sleep 2 if ! hash pat 2>/dev/null; then cd $DIR wget https://github.com/la5nta/pat/releases/download/v0.8.0/pat_0.8.0_linux_armhf.deb || echo "Can't download Pat Winlink" >> $BUILDLOG sudo dpkg -i $DIR/pat_0.8.0_linux_armhf.deb pat http & sudo killall pat sudo systemctl start pat@$WHO sudo systemctl enable pat@$WHO #/usr/bin/pat http & #sudo killall pat cd $DIR wget https://raw.githubusercontent.com/km4ack/patmenu/master/patlogin bash patlogin 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 ~/Desktop/config.json ~/.wl2k/config.json sed -i "s/\"http_addr\": \".*\",/\"http_addr\": \"0.0.0.0:8080\",/" $HOME/.wl2k/config.json #enable gps in pat is gps=yes if [ $GPS = "yes" ] then sed -i 's/"enable_http": false,/"enable_http": true,/' $HOME/.wl2k/config.json fi echo "Pat Winlink installed" >> $BUILDLOG fi fi if [ $HAMLIB = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING RIG CONTROL" echo "##################################################" sleep 2 cd $DIR wget https://sourceforge.net/projects/hamlib/files/hamlib/3.3/hamlib-3.3.tar.gz || echo "Can't download HAMLIB" >> $BUILDLOG tar -xzf $DIR/hamlib-3.3.tar.gz rm $DIR/hamlib-3.3.tar.gz cd $DIR/hamlib-3.3 ./configure make sudo make install sudo ldconfig echo "HAMLIB installed" >> $BUILDLOG fi if [ $CONKY = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING CONKY" echo "##################################################" sleep 2 if ! hash conky 2>/dev/null; then sudo apt install -y conky fi sudo apt-get install -y ruby2.3 sudo gem install gpsd_client sudo gem install maidenhead cp $MYDIR/conky/.conkyrc $HOME/.conkyrc mkdir -p $HOME/bin/conky cp $MYDIR/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 echo "@reboot sleep 20 && export DISPLAY=:0 && /usr/bin/conky" >> $TEMPCRON echo "CONKY installed" >> $BUILDLOG fi if [ $FL_Suite = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING FLDIGI SUITE" echo "##################################################" sleep 2 chmod +x $HOME/pi-build/flsuite $HOME/pi-build/flsuite echo "FLDIGI SUITE installed" >> $BUILDLOG fi if [ $FLRIG = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING FLRIG" echo "##################################################" sleep 2 if ! hash flrig 2>/dev/null; then sudo apt install -y flrig echo "FLRIG installed repository" >> $BUILDLOG fi fi if [ $FLDIGI = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING FLDIGI" echo "##################################################" sleep 2 if ! hash fldigi 2>/dev/null; then sudo apt install -y fldigi echo "FLDIGI installed repository" >> $BUILDLOG fi fi if [ $FLAMP = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING FLAMP" echo "##################################################" sleep 2 if ! hash flamp 2>/dev/null; then sudo apt install -y flamp echo "FLAMP installed repository" >> $BUILDLOG fi fi if [ $FLMSG = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING FLMSG" echo "##################################################" sleep 2 if ! hash flmsg 2>/dev/null; then sudo apt install -y flmsg echo "FLMSG installed repository" >> $BUILDLOG fi fi if [ $ARDOPC = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING PIARDOPC" echo "##################################################" sleep 2 mkdir -p $HOME/ardop cd $HOME/ardop wget https://www.cantab.net/users/john.wiseman/Downloads/Beta/piardopc || echo "Can't download PIARDOPC" >> $BUILDLOG sudo chmod +x $HOME/ardop/piardopc echo "PIARDOPC installed" >> $BUILDLOG fi if [ $ARDOPGUI = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING ARDOP-GUI" echo "##################################################" sleep 2 mkdir -p $HOME/ardop cd $HOME/ardop wget https://www.cantab.net/users/john.wiseman/Downloads/Beta/piARDOP_GUI || echo "Can't download piARDOP_GUI" >> $BUILDLOG sudo chmod +x $HOME/ardop/piARDOP_GUI cat > ardopgui.desktop <> $FILE echo "Host=local" >> $FILE echo "Port=8515" >> $FILE echo "ARDOP-GUI installed" >> $BUILDLOG fi if [ $PATMENU = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING Pat Menu" echo "##################################################" sleep 2 git clone https://github.com/km4ack/patmenu.git $HOME/patmenu && bash $HOME/patmenu/setup || echo "Can't download Pat Menu" >> $BUILDLOG echo "Pat Menu installed" >> $BUILDLOG cat > patmenu.desktop < /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING DIREWOLF" echo "##################################################" sleep 2 cd $HOME git clone https://www.github.com/wb2osz/direwolf || echo "Can't download DIREWOLF" >> $BUILDLOG cd $HOME/direwolf sudo apt-get install -y libasound2-dev make sudo make install make install-conf sed -i "s/N0CALL/$CALL/" "$HOME/direwolf.conf" sed -i 's/# ADEVICE plughw:1,0/ADEVICE plughw:1,0/' $HOME/direwolf.conf echo "DIREWOLF installed" >> $BUILDLOG fi if [ $AX25 = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING AX25" echo "##################################################" sleep 2 sudo apt-get install -y ax25-tools echo "wl2k "$CALL" 1200 255 7 Winlink" | sudo tee -a /etc/ax25/axports sudo apt-get install -y ax25-apps echo "AX25 tools installed" >> $BUILDLOG fi if [ $JS8CALL = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING JS8CALL" echo "##################################################" sleep 2 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 $JS8LATE || echo "Can't Download JS8Call" >> $BUILDLOG sudo dpkg -i $JS8PKG sudo apt-get --fix-broken -y install sudo dpkg -i $JS8PKG echo "JS8Call installed" >> $BUILDLOG fi if [ $PULSE = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING PULSE AUDIO" echo "##################################################" sleep 2 sudo apt-get install -y pulseaudio sudo apt-get install -y pavucontrol echo "Pulse audio installed" >> $BUILDLOG fi if [ $M0IAX = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING M0IAX TOOLS" echo "##################################################" sleep 2 pip3 install gps pip3 install maidenhead pip3 install psutil pip3 install OSGridConverter cd $HOME/bin git clone https://github.com/m0iax/JS8CallUtilsGPSD.git chmod +x $HOME/bin/JS8CallUtilsGPSD/gpsdGPSListener.py $HOME/bin/JS8CallUtilsGPSD/js8callutilsGPSD.py mv $HOME/bin/JS8CallUtilsGPSD/* $HOME/bin rm -rf JS8CallUtilsGPSD cat > js8tools.desktop <> $BUILDLOG fi if [ $WSJTX = "yes" ] > /dev/null 2>&1 then echo;echo;echo echo "##################################################" echo "##########INSTALLING WSJTX" echo "##################################################" sleep 2 cd $DIR wget --no-check-certificate https://physics.princeton.edu/pulsar/k1jt/wsjtx_2.1.0_armhf.deb || echo "Can't download WSJTX" >> $BUILDLOG sudo dpkg -i wsjtx_2.1.0_armhf.deb sudo apt-get --fix-broken -y install sudo dpkg -i wsjtx_2.1.0_armhf.deb echo "WSJTX installed" >> $BUILDLOG fi #add virtual sound card link for pulse audio #20191228 cd $DIR cat > tempsound <