2020-06-16 16:56:18 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
#script to gather some system information
|
|
|
|
#to help diagnose issues
|
|
|
|
#20200616 km4ack
|
2021-02-12 02:48:24 +00:00
|
|
|
#11FEB2021 review km4ack
|
2021-03-16 16:39:25 +00:00
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
read -rp "What is your call sign? " CALL
|
2020-06-16 16:56:18 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
DIR=${HOME}/Desktop/${CALL}-diagnostic-report
|
2020-06-16 16:56:18 +00:00
|
|
|
|
|
|
|
#create temp dir
|
2021-03-16 16:39:25 +00:00
|
|
|
mkdir -p ${DIR}
|
2020-06-16 16:56:18 +00:00
|
|
|
|
2020-06-16 19:13:10 +00:00
|
|
|
#check to see which apps are installed
|
2021-03-16 16:39:25 +00:00
|
|
|
CHECK() {
|
|
|
|
#----------------------------------------------------#
|
|
|
|
# Hotspot
|
|
|
|
#----------------------------------------------------#
|
|
|
|
HOTSPOT="/usr/bin/autohotspotN"
|
|
|
|
if [ ! -f "${HOTSPOT}" ]; then
|
|
|
|
HOTSPOT="Not Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
HOTSPOT="Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# AX25
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ ! -d /etc/ax25 ]; then
|
|
|
|
AX25="Not Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
AX25="Installed"
|
|
|
|
fi
|
|
|
|
#----------------------------------------------------#
|
|
|
|
# GPS
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if ! hash gpsd 2>/dev/null; then
|
|
|
|
GPS="Not Installed"
|
|
|
|
else
|
|
|
|
GPS="Installed"
|
|
|
|
fi
|
|
|
|
#----------------------------------------------------#
|
|
|
|
# PULSE
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if ! hash pulseaudio 2>/dev/null; then
|
|
|
|
PULSE="Not Installed"
|
|
|
|
else
|
|
|
|
PULSE="Installed"
|
|
|
|
fi
|
|
|
|
#----------------------------------------------------#
|
|
|
|
# ARDOP
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ -f ${HOME}/ardop/piardopc ]; then
|
|
|
|
ARDOP="Installed"
|
|
|
|
else
|
|
|
|
ARDOP="Not Installed"
|
|
|
|
fi
|
|
|
|
#----------------------------------------------------#
|
|
|
|
# ARDOP GUI
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ -f ${HOME}/ardop/piARDOP_GUI ]; then
|
|
|
|
ARDOPGUI="Installed"
|
|
|
|
else
|
|
|
|
ARDOPGUI="Not Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# RIG CONTROL - HAMLIB
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if ! hash rigctl 2>/dev/null; then
|
|
|
|
RIG="Not_Installed"
|
|
|
|
else
|
|
|
|
echo "Checking Rig Control"
|
|
|
|
RIG=$(rigctl --version | grep Hamlib | sed s/"rigctl(d),\ Hamlib\ "//)
|
|
|
|
NEWRIG=$(curl -s https://sourceforge.net/projects/hamlib/files/latest/download |
|
|
|
|
grep -o https://downloads.sourceforge.net/project/hamlib/hamlib/[0-9].[0-9] |
|
|
|
|
head -n 1 | awk -F "/" '{print $7}')
|
|
|
|
|
|
|
|
if (($(echo "${NEWRIG} ${RIG}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
RIG=NEEDS-UPDATE
|
|
|
|
else
|
|
|
|
RIG="is_latest_version"
|
|
|
|
fi
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# FLRIG
|
|
|
|
#----------------------------------------------------#
|
|
|
|
echo "Checking FLRIG"
|
|
|
|
if ! hash flrig 2>/dev/null; then
|
|
|
|
FLRIG="Not_Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
FLRIG=$(flrig --version | awk 'FNR == 1 {print $2}')
|
|
|
|
NEWFLRIG=$(curl -s https://sourceforge.net/projects/fldigi/files/flrig/ |
|
|
|
|
grep .tar.gz | head -1 | awk -F "-" '{print $2}' | awk -F ".tar.gz" '{print $1}')
|
|
|
|
|
|
|
|
if (($(echo "${NEWFLRIG} ${FLRIG}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
FLRIG=NEEDS-UPDATE
|
|
|
|
else
|
|
|
|
FLRIG="is_latest_version"
|
|
|
|
fi
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# Pat Winlink
|
|
|
|
#----------------------------------------------------#
|
|
|
|
echo "Checking Pat Winlink"
|
|
|
|
if ! hash pat 2>/dev/null; then
|
|
|
|
PAT="Not_Installed"
|
|
|
|
else
|
|
|
|
PAT=$(pat version | awk -F 'v' '{print $2}' | head -c 5)
|
|
|
|
NEWPAT=$(curl -s https://github.com/la5nta/pat/releases | grep -m 1 "amd64.deb" |
|
|
|
|
awk -F '_' '{print $2}')
|
|
|
|
|
|
|
|
if (($(echo "${NEWPAT} ${PAT}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
PAT=NEEDS-UPDATE
|
|
|
|
else
|
|
|
|
PAT="is_latest_version"
|
|
|
|
fi
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# DIREWOLF
|
|
|
|
#----------------------------------------------------#
|
|
|
|
echo "Checking Direwolf"
|
|
|
|
if ! hash direwolf 2>/dev/null; then
|
|
|
|
DIRE="Not_Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
DIRE=$(direwolf -S -t 0 | head -1 | sed 's/Dire\ Wolf\ version\ //')
|
|
|
|
wget -P /tmp/ https://raw.githubusercontent.com/wb2osz/direwolf/master/CHANGES.md >/dev/null 2>&1
|
|
|
|
NEWDIRE=$(cat /tmp/CHANGES.md | head -5 | tail -1 | awk '{ print $3 }')
|
|
|
|
|
|
|
|
if (($(echo "${NEWDIRE} ${DIRE}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
DIRE=NEEDS-UPDATE
|
|
|
|
else
|
|
|
|
DIRE="is_latest_version"
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
fi
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# Pat Menu
|
|
|
|
#----------------------------------------------------#
|
|
|
|
echo "Checking Pat Menu"
|
|
|
|
if [ ! -d ${HOME}/patmenu2 ]; then
|
|
|
|
PATMENU="Not_Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
cd ${HOME}/patmenu2/ || exit
|
|
|
|
wget -O ${HOME}/patmenu2/latest https://raw.githubusercontent.com/km4ack/patmenu2/master/changelog >/dev/null 2>&1
|
|
|
|
LATEST=$(cat ${HOME}/patmenu2/latest | grep '^release' | sed 's/release=//')
|
|
|
|
CURRENT=$(cat ${HOME}/patmenu2/changelog | grep '^release' | sed 's/release=//')
|
|
|
|
rm ${HOME}/patmenu2/latest >/dev/null 2>&1
|
|
|
|
if (($(echo "${LATEST} ${CURRENT}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
PATMENU="NEEDS-UPDATE"
|
|
|
|
else
|
|
|
|
PATMENU="is_latest_version"
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# Hot Spot Tools
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ ! -d ${HOME}/hotspot-tools2 ]; then
|
|
|
|
HSTOOLS="Not_Installed"
|
2020-06-16 19:13:10 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
CURRENT=$(cat ${HOME}/hotspot-tools2/changelog | grep version= | sed 's/version=//')
|
|
|
|
LATEST=$(curl -s https://raw.githubusercontent.com/km4ack/hotspot-tools2/master/changelog | grep version= | sed 's/version=//')
|
|
|
|
if (($(echo "${LATEST} ${CURRENT}" | awk '{print ($1 > $2)}'))); then
|
|
|
|
HSTOOLS="NEEDS-UPDATE"
|
|
|
|
else
|
|
|
|
HSTOOLS="is_latest_version"
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# EES
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ -f /var/www/html/email.php ]; then
|
|
|
|
EES="Installed"
|
|
|
|
else
|
|
|
|
EES="Not Installed"
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
#----------------------------------------------------#
|
|
|
|
# CONKY
|
|
|
|
#----------------------------------------------------#
|
|
|
|
if [ -f ${HOME}/.conkyrc ]; then
|
|
|
|
CONKY=Installed
|
|
|
|
else
|
|
|
|
CONKY="Not Installed"
|
|
|
|
fi
|
2020-06-16 19:13:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
CHECK
|
|
|
|
|
2020-06-16 16:56:18 +00:00
|
|
|
#get system info
|
2020-06-30 14:36:37 +00:00
|
|
|
WHO=$(whoami)
|
2020-07-31 13:13:06 +00:00
|
|
|
KERNAL=$(uname -r)
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "User Name is ${WHO}" >${DIR}/systeminfo.txt
|
|
|
|
echo "" >>${DIR}/systeminfo.txt
|
|
|
|
echo "Kernal version is ${KERNAL}" >>${DIR}/systeminfo.txt
|
|
|
|
echo "" >>${DIR}/systeminfo.txt
|
|
|
|
cat /etc/os-release >>${DIR}/systeminfo.txt
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "#####uname######" >>${DIR}/systeminfo.txt
|
|
|
|
uname -a >>${DIR}/systeminfo.txt
|
2020-06-16 16:56:18 +00:00
|
|
|
|
|
|
|
#get direwolf.conf file
|
2021-03-16 16:39:25 +00:00
|
|
|
cat ${HOME}/direwolf.conf >${DIR}/direwolf.conf
|
2020-06-16 16:56:18 +00:00
|
|
|
|
|
|
|
#get pat config file
|
2021-03-16 16:39:25 +00:00
|
|
|
cat ${HOME}/.wl2k/config.json >${DIR}/patconfig.txt
|
2020-06-16 16:56:18 +00:00
|
|
|
#remove winlink password
|
2021-03-16 16:39:25 +00:00
|
|
|
sed -i 's/"secure_login_password":.*$/PASSWORD-REMOVED-FOR-YOUR-SECURITY/' ${DIR}/patconfig.txt
|
2020-06-16 16:56:18 +00:00
|
|
|
|
|
|
|
#get pat menu config file
|
2021-03-16 16:39:25 +00:00
|
|
|
cat ${HOME}/patmenu2/config >${DIR}/patmenu.conf
|
2020-06-16 16:56:18 +00:00
|
|
|
|
2020-06-30 14:36:37 +00:00
|
|
|
#Get wpa_supplicant
|
2021-03-16 16:39:25 +00:00
|
|
|
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf >${DIR}/wpa.txt
|
|
|
|
sed -i 's/psk=.*$/PASSWORD-REMOVED/' ${DIR}/wpa.txt
|
2020-06-30 14:36:37 +00:00
|
|
|
|
2020-06-16 16:56:18 +00:00
|
|
|
#get sound info
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "" >>${DIR}/sound.info
|
|
|
|
echo "ARECORD INFO" >${DIR}/sound.info
|
|
|
|
arecord -l >>${DIR}/sound.info
|
|
|
|
echo "" >>${DIR}/sound.info
|
|
|
|
echo "" >>${DIR}/sound.info
|
|
|
|
echo "APLAY INFO" >>${DIR}/sound.info
|
|
|
|
aplay -l >>${DIR}/sound.info
|
|
|
|
echo "" >>${DIR}/sound.info
|
|
|
|
echo "" >>${DIR}/sound.info
|
|
|
|
echo "Using sound card" >>${DIR}/sound.info
|
|
|
|
sudo lsof /dev/snd/* >>${DIR}/sound.info
|
2020-06-16 16:56:18 +00:00
|
|
|
|
|
|
|
#Get hotspot info
|
|
|
|
HS=$(systemctl is-active autohotspot)
|
|
|
|
CURRENTNAME=$(sudo cat /etc/hostapd/hostapd.conf | grep ssid= | head -1 | sed 's/ssid=//')
|
|
|
|
CURRENTPASS=$(sudo cat /etc/hostapd/hostapd.conf | grep wpa_passphrase= | sed 's/wpa_passphrase=//')
|
|
|
|
HSIP=$(sudo cat /usr/bin/autohotspotN | grep "ip a add" | sed 's/ip\ a\ add\ //' | sed 's/\/24.*$//' | tr -d " ")
|
2020-06-16 20:44:00 +00:00
|
|
|
WIREIP=$(ifconfig | grep -A 1 eth0 | grep inet | awk '{ print $2 }')
|
2020-06-16 16:56:18 +00:00
|
|
|
HSS=$(sudo cat /usr/bin/autohotspotN | grep "ip a add" | awk '{ print $4 }' | sed 's/\/24//')
|
|
|
|
CIP=$(ifconfig | grep -A 1 wlan0 | grep inet | awk '{ print $2 }')
|
|
|
|
CHECK=$(ls /etc/wpa_supplicant/ | grep FORCE)
|
|
|
|
AUTORUN=$(crontab -l | grep autohotspotN | awk '{print $1}' | sed 's/*\///')
|
|
|
|
if [ -z "$CHECK" ]; then
|
2021-03-16 16:39:25 +00:00
|
|
|
FORCE="Hotspot Not in force mode"
|
2020-06-16 16:56:18 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
FORCE="Hotspot IS in force mode"
|
2020-06-16 16:56:18 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
if [ ${HSS} = ${CIP} ]; then
|
|
|
|
HSS=ACTIVE
|
2020-06-16 20:47:48 +00:00
|
|
|
else
|
2021-03-16 16:39:25 +00:00
|
|
|
HSS=INACTIVE
|
2020-06-16 20:47:48 +00:00
|
|
|
fi
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
FILE=${DIR}/hotspot.info
|
2020-06-16 16:56:18 +00:00
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "Hotspot status ${HS}" >${FILE}
|
|
|
|
echo "Hotspot state ${HSS}" >>${FILE}
|
|
|
|
echo "Hotspot Name is ${CURRENTNAME}" >>${FILE}
|
|
|
|
echo "Hotspot IP = ${HSIP}" >>${FILE}
|
|
|
|
echo "Wireless IP = ${CIP}" >>${FILE}
|
|
|
|
echo "CAT5 IP = ${WIREIP}" >>${FILE}
|
|
|
|
echo "${FORCE}" >>${FILE}
|
|
|
|
echo "crontab set to auto run ever ${AUTORUN} minutes" >>${FILE}
|
2020-06-16 16:56:18 +00:00
|
|
|
|
2020-06-16 20:32:17 +00:00
|
|
|
#get cron contents
|
2021-03-16 16:39:25 +00:00
|
|
|
crontab -l >${DIR}/cron.txt
|
2020-06-16 20:32:17 +00:00
|
|
|
|
2020-06-16 17:07:31 +00:00
|
|
|
#get gps info
|
|
|
|
GPSD=$(systemctl is-active gpsd)
|
|
|
|
CHRONY=$(systemctl is-active chronyd)
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "/etc/default/gpsd file contents" >${DIR}/gps.info
|
|
|
|
echo
|
|
|
|
echo >>${DIR}/gps.info
|
|
|
|
cat /etc/default/gpsd >>${DIR}/gps.info
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo >>${DIR}/gps.info
|
|
|
|
echo "GPSD is $GPSD" >>${DIR}/gps.info
|
|
|
|
echo "Chrony is $CHRONY" >>${DIR}/gps.info
|
|
|
|
echo
|
|
|
|
echo
|
|
|
|
echo "#####TIME SOURCES#####" >>${DIR}/gps.info
|
|
|
|
chronyc sources -v >>${DIR}/gps.info
|
2020-06-16 17:07:31 +00:00
|
|
|
|
2020-06-16 19:13:10 +00:00
|
|
|
#Check installed apps
|
2021-03-16 16:39:25 +00:00
|
|
|
echo "Hotspot $HOTSPOT" >${DIR}/apps.info
|
|
|
|
echo "HS Tools $HSTOOLS" >>${DIR}/apps.info
|
|
|
|
echo "AX25 $AX25" >>${DIR}/apps.info
|
|
|
|
echo "GPS $GPS" >>${DIR}/apps.info
|
|
|
|
echo "Pulse $PULSE" >>${DIR}/apps.info
|
|
|
|
echo "ARDOP GUI $ARDOPGUI" >>${DIR}/apps.info
|
|
|
|
echo "CONKY $CONKY" >>${DIR}/apps.info
|
|
|
|
echo "HAMLIB $RIG" >>${DIR}/apps.info
|
|
|
|
echo "FLRIG $FLRIG" >>${DIR}/apps.info
|
|
|
|
echo "PAT $PAT" >>${DIR}/apps.info
|
|
|
|
echo "DIREWOLF $DIRE" >>${DIR}/apps.info
|
|
|
|
echo "Pat Menu $PATMENU" >>${DIR}/apps.info
|
|
|
|
echo "EES $EES" >>${DIR}/apps.info
|
|
|
|
|
|
|
|
cd ${HOME}/Desktop || exit
|
|
|
|
zip -r ${CALL}-diagnostic.zip ${DIR} >/dev/null 2>&1
|
|
|
|
|
|
|
|
rm -rf ${DIR} >/dev/null 2>&1
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo
|
2020-06-16 19:13:10 +00:00
|
|
|
|
|
|
|
cat <<EOF
|
|
|
|
DONE!!
|
|
|
|
|
|
|
|
Email the diagnostic.zip file located on your desktop
|
|
|
|
to km4ack@arrl.net along with a description of your issue
|
|
|
|
and a link to the original forum post.
|
|
|
|
|
2021-03-16 16:39:25 +00:00
|
|
|
All discussion/help is provided on the forum to
|
2020-06-16 19:13:10 +00:00
|
|
|
benefit the community at large.
|
|
|
|
|
|
|
|
https://groups.io/g/KM4ACK-Pi/topics
|
|
|
|
|
|
|
|
73, de KM4ACK
|
|
|
|
EOF
|