2020-06-14 14:06:04 +00:00
|
|
|
##################################################################
|
|
|
|
# #
|
|
|
|
# # # # # # # ##### # # #
|
|
|
|
# # # # # # # ## # # # # # #
|
|
|
|
# # # # # # # # # # # # # #
|
|
|
|
# ## # # ##### ####### # ## #
|
|
|
|
# # # # # # # # # # # #
|
|
|
|
# # # # # # # # # # # #
|
|
|
|
# # # # # # # # ##### # # #
|
|
|
|
# #
|
|
|
|
##################################################################
|
2020-06-20 12:00:37 +00:00
|
|
|
#20200620
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2020-02-24 12:11:05 +00:00
|
|
|
DESK=$(printenv | grep DISPLAY)
|
2021-03-16 16:39:25 +00:00
|
|
|
MYPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
|
|
LOGO=${MYPATH}/logo.png
|
|
|
|
RB=${HOME}/.config/KM4ACK
|
|
|
|
BASE=${MYPATH}/base.txt
|
|
|
|
ADDITIONAL=${MYPATH}/additional.txt
|
|
|
|
UTILITY=${MYPATH}/utility.txt
|
|
|
|
FLSUITE=${MYPATH}/flsuite.txt
|
|
|
|
CONFIG=${MYPATH}/config
|
|
|
|
FUNCTIONS=${MYPATH}/functions
|
|
|
|
TEMPCRON=${MYPATH}/cron.tmp
|
|
|
|
DIR=${MYPATH}/temp
|
2020-06-14 14:06:04 +00:00
|
|
|
WHO=$(whoami)
|
2021-03-16 16:39:25 +00:00
|
|
|
VERSION=$(grep "version=" ${MYPATH}/changelog | sed 's/version=//')
|
2021-10-11 13:27:11 +00:00
|
|
|
DATE=$(date)
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
FINISH() {
|
|
|
|
if [ -f "${BASE}" ]; then
|
|
|
|
rm ${BASE}
|
|
|
|
fi
|
2020-02-20 13:21:41 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ -f "${ADDITIONAL}" ]; then
|
|
|
|
rm ${ADDITIONAL}
|
|
|
|
fi
|
2020-02-20 13:21:41 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ -f "${FLSUITE}" ]; then
|
|
|
|
rm ${FLSUITE}
|
|
|
|
fi
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ -f "${UTILITY}" ]; then
|
|
|
|
rm ${UTILITY}
|
|
|
|
fi
|
2020-06-14 14:06:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
trap FINISH EXIT
|
2019-12-26 23:52:35 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#check for display. can't run from SSH
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ -z "$DESK" ]; then
|
|
|
|
cat <<EOF
|
2020-06-14 14:06:04 +00:00
|
|
|
This script cannot be run from an SSH session.
|
|
|
|
Please boot into the pi's desktop environment,
|
|
|
|
open the terminal, and run this script again
|
2020-02-20 13:21:41 +00:00
|
|
|
EOF
|
2021-03-16 16:39:25 +00:00
|
|
|
exit 0
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-18 14:47:14 +00:00
|
|
|
#####################################
|
2022-01-06 21:46:21 +00:00
|
|
|
# Verify not run as root
|
|
|
|
#####################################
|
|
|
|
if [ "$WHO" = 'root' ]; then
|
|
|
|
yad --form --width=500 --text-align=center --center --title="Build-a-Pi" --text-align=center \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>ROOT DETECTED</b>\rDon't run this script as root. \
|
|
|
|
Restart the script without sudo" \
|
|
|
|
--button=gtk-close
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#####################################
|
2021-11-18 14:47:14 +00:00
|
|
|
# Old OS Check
|
|
|
|
#####################################
|
|
|
|
V_ID=$(grep VERSION_ID /etc/os-release | sed 's/VERSION_ID="//;s/"//')
|
|
|
|
|
|
|
|
if [ "$V_ID" -le 10 ]; then
|
|
|
|
NOTICEPATH=/run/user/$UID
|
|
|
|
|
|
|
|
cat <<EOF >${NOTICEPATH}/intro.txt
|
|
|
|
Build a Pi 3.2.0 and later does not support
|
|
|
|
RaspiOS Buster or earlier versions of RaspiOS.
|
|
|
|
You should consider upgrading to RaspiOS 11
|
|
|
|
(Bullseye). By clicking ok you will be moved
|
|
|
|
to the last version of Build a Pi (3.1.4) that
|
|
|
|
supports Pi OS Buster. Please note there are
|
|
|
|
no plans to update Build a Pi for Buster going
|
|
|
|
forward. In other words, you are on your own
|
|
|
|
if it is broke and you are still running Pi OS
|
|
|
|
10 (Buster).
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
INTRO=$(yad --width=600 --height=300 --text-align=center --center --title="Out of Date OS Detected!" --show-uri \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text-info \
|
|
|
|
--button="OK":1 <${NOTICEPATH}/intro.txt \
|
|
|
|
--button="Exit":2 \
|
|
|
|
>/dev/null 2>&1)
|
|
|
|
BUT=$?
|
|
|
|
echo $BUT
|
|
|
|
if [ $BUT = 2 ] || [ $BUT = 252 ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
rm ${NOTICEPATH}/intro.txt
|
|
|
|
cd $HOME/pi-build
|
|
|
|
git checkout buster
|
|
|
|
bash build-a-pi & exit
|
2021-11-18 14:51:02 +00:00
|
|
|
fi
|
2021-11-18 14:47:14 +00:00
|
|
|
|
|
|
|
#####################################
|
|
|
|
# end Old OS Check
|
|
|
|
#####################################
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#install YAD & jq as needed
|
2021-03-16 16:39:25 +00:00
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo
|
2020-06-14 14:06:04 +00:00
|
|
|
echo "#######################################"
|
|
|
|
echo "# Updating repository & installing #"
|
|
|
|
echo "# a few needed items before we begin #"
|
|
|
|
echo "#######################################"
|
2019-12-24 20:57:51 +00:00
|
|
|
sudo apt-get update
|
2021-03-16 16:39:25 +00:00
|
|
|
if ! hash yad 2>/dev/null; then
|
2019-12-24 20:57:51 +00:00
|
|
|
sudo apt install -y yad
|
2021-03-16 16:39:25 +00:00
|
|
|
fi
|
|
|
|
if ! hash jq 2>/dev/null; then
|
2019-12-30 16:44:49 +00:00
|
|
|
sudo apt install -y jq
|
2021-03-16 16:39:25 +00:00
|
|
|
fi
|
|
|
|
if ! hash bc >/dev/null; then
|
2020-09-12 11:10:03 +00:00
|
|
|
sudo apt install -y bc
|
2021-03-16 16:39:25 +00:00
|
|
|
fi
|
2022-01-07 18:29:29 +00:00
|
|
|
#an issue pops up every now and again concerning xterm.
|
|
|
|
#link lxterminal to xterm. see https://github.com/km4ack/pi-build/issues/34
|
|
|
|
sudo ln -s /usr/bin/lxterminal /usr/bin/xterm
|
2019-12-30 16:44:49 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Check if run before
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ -f "${RB}" ]; then
|
|
|
|
bash ${MYPATH}/update &
|
|
|
|
exit
|
2020-02-20 13:21:41 +00:00
|
|
|
fi
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Check user is pi
|
|
|
|
#####################################
|
2022-04-12 13:32:19 +00:00
|
|
|
#This section commented out 12APRIL2022 for testing. Should be removed once testing is complete.
|
|
|
|
#if [ "$WHO" != 'pi' ]; then
|
|
|
|
# yad --form --width=500 --text-align=center --center --title="Build-a-Pi" --text-align=center \
|
|
|
|
# --image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
# --text="<b>USER NAME IS NOT PI</b>\rThis script is designed to be run as the pi user. Please set the user name to pi \
|
|
|
|
#and try again. You can change the user name after the build is complete but some configuration may not work \
|
|
|
|
#as expected" \
|
|
|
|
# --button=gtk-close
|
|
|
|
# exit 1
|
|
|
|
#fi
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# notice to user
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
cat <<EOF >${MYPATH}/intro.txt
|
2020-06-14 14:06:04 +00:00
|
|
|
This script takes approximately 4 hours to complete
|
|
|
|
if you choose to install everything. If you find it
|
|
|
|
helpful please consider a donation to encourage future
|
|
|
|
development.
|
|
|
|
|
|
|
|
https://paypal.me/km4ack
|
|
|
|
EOF
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
INTRO=$(yad --width=550 --height=250 --text-align=center --center --title="Build-a-Pi" --show-uri \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text-info \
|
|
|
|
--button="Continue":2 <${MYPATH}/intro.txt \
|
|
|
|
>/dev/null 2>&1)
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$?
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 252 ]; then
|
|
|
|
rm ${MYPATH}/intro.txt
|
|
|
|
exit
|
2020-02-21 15:34:17 +00:00
|
|
|
fi
|
2021-03-16 16:39:25 +00:00
|
|
|
rm ${MYPATH}/intro.txt
|
2020-07-07 17:12:34 +00:00
|
|
|
#####################################
|
|
|
|
# Create autostart dir
|
|
|
|
#used to autostart conky at boot
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
mkdir -p ${HOME}/.config/autostart
|
2020-07-07 17:12:34 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Get User Call
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
CALL() {
|
|
|
|
INFO=$(yad --form --width=420 --text-align=center --center --title="Build-a-Pi" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>version $VERSION</b>" \
|
|
|
|
--field="Call Sign*" \
|
|
|
|
--field="<b>* Required</b>":LBL \
|
|
|
|
--button="Continue":2)
|
|
|
|
BUT=$?
|
|
|
|
if [ ${BUT} = 252 ]; then
|
|
|
|
exit
|
|
|
|
fi
|
2020-06-14 14:06:04 +00:00
|
|
|
}
|
|
|
|
CALL
|
2021-03-16 16:39:25 +00:00
|
|
|
CALL=$(echo ${INFO} | awk -F "|" '{print $1}')
|
2020-06-14 14:06:04 +00:00
|
|
|
CALL=${CALL^^}
|
|
|
|
|
|
|
|
#Verify call not empty
|
2020-07-16 13:53:33 +00:00
|
|
|
ATTEMPTS=0
|
2021-03-16 16:39:25 +00:00
|
|
|
while [ -z "$CALL" ]; do
|
|
|
|
if [ $ATTEMPTS -eq 3 ]; then
|
2020-07-16 13:53:33 +00:00
|
|
|
yad --form --width=420 --text-align=center --center --title="Build-a-Pi" --text-align=center \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>Empty callsign after 3 attempts. Quiting!</b>" \
|
|
|
|
--button=gtk-ok
|
2020-07-16 13:53:33 +00:00
|
|
|
exit
|
|
|
|
fi
|
2020-02-29 17:34:38 +00:00
|
|
|
|
2020-07-16 13:53:33 +00:00
|
|
|
yad --form --width=420 --text-align=center --center --title="Build-a-Pi" --text-align=center \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>Call Can't be Blank</b>" \
|
|
|
|
--button=gtk-ok
|
2020-07-16 13:53:33 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
((ATTEMPTS = ATTEMPTS + 1))
|
2020-07-16 13:53:33 +00:00
|
|
|
CALL
|
2021-03-16 16:39:25 +00:00
|
|
|
CALL=$(echo ${INFO} | awk -F "|" '{print $1}')
|
2020-07-16 13:53:33 +00:00
|
|
|
CALL=${CALL^^}
|
|
|
|
done
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "CALL=$CALL" >${CONFIG}
|
2020-02-29 17:34:38 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Base Apps
|
|
|
|
#####################################
|
|
|
|
yad --center --list --checklist --width=600 --height=600 --separator="" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --column=Check --column=App --column=Description \
|
|
|
|
--print-column=2 --window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>Base Applications</b>" --title="Build-a-Pi" \
|
|
|
|
false "HOTSPOT" "Hot Spot Generator for Portable Ops" \
|
|
|
|
false "HSTOOLS" "Tools to Manage Hot Spot" \
|
|
|
|
false "GPS" "GPS Software" \
|
2021-04-04 21:05:28 +00:00
|
|
|
false "GPSUPDATE" "Tool to Manage GPS Devices" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "ARDOP" "Modem for HF" \
|
|
|
|
false "ARDOPGUI" "GUI for ARDOP" \
|
2022-10-14 15:50:54 +00:00
|
|
|
false "VARA" "VARA Modem - <b>Pi 4 Required</b>" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "HAMLIB" "Needed for Rig Control" \
|
|
|
|
false "DIREWOLF" "Software TNC" \
|
|
|
|
false "AX25" "Data Link Layer Protocol" \
|
|
|
|
false "PULSE" "Pulse Audio Control Interface" \
|
|
|
|
--button="Exit":1 \
|
|
|
|
--button="Check All and Continue":3 \
|
|
|
|
--button="Next":2 >${BASE}
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$?
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
2020-02-20 13:21:41 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 3 ]; then
|
2022-08-26 14:14:08 +00:00
|
|
|
BASEAPPS=(HOTSPOT HSTOOLS GPS ARDOP ARDOPGUI VARA HAMLIB DIREWOLF AX25 PULSE GPSUPDATE)
|
2021-03-16 16:39:25 +00:00
|
|
|
for i in "${BASEAPPS[@]}"; do
|
|
|
|
echo "$i" >>${BASE}
|
|
|
|
done
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2022-10-14 13:33:57 +00:00
|
|
|
#If VARA is chosen, make sure we have a Pi 4 32 bit system to work with.
|
2022-10-02 16:14:14 +00:00
|
|
|
#As of 02OCT2022 the VARA installer only works with the Pi 4.
|
|
|
|
VARA_CHK=$(grep VARA ${BASE})
|
|
|
|
if [ -n $VARA_CHK ]; then
|
|
|
|
FREEMEM=$(free -m | grep Mem: | awk '{ print $2 }')
|
2022-10-04 21:28:17 +00:00
|
|
|
if [ $FREEMEM -lt 1500 ]; then
|
2022-10-02 16:14:14 +00:00
|
|
|
echo "Not enough memory available"
|
|
|
|
yad --form --width=500 --text-align=center --center --title="Build-a-Pi" --text-align=center \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>Not enough memory</b>\rVARA requires a Pi 4.\r\rVARA will not be installed during the build." \
|
|
|
|
--button=gtk-ok
|
|
|
|
sed -i 's/VARA//;/^$/d' ${BASE}
|
|
|
|
fi
|
2022-10-07 12:47:32 +00:00
|
|
|
|
2022-10-02 16:14:14 +00:00
|
|
|
fi
|
|
|
|
|
2020-07-16 13:53:33 +00:00
|
|
|
#check if hotspot is chosen for install & get info if needed
|
2021-03-16 16:39:25 +00:00
|
|
|
HS=$(grep "HOTSPOT" ${BASE})
|
2020-06-14 14:06:04 +00:00
|
|
|
if [ -n "$HS" ]; then
|
2021-03-16 16:39:25 +00:00
|
|
|
HSINFO() {
|
|
|
|
#unblock wifi
|
|
|
|
sudo rfkill unblock all >/dev/null 2>&1
|
|
|
|
#bring wifi up
|
|
|
|
sudo ifconfig wlan0 up
|
|
|
|
#LIST=$(sudo iw dev "wlan0" scan ap-force | egrep "^BSS|SSID:" | grep SSID: | sed 's/SSID://' | awk '{ print $1 }')
|
|
|
|
#LIST=$(echo $LIST | sed 's/ /|/g')
|
|
|
|
LIST=$(sudo iw dev "wlan0" scan ap-force | sed -ne 's/^.*SSID: \(..*\)/\1/p' | sort | uniq | paste -sd '|')
|
|
|
|
|
|
|
|
HSINFO=$(yad --center --form --width=400 --height=400 --separator="|" --item-separator="|" \
|
|
|
|
--image ${LOGO} --column=Check --column=App --column=Description \
|
|
|
|
--window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>HotSpot Information\r\rPlease enter the information\rbelow \
|
2020-06-14 14:06:04 +00:00
|
|
|
for the Hot Spot\r</b>NOTE: The last field is the password for the hotspot. You will use this password to \
|
|
|
|
connect to your Pi when it is in hotspot mode <b>This password can only contain letters and numbers</b>" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--title="Build-a-Pi" \
|
|
|
|
--field="Home Wifi SSID":CB "$LIST" \
|
|
|
|
--field="Home Wifi Password" \
|
|
|
|
--field="Hot Spot Password" \
|
|
|
|
--button="Exit":1 \
|
|
|
|
--button="Continue":2 \
|
|
|
|
--button="Refresh Wifi":3)
|
|
|
|
BUT=$?
|
|
|
|
if [ ${BUT} = 3 ]; then
|
|
|
|
HSINFO #Call HSINFO function
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
#}
|
|
|
|
#HSINFO
|
|
|
|
#fi
|
|
|
|
SHACKSSID=$(echo $HSINFO | awk -F "|" '{print $1}')
|
|
|
|
SHACKPASS=$(echo $HSINFO | awk -F "|" '{print $2}')
|
|
|
|
HSPASS=$(echo $HSINFO | awk -F "|" '{print $3}')
|
|
|
|
|
|
|
|
#Check password length
|
|
|
|
if [ -n "$HS" ]; then
|
|
|
|
COUNT=${#HSPASS}
|
|
|
|
if [ ${COUNT} -lt 8 ]; then
|
|
|
|
yad --center --form --width=300 --height=200 --separator="|" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>Hotspot password has to be 8-63 characters</b>" --title="Build-a-Pi" \
|
|
|
|
--button=gtk-ok
|
|
|
|
HSINFO
|
|
|
|
fi
|
|
|
|
fi
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
}
|
2020-06-14 14:06:04 +00:00
|
|
|
HSINFO
|
2020-01-04 00:17:03 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "SHACKSSID=$SHACKSSID" >>${CONFIG}
|
|
|
|
echo "SHACKPASS=\"$SHACKPASS\"" >>${CONFIG}
|
|
|
|
echo "HSPASS=\"$HSPASS\"" >>${CONFIG}
|
2020-07-07 11:55:05 +00:00
|
|
|
###################################
|
|
|
|
#CHECK IF GPS IS CHOSEN TO INSTALL#
|
|
|
|
###################################
|
2021-03-16 16:39:25 +00:00
|
|
|
GPSINSTALL=$(cat ${BASE} | grep GPS)
|
2021-04-02 21:59:27 +00:00
|
|
|
if [ -n "${GPSINSTALL}" ]; then
|
2020-09-09 13:48:48 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
yad --center --height="300" --width="300" --form --separator="|" --item-separator="|" --title="GPS" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top \
|
|
|
|
--text="\r\r\r\r\r<b><big>Connect your GPS to the pi</big></b>" \
|
|
|
|
--button="Continue":2
|
2020-07-07 11:55:05 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
BUT=$?
|
2021-10-12 14:18:40 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
USB=$(ls /dev/serial/by-id)
|
2021-10-12 00:47:51 +00:00
|
|
|
USB=$(echo "NONE $USB") #see https://github.com/km4ack/pi-build/issues/293
|
2021-03-16 16:39:25 +00:00
|
|
|
USB=$(echo $USB | sed "s/\s/|/g")
|
|
|
|
|
|
|
|
GPS=$(yad --center --height="600" --width="300" --form --separator="|" --item-separator="|" --title="GPS" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top \
|
|
|
|
--text="Choose Your GPS" \
|
|
|
|
--field="GPS":CB "$USB")
|
|
|
|
BUT=$?
|
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
echo exiting
|
|
|
|
exit
|
|
|
|
fi
|
2020-07-07 11:55:05 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
GPS=$(echo ${GPS} | awk -F "|" '{print $1}')
|
|
|
|
GPS=/dev/serial/by-id/${GPS}
|
|
|
|
echo "GPS=${GPS}" >>${CONFIG}
|
2020-07-07 11:55:05 +00:00
|
|
|
fi
|
2020-06-14 14:06:04 +00:00
|
|
|
|
|
|
|
#####################################
|
|
|
|
# FLSUITE
|
|
|
|
#####################################
|
|
|
|
yad --center --list --checklist --width=600 --height=600 --separator="" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --column=Check --column=App --column=Description \
|
|
|
|
--print-column=2 --window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>FLDIGI Suite</b>" --title="Build-a-Pi" \
|
|
|
|
false "FLRIG" "Rig Contol GUI" \
|
|
|
|
false "FLDIGI" "Digital Software" \
|
|
|
|
false "FLAMP" "File Transfer Program" \
|
|
|
|
false "FLNET" "Net Control Software" \
|
|
|
|
false "FLMSG" "Forms Manager" \
|
|
|
|
false "FLWRAP" "File Encapsulation" \
|
|
|
|
--button="Exit":1 \
|
|
|
|
--button="Check All and Continue":3 \
|
|
|
|
--button="Next":2 >${FLSUITE}
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$?
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 3 ]; then
|
|
|
|
FLAPPS=(FLRIG FLDIGI FLAMP FLNET FLMSG FLWRAP)
|
|
|
|
for i in "${FLAPPS[@]}"; do
|
|
|
|
echo "$i" >>${FLSUITE}
|
|
|
|
done
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Ham Apps
|
|
|
|
#####################################
|
|
|
|
yad --center --list --checklist --width=600 --height=600 --separator="" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --column=Check --column=App --column=Description \
|
|
|
|
--print-column=2 --window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>Ham Applications</b>" --title="Build-a-Pi" \
|
|
|
|
false "CONKY" "System Information Display" \
|
|
|
|
false "PI-APRS" "APRS Message Application" \
|
|
|
|
false "CHIRP" "Program Radios" \
|
|
|
|
false "GARIM" "File Transfer Program" \
|
|
|
|
false "PAT" "Radio Email Application" \
|
|
|
|
false "PAT-MENU" "Control for Pat Winlink" \
|
|
|
|
false "JS8CALL" "Weak Signal Digital Mode Software" \
|
|
|
|
false "M0IAX" "Tools for JS8Call Messages" \
|
|
|
|
false "WSJTX" "Weak Signal Digital Mode Software" \
|
|
|
|
false "PYQSO" "Logging Software" \
|
2021-07-06 13:00:28 +00:00
|
|
|
false "HAMRS" "Logging Software" \
|
2022-06-08 12:28:51 +00:00
|
|
|
false "CQRLOG" "Logging Software" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "EES" "KM4ACK Emergency Email Server" \
|
|
|
|
false "QSSTV" "Slow Scan TV" \
|
|
|
|
false "GRIDTRACKER" "Track Grids in WSJTX" \
|
|
|
|
false "HAMCLOCK" "Clock for Ham Radio Ops" \
|
|
|
|
false "PROPAGATION" "Propagation Prediction Software" \
|
|
|
|
false "YAAC" "Yet Another APRS Client" \
|
|
|
|
false "XASTIR" "APRS Client" \
|
|
|
|
false "GPREDICT" "Satellite Tracking" \
|
|
|
|
false "TQSL" "LOTW Software" \
|
2021-04-02 21:18:12 +00:00
|
|
|
false "GRIDCALC" "Grid Calculation Software" \
|
2022-08-26 16:20:38 +00:00
|
|
|
false "REPEAT" "Repeater Directory" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--button="Exit":1 \
|
|
|
|
--button="Check All and Continue":3 \
|
|
|
|
--button="Next":2 >${ADDITIONAL}
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$?
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 3 ]; then
|
|
|
|
ADDAPPS=(CONKY PI-APRS CHIRP GARIM PAT PAT-MENU JS8CALL M0IAX WSJTX PYQSO
|
2021-11-18 20:03:57 +00:00
|
|
|
HAMRS EES QSSTV GRIDTRACKER HAMCLOCK PROPAGATION YAAC XASTIR GPREDICT TQSL
|
2022-08-26 16:20:38 +00:00
|
|
|
GRIDCALC CQRLOG REPEAT)
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
for i in "${ADDAPPS[@]}"; do
|
|
|
|
echo "$i" >>${ADDITIONAL}
|
|
|
|
done
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#check if hamclock is being installed
|
2021-03-16 16:39:25 +00:00
|
|
|
HCCHECK=$(grep "HAMCLOCK" ${ADDITIONAL})
|
2020-06-14 14:06:04 +00:00
|
|
|
if [ -n "$HCCHECK" ]; then
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
HC=$(yad --form --width=420 --text-align=center --center --title="Build-a-Pi" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>version $VERSION</b>" \
|
|
|
|
--field="Ham Clock Size":CB "SMALL|LARGE" \
|
|
|
|
--button="Continue":2)
|
|
|
|
HC=$(echo $HC | awk -F "|" '{print $1}')
|
|
|
|
sed -i 's/HAMCLOCK//' ${ADDITIONAL}
|
|
|
|
echo $HC >>${ADDITIONAL}
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
2021-04-02 23:33:30 +00:00
|
|
|
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
PATCHECK=$(grep "PAT" ${ADDITIONAL})
|
2020-06-14 14:06:04 +00:00
|
|
|
if [ -n "$PATCHECK" ]; then
|
2021-03-16 16:39:25 +00:00
|
|
|
INFO=$(yad --form --width=420 --text-align=center --center --title="Build-a-Pi" \
|
|
|
|
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
|
|
|
--text="<b>version $VERSION</b>" \
|
|
|
|
--field="Six Character Grid Square" \
|
|
|
|
--field="Winlink Password" \
|
|
|
|
--field="<b>Password is case sensitive</b>":LBL \
|
|
|
|
--button="Continue":2)
|
|
|
|
GRID=$(echo ${INFO} | awk -F "|" '{print $1}')
|
|
|
|
GRID=${GRID^^}
|
|
|
|
WL2KPASS=$(echo ${INFO} | awk -F "|" '{print $2}')
|
|
|
|
echo "GRID=$GRID" >>${CONFIG}
|
|
|
|
echo "WL2KPASS=\"$WL2KPASS\"" >>${CONFIG}
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Utilities
|
|
|
|
#####################################
|
|
|
|
yad --center --list --checklist --width=600 --height=600 --separator="" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--image ${LOGO} --column=Check --column=App --column=Description \
|
|
|
|
--print-column=2 --window-icon=${LOGO} --image-on-top --text-align=center \
|
|
|
|
--text="<b>Utilities</b>" --title="Build-a-Pi" \
|
|
|
|
false "DIPOLE" "Dipole Calculator" \
|
2021-07-07 13:14:32 +00:00
|
|
|
false "PACKETSEARCH" "Winlink Packet Tool" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "CALLSIGN" "Call sign lookup" \
|
|
|
|
false "TEMPCONVERT" "Temperature Converter" \
|
2022-10-17 04:16:36 +00:00
|
|
|
false "HDOCS" "Reference Materials PDFs" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "GPARTED" "Disk Utility Tool" \
|
|
|
|
false "SHOWLOG" "Log file viewer" \
|
|
|
|
false "PISTATS" "Pi3/4 Stats Monitor" \
|
|
|
|
false "TELNET" "Telnet Protocol" \
|
|
|
|
false "PITERM" "piQtTermTCP Terminal Program" \
|
2021-07-09 15:22:25 +00:00
|
|
|
false "QTSOUND" "piQtSoundModem" \
|
2021-03-16 16:39:25 +00:00
|
|
|
false "SECURITY" "File Encryption Software" \
|
|
|
|
false "YGATE" "Yaesu APRS Software" \
|
|
|
|
false "BPQ" "LinBPQ Software" \
|
|
|
|
false "BATT" "Battery Test Script" \
|
|
|
|
false "VNC" "VNC Client Application" \
|
2021-11-18 20:16:56 +00:00
|
|
|
false "XYGRIB" "Grib File Viewer" \
|
2021-03-16 16:39:25 +00:00
|
|
|
--button="Exit":1 \
|
|
|
|
--button="Check All and Continue":3 \
|
|
|
|
--button="Install Selected":2 >${UTILITY}
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$?
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 252 ] || [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 3 ]; then
|
2022-10-17 04:11:31 +00:00
|
|
|
UTILAPPS=(DIPOLE PACKETSEARCH CALLSIGN TEMPCONVERT HDOCS GPARTED SHOWLOG PISTATS TELNET PITERM QTSOUND SECURITY YGATE BPQ BATT VNC XYGRIB)
|
2021-03-16 16:39:25 +00:00
|
|
|
for i in "${UTILAPPS[@]}"; do
|
|
|
|
echo "$i" >>${UTILITY}
|
|
|
|
done
|
2019-12-24 20:57:51 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#backup crontab
|
|
|
|
crontab -l >$TEMPCRON
|
|
|
|
echo "@reboot sleep 10 && export DISPLAY=:0 && ${MYPATH}/.complete" >>$TEMPCRON
|
|
|
|
${MYPATH}/.funfacts &
|
2020-06-14 14:06:04 +00:00
|
|
|
#upgrade the system
|
2020-07-10 02:16:46 +00:00
|
|
|
sudo apt-get -y upgrade
|
2020-06-14 14:06:04 +00:00
|
|
|
sudo apt -y full-upgrade
|
2020-01-01 00:13:39 +00:00
|
|
|
|
2021-07-05 22:02:38 +00:00
|
|
|
#fix issue 254 05JULY2021
|
|
|
|
sudo sed -i 's/#hdmi_force_hotplug=1/hdmi_force_hotplug=1/' config.txt
|
|
|
|
|
2020-06-15 11:38:43 +00:00
|
|
|
#set wallpaper
|
2021-01-10 17:58:05 +00:00
|
|
|
#fix issue 193
|
2021-04-02 20:42:53 +00:00
|
|
|
sudo cp $HOME/pi-build/bap-wallpaper.jpg /usr/share/rpd-wallpaper/
|
2021-01-10 17:56:17 +00:00
|
|
|
pcmanfm --set-wallpaper /usr/share/rpd-wallpaper/bap-wallpaper.jpg
|
2020-06-15 11:38:43 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
mkdir -p ${DIR} 2>/dev/null
|
2020-06-27 16:47:12 +00:00
|
|
|
|
2019-12-30 00:33:53 +00:00
|
|
|
#add virtual sound card link for pulse audio
|
2021-03-17 14:36:15 +00:00
|
|
|
cd ${DIR} || ! echo "Failure"
|
2021-03-16 16:39:25 +00:00
|
|
|
cat >tempsound <<EOF
|
2019-12-30 00:33:53 +00:00
|
|
|
pcm.pulse {
|
|
|
|
type pulse
|
|
|
|
}
|
|
|
|
ctl.pulse {
|
|
|
|
type pulse
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
sudo chown root:root tempsound
|
|
|
|
sudo mv tempsound /etc/asound.conf
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#mod sound card for Buster May 2020
|
2020-06-14 14:06:04 +00:00
|
|
|
#so it will always load as card #2
|
2021-03-17 14:36:15 +00:00
|
|
|
cd ${DIR} || ! echo "Failure"
|
2021-03-16 16:39:25 +00:00
|
|
|
cat >tempsound <<EOF
|
2020-06-14 14:06:04 +00:00
|
|
|
#Internal sound
|
2021-03-16 16:39:25 +00:00
|
|
|
options snd-bcm2835 index=0
|
2020-06-14 14:06:04 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#USB soundcard
|
2021-11-15 15:41:33 +00:00
|
|
|
options snd-usb-audio index=3
|
2020-06-14 14:06:04 +00:00
|
|
|
EOF
|
|
|
|
sudo chown root:root tempsound
|
|
|
|
sudo mv tempsound /etc/modprobe.d/alsa.conf
|
|
|
|
|
|
|
|
#install ham radio menu
|
2020-02-20 13:21:41 +00:00
|
|
|
sudo apt-get install -y extra-xdg-menus
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#setup bin dir and put in path
|
2021-03-16 16:39:25 +00:00
|
|
|
mkdir -p ${HOME}/bin
|
|
|
|
echo "export PATH=$PATH:${HOME}/bin" >>${HOME}/.bashrc
|
2020-02-20 13:21:41 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#set update script to exec
|
2021-03-16 16:39:25 +00:00
|
|
|
chmod +x ${MYPATH}/update ${MYPATH}/build-a-pi
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#create build-a-pi menu item
|
2021-03-17 14:36:15 +00:00
|
|
|
cd ${MYPATH} || ! echo "Failure"
|
2021-03-16 16:39:25 +00:00
|
|
|
cat >build-a-pi.desktop <<EOF
|
2020-06-14 14:06:04 +00:00
|
|
|
[Desktop Entry]
|
|
|
|
Name=Build-a-Pi
|
|
|
|
GenericName=KM4ACK Build-a-Pi
|
|
|
|
Comment=Build-a-Pi App Manager
|
2021-03-16 16:39:25 +00:00
|
|
|
Exec=${MYPATH}/update
|
|
|
|
Icon=${MYPATH}/logo.png
|
2020-06-14 14:06:04 +00:00
|
|
|
Terminal=true
|
|
|
|
Type=Application
|
|
|
|
Categories=Settings;DesktopSettings;GTK;X-LXDE-Settings;
|
|
|
|
EOF
|
2020-02-20 13:21:41 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
sudo mv build-a-pi.desktop /usr/share/applications/
|
|
|
|
|
2022-01-07 22:53:11 +00:00
|
|
|
#create repair-bap tool
|
|
|
|
cat <<EOF > /run/user/$UID/repair-bap
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ! -f $HOME/pi-build/update ]; then
|
|
|
|
echo "################################"
|
|
|
|
echo "# BAP update tool not found. #"
|
|
|
|
echo "# Repairing, please stand by #"
|
|
|
|
echo "################################"
|
|
|
|
cd $HOME
|
|
|
|
git clone https://github.com/km4ack/pi-build.git || echo "Could not connect to Github. Check your internet and try again"
|
|
|
|
echo "Repair complete. Run the Build a Pi update tool using the shortcut in the Pi menu"
|
|
|
|
else
|
|
|
|
clear;echo;echo
|
|
|
|
echo "Update tool is present on the system."
|
|
|
|
fi
|
|
|
|
EOF
|
|
|
|
chmod +x /run/user/$UID/repair-bap
|
|
|
|
sudo mv /run/user/$UID/repair-bap /usr/local/bin/
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Install Base Apps
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
touch ${RB}
|
2021-10-11 16:48:10 +00:00
|
|
|
echo "INITIAL=\"build date $DATE version $VERSION\"" >> ${RB}
|
2021-03-16 16:39:25 +00:00
|
|
|
source ${FUNCTIONS}/base.function
|
|
|
|
while read i; do
|
|
|
|
$i
|
|
|
|
done <${BASE}
|
2020-06-14 14:06:04 +00:00
|
|
|
|
|
|
|
#####################################
|
|
|
|
# Install FLSUITE
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
source ${FUNCTIONS}/flsuite.function
|
2020-06-14 14:06:04 +00:00
|
|
|
#perform memory increase if needed
|
2021-03-16 16:39:25 +00:00
|
|
|
CHECKFL="${MYPATH}/flsuite.txt"
|
2020-07-16 13:53:33 +00:00
|
|
|
if [ -s "$CHECKFL" ]; then
|
2021-03-16 16:39:25 +00:00
|
|
|
FLSTART
|
2020-06-14 14:06:04 +00:00
|
|
|
fi
|
2021-03-16 16:39:25 +00:00
|
|
|
touch ${RB}
|
|
|
|
while read i; do
|
|
|
|
$i
|
|
|
|
done <${FLSUITE}
|
2020-06-14 14:06:04 +00:00
|
|
|
|
|
|
|
#Perform memory reset if needed
|
2020-07-16 13:53:33 +00:00
|
|
|
if [ -s "$CHECKFL" ]; then
|
2021-03-16 16:39:25 +00:00
|
|
|
FLSTOP
|
2020-06-14 14:06:04 +00:00
|
|
|
fi
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Install ADDITIONAL Apps
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
source ${FUNCTIONS}/additional.function
|
|
|
|
while read i; do
|
|
|
|
$i
|
|
|
|
done <${ADDITIONAL}
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# Install KM4ACK Utilites
|
|
|
|
#####################################
|
2021-03-16 16:39:25 +00:00
|
|
|
source ${FUNCTIONS}/utility.function
|
|
|
|
while read i; do
|
|
|
|
$i
|
|
|
|
done <${UTILITY}
|
2019-12-24 20:57:51 +00:00
|
|
|
|
2021-08-02 17:28:45 +00:00
|
|
|
#create new menu subcategories. One for FLDIGI Suite and
|
|
|
|
#one for Build a Pi.
|
|
|
|
bash ${HOME}/pi-build/menu-update
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#####################################
|
|
|
|
# END CLEANUP
|
|
|
|
#####################################
|
|
|
|
#Remove temp files
|
2021-03-16 16:39:25 +00:00
|
|
|
rm ${BASE} ${ADDITIONAL} ${UTILITY} ${FLSUITE} >/dev/null 2>&1
|
|
|
|
rm -rf ${DIR} >/dev/null 2>&1
|
2021-04-02 20:33:50 +00:00
|
|
|
sudo apt -y autoremove > /dev/null 2>&1
|
2020-06-14 14:06:04 +00:00
|
|
|
|
2021-11-18 22:09:56 +00:00
|
|
|
#remove libham (rigctl) installed from apt
|
|
|
|
#since it conflicts with hamlib installed from source
|
|
|
|
sudo apt purge -y libhamlib4
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#restore crontab
|
2021-03-16 16:39:25 +00:00
|
|
|
crontab ${TEMPCRON}
|
|
|
|
rm ${TEMPCRON}
|
2020-06-27 16:59:43 +00:00
|
|
|
|
|
|
|
echo "WE ARE ALL DONE HERE. If you close this window, you will have to reboot manually."
|
|
|
|
|
2020-06-14 14:06:04 +00:00
|
|
|
#reboot when done
|
2021-03-16 16:39:25 +00:00
|
|
|
yad --width=400 --height=200 --title="Reboot" --image ${LOGO} \
|
|
|
|
--text-align=center --skip-taskbar --image-on-top \
|
|
|
|
--wrap --window-icon=${LOGO} \
|
|
|
|
--undecorated --text="<big><big><big><b>Build Finished \rReboot Required</b></big></big></big>\r\r" \
|
|
|
|
--button="Reboot Now":0 \
|
|
|
|
--button="Exit":1
|
2020-06-14 14:06:04 +00:00
|
|
|
BUT=$(echo $?)
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${BUT} = 0 ]; then
|
|
|
|
echo rebooting
|
|
|
|
sudo reboot
|
|
|
|
elif [ ${BUT} = 1 ]; then
|
|
|
|
exit
|
2020-06-14 14:06:04 +00:00
|
|
|
fi
|