pi-build/functions/additional.function

581 wiersze
16 KiB
Plaintext
Czysty Zwykły widok Historia

2020-06-14 14:06:45 +00:00
#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(){
2020-09-12 18:12:49 +00:00
echo "##################"
echo "installing pat"
echo "##################"
2020-06-14 14:06:45 +00:00
PORT=8080
cd $DIR
2020-09-12 11:25:31 +00:00
if [ -f $HOME/.wl2k/config.json ]; then
2020-09-12 18:12:49 +00:00
cp $HOME/.wl2k/config.json $DIR/config.json
2020-09-12 11:25:31 +00:00
fi
2020-09-12 11:10:32 +00:00
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\.//')
2020-09-12 18:12:49 +00:00
echo "new pat v $NEWPATV"
echo "new pat $NEWPAT"
2020-09-12 11:10:32 +00:00
wget --tries 2 --connect-timeout=60 https://github.com/la5nta/pat/releases/download/v0.$NEWPAT/$NEWPATV
sudo dpkg -i $DIR/$NEWPATV
2020-06-14 14:06:45 +00:00
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
2020-08-14 20:43:30 +00:00
WL2KPASS=$(grep "WL2KPASS" $MYPATH/config | sed 's/"//g' | sed 's/WL2KPASS=//')
2020-06-14 14:06:45 +00:00
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
2020-09-12 11:35:32 +00:00
if [ -f $DIR/config.json ]; then
2020-09-12 11:25:31 +00:00
mv $DIR/config.json $HOME/.wl2k/
fi
2020-06-14 14:06:45 +00:00
}
##################################
# PAT MENU
##################################
PAT-MENU(){
2020-08-20 12:00:57 +00:00
#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
2020-06-14 14:06:45 +00:00
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
2020-08-20 12:00:57 +00:00
#restore config files
if [ -d $DIR/patconfig/ ]; then
mv $DIR/patconfig/* $HOME/patmenu2/
fi
2020-06-14 14:06:45 +00:00
}
##################################
# 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
2020-07-10 02:17:19 +00:00
WSJTXSUCCESS=$?
2020-06-14 14:06:45 +00:00
sudo dpkg -i $WSPKG
sudo apt-get --fix-broken -y install
sudo dpkg -i $WSPKG
2020-07-10 02:17:19 +00:00
#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
2020-06-14 14:06:45 +00:00
}
2020-07-10 02:17:19 +00:00
2020-06-14 14:06:45 +00:00
##################################
# 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
2020-10-11 19:49:59 +00:00
touch /var/lib/misc/dnsmasq.leases #conky will fail to load if this file doesn't exist
2020-08-29 13:40:07 +00:00
sudo apt-get install -y ruby2.5
2020-06-14 14:06:45 +00:00
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
2021-01-10 17:18:57 +00:00
#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
2020-07-07 17:13:15 +00:00
#Create files needed for autostart at login
#Fix issue https://github.com/km4ack/pi-build/issues/83
cat <<EOF > $HOME/.local/share/applications/conky.desktop
[Desktop Entry]
Name=Conky
Comment=Conky
GenericName=Conky Screen Background Monitor
Exec=conky
2020-08-17 13:07:36 +00:00
Icon=/home/pi/pi-build/conky/conky-logo.png
2020-07-07 17:13:15 +00:00
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
2020-08-17 12:55:12 +00:00
#####Add setconky to main menu
chmod +x $HOME/pi-build/conky/setconky
cat <<EOF > $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
2020-08-17 13:07:36 +00:00
Icon=/home/pi/pi-build/conky/conky-logo.png
2020-08-17 12:55:12 +00:00
Type=Application
Encoding=UTF-8
Terminal=false
Categories=Settings;DesktopSettings;GTK;X-LXDE-Settings;
Keywords=Radio,Conky
EOF
2020-06-14 14:06:45 +00:00
}
##################################
# M0IAX Tools
##################################
M0IAX(){
2020-08-29 13:56:34 +00:00
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
2020-06-14 14:06:45 +00:00
2020-08-29 14:04:06 +00:00
cat > m0iax.desktop <<EOF
2020-06-14 14:06:45 +00:00
[Desktop Entry]
2020-08-29 13:56:34 +00:00
Name=M0IAX JS8 Utils
GenericName=M0IAX JS8 Utils
2020-06-14 14:06:45 +00:00
Comment=GPS & Message Tool for JS8Call
2020-08-29 13:56:34 +00:00
Exec=JS8CallUtils_v2
2020-06-14 14:06:45 +00:00
Terminal=false
Type=Application
Categories=Network;HamRadio;
EOF
2020-08-29 14:04:06 +00:00
sudo mv m0iax.desktop /usr/share/applications/
2020-06-14 14:06:45 +00:00
}
##################################
# PYQSO
##################################
PYQSO(){
sudo apt-get install -y pyqso
}
##################################
# CQRLOG
##################################
CQRLOG(){
sudo apt-get install -y cqrlog
}
##################################
# CHIRP
##################################
CHIRP(){
cd $DIR
wget --tries 2 --connect-timeout=60 https://trac.chirp.danplanet.com/chirp_daily/LATEST/
CHIRPBUILD=$(cat index.html | grep .tar.gz | grep chirp-daily- | awk '{ print $6 }' | sed 's/.*"//' | sed 's/>//' | 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
2020-08-17 11:50:37 +00:00
pip install future
2020-06-14 14:06:45 +00:00
}
##################################
# 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
2020-09-13 10:57:07 +00:00
DIRR=$(echo $GPKG | sed 's/.tar.gz//')
cd $DIRR
2020-06-14 14:06:45 +00:00
./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
2020-09-12 23:33:06 +00:00
GRIDDLL=$(curl -s https://tagloomis.com/downloads/ | grep Arm | head -1 | sed 's/.*href="//' | sed 's/.gz.*$/.gz/')
2020-06-14 14:06:45 +00:00
wget --tries 2 --connect-timeout=60 $GRIDDLL
GRIDTAR=$(echo $GRIDDLL | sed 's/.*\///g')
tar -xzvf $GRIDTAR
rm *.gz
cat > gridtracker.desktop <<EOF
[Desktop Entry]
Name=GridTracker
Comment=GridTracker
GenericName=GridTracker, a WSJT-X Companion
Exec=$HOME/GridTracker/GridTracker --disable-accelerated-2d-canvas --num-raster-threads=2
Icon=$HOME/GridTracker/gridtracker.png
Path=$HOME/GridTracker
2020-06-14 14:06:45 +00:00
Type=Application
Encoding=UTF-8
Terminal=false
Categories=HamRadio;
EOF
sudo mv gridtracker.desktop /usr/share/applications/
}
##################################
# PROPAGATION
##################################
PROPAGATION(){
sudo apt-get install -y gfortran yelp python3-gi python3-gi-cairo rarian-compat gnome-doc-utils pkg-config python3-dateutil python3-mpltoolkits.basemap python3-cairocffi libgtk-3-dev
#install primary program
cd $HOME/Downloads
wget --tries 2 --connect-timeout=60 https://www.qsl.net/hz1jw/voacapl/downloads/voacapl-0.7.2.tar.gz
tar -xzf voacapl-0.7.2.tar.gz
cd voacapl-0.7.2
./configure
make
sudo make install
#install gui app for propagation reports
cd $HOME/Downloads
wget --tries 2 --connect-timeout=60 https://www.qsl.net/hz1jw/pythonprop/downloads/pythonprop-0.28.tar.gz
tar -xzf pythonprop-0.28.tar.gz
cd pythonprop-0.28
./configure
sudo make install
$HOME/Downloads/voacapl-0.7.2/makeitshfbc
}
##################################
# YAAC
##################################
YAAC(){
cd $DIR
#wget --tries 2 --connect-timeout=60 https://sourceforge.net/projects/yetanotheraprsc/files/YAAC.zip/
wget --tries 2 --connect-timeout=60 https://www.ka2ddo.org/ka2ddo/YAAC.zip
sudo apt-get install -y openjdk-8-jre librxtx-java
mkdir -p $HOME/YAAC
cd $HOME/YAAC
touch YAAC
echo "#!/bin/bash" >> YAAC
echo "java -jar $HOME/YAAC/YAAC.jar" >> YAAC
chmod +x YAAC
cat > yaac.desktop <<EOF
[Desktop Entry]
Name=YAAC
GenericName=YAAC
Comment=APRS Client
Exec=$HOME/YAAC/YAAC
Terminal=false
Type=Application
Categories=Network;HamRadio;
EOF
sudo mv yaac.desktop /usr/share/applications/
unzip $DIR/YAAC.zip
}
##################################
# XASTIR
##################################
XASTIR(){
sudo apt-get install -y xastir
2021-01-10 17:54:13 +00:00
sudo chmod +x /usr/bin/xastir
#sudo sed -i 's/Exec=xastir/Exec=sudo xastir/' /usr/share/applications/xastir.desktop
2020-06-14 14:06:45 +00:00
}
##################################
# KM4ACK EES
##################################
EES(){
#install PHP7.3 if not installed
#this will also install apache2
if ! hash php7.3 2>/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
2020-06-14 14:06:45 +00:00
#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
2020-06-14 14:06:45 +00:00
#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
2020-06-14 14:06:45 +00:00
#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
2020-06-14 14:06:45 +00:00
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 <<EOF
[Desktop Entry]
Name=HamClock
GenericName=Ham Clock
Comment=Ham Clock
Exec=hamclock
Icon=/usr/share/icons/Adwaita/scalable/apps/preferences-system-time-symbolic.svg
Terminal=false
Type=Application
Categories=HamRadio;
EOF
sudo mv $HOME/Downloads/hamclock.desktop /usr/share/applications/
}
##################################
# HamClock Large
##################################
LARGE(){
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-1600x960
sudo chmod +s hamclock-1600x960
sudo mv hamclock-1600x960 /usr/local/bin/hamclock
rm -rf $DIR/ESPHamClock
cat > $HOME/Downloads/hamclock.desktop <<EOF
[Desktop Entry]
Name=HamClock
GenericName=Ham Clock
Comment=Ham Clock
Exec=hamclock
Icon=/usr/share/icons/Adwaita/scalable/apps/preferences-system-time-symbolic.svg
Terminal=false
Type=Application
Categories=HamRadio;
EOF
sudo mv $HOME/Downloads/hamclock.desktop /usr/share/applications/
}
2020-07-08 20:14:58 +00:00
##################################
# Gpredict
##################################
GPREDICT(){
sudo apt install -y gpredict
2020-06-14 14:06:45 +00:00
2020-07-08 20:14:58 +00:00
}
2020-06-14 14:06:45 +00:00
2020-08-17 18:23:06 +00:00
##################################
# TQSL
##################################
TQSL(){
sudo apt install -y cmake g++ libexpat1-dev libssl-dev libdb++-dev libcurl4-openssl-dev libwxgtk3.0-dev
2020-08-20 14:15:58 +00:00
cd $HOME
CUR=$(curl -s http://www.arrl.org/tqsl-download | grep "for Linux" | sed 's/.*TQSL //' | awk '{print $1}')
wget http://www.arrl.org/tqsl/tqsl-$CUR.tar.gz
tar -xzvf tqsl-$CUR.tar.gz
rm tqsl-$CUR.tar.gz
cd tqsl-$CUR
2020-08-17 18:23:06 +00:00
cmake .
make
sudo make install
2020-08-20 14:15:58 +00:00
sudo cp /home/pi/tqsl-$CUR/apps/tqsl.desktop /usr/share/applications/
rm -rf $HOME/tqsl-$CUR
2020-08-17 18:23:06 +00:00
}
2020-06-14 14:06:45 +00:00
2020-08-21 22:47:31 +00:00
##################################
# XLOG
##################################
XLOG(){
2020-08-22 22:09:33 +00:00
#verify hamlib installed
if ! hash rigctld 2>/dev/null; then
cat <<EOF > $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
2020-08-21 22:47:31 +00:00
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
2020-06-14 14:06:45 +00:00
2020-08-21 22:47:31 +00:00
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
2020-08-22 22:09:33 +00:00
fi
2020-08-21 22:47:31 +00:00
}
2020-06-14 14:06:45 +00:00
2020-08-21 23:17:18 +00:00
##################################
# JTDX
##################################
2020-10-14 23:14:10 +00:00
#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
2020-08-21 23:17:18 +00:00
JTDX(){
cd $HOME
#curl won't work here. Returns "forbidden" Use wget instead
2020-08-22 16:04:23 +00:00
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
2020-08-21 23:17:18 +00:00
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
}
2020-06-14 14:06:45 +00:00