pi-build/functions/base.function

169 wiersze
4.9 KiB
Plaintext
Czysty Zwykły widok Historia

2020-06-14 14:06:45 +00:00
#this installs the basic software for build-a-pi
#km4ack 20200513
TEMPCRON=${MYPATH}/cron.tmp
DIR=${MYPATH}/temp
mkdir -p ${DIR}
2020-06-14 14:06:45 +00:00
source ${MYPATH}/config
2020-06-14 14:06:45 +00:00
################################
# HOTSPOT
################################
HOTSPOT() {
HS="/usr/bin/autohotspotN"
if [ ! -f "${HS}" ]; then
#pass variables with script because run as root
sudo bash ${MYPATH}/functions/autohotspot "${SHACKSSID}" "${SHACKPASS}" "${HSPASS}"
echo "*/5 * * * * sudo /usr/bin/autohotspotN >/dev/null 2>&1" >>${TEMPCRON}
else
echo ################################
echo ################################
echo " FATAL ERROR"
echo "HOTSPOT ALREADY INSTALLED ONCE"
echo " CANNOT INSTALL AGAIN"
echo " WILL CONTINUE IN 10 SECONDS"
echo ################################
echo ################################
sleep 10
fi
2020-06-14 14:06:45 +00:00
}
################################
# HOTSPOT TOOLS
################################
HSTOOLS() {
if [ -d ${HOME}/hotspot-tools2 ]; then
rm -rf ${HOME}/hotspot-tools2
fi
git clone https://github.com/km4ack/hotspot-tools2.git ${HOME}/hotspot-tools2
sudo cp ${HOME}/hotspot-tools2/hstools.desktop /usr/share/applications/hotspot-tools.desktop
2020-06-14 14:06:45 +00:00
}
################################
# GPS
################################
GPS() {
2021-03-17 14:36:15 +00:00
cd ${DIR} || return
wget --tries 2 --connect-timeout=60 https://raw.githubusercontent.com/km4ack/pi-scripts/master/gpsinstall
chmod +x ${DIR}/gpsinstall
sudo ${DIR}/gpsinstall
rm ${DIR}/gpsinstall
#Set GPS by serial ID
#GPS Variable set by main script or update script
#and placed in config file
sudo sed -i "s|DEVICES.*$|DEVICES=\"$GPS\"|g" /etc/default/gpsd
#add xgps to menu
cat >xgps.desktop <<EOF
2020-10-11 23:16:21 +00:00
[Desktop Entry]
Name=XGPS
GenericName=XGPS
Comment=GPS Date Viewer
Exec=/usr/bin/xgps
Icon=/usr/share/icons/Adwaita/scalable/devices/thunderbolt-symbolic.svg
Terminal=false
Type=Application
Categories=Utility
EOF
sudo mv xgps.desktop /usr/share/applications/
2020-06-14 14:06:45 +00:00
}
################################
# ARDOP
################################
ARDOP() {
mkdir -p ${HOME}/ardop
2021-03-17 14:36:15 +00:00
cd ${HOME}/ardop || return
wget --tries 2 --connect-timeout=60 https://www.cantab.net/users/john.wiseman/Downloads/Beta/piardopc
sudo chmod +x ${HOME}/ardop/piardopc
2020-06-14 14:06:45 +00:00
}
################################
# ARDOP GUI
################################
ARDOPGUI() {
mkdir -p ${HOME}/ardop
2021-03-17 14:36:15 +00:00
cd ${HOME}/ardop || return
wget --tries 2 --connect-timeout=60 https://www.cantab.net/users/john.wiseman/Downloads/Beta/piARDOP_GUI
sudo chmod +x ${HOME}/ardop/piARDOP_GUI
cat >ardopgui.desktop <<EOF
2020-06-14 14:06:45 +00:00
[Desktop Entry]
Name=ARDOP GUI
GenericName=ARDOP GUI
Comment=Graphical User Interface for ARDOP modem
Exec=${HOME}/ardop/piARDOP_GUI
2020-06-14 14:06:45 +00:00
Terminal=false
Type=Application
Categories=Network;HamRadio;
EOF
sudo mv ardopgui.desktop /usr/share/applications/
FILE=${HOME}/.config/G8BPQ/ARDOP_GUI.conf
mkdir -p ${HOME}/.config/G8BPQ
touch ${FILE}
echo "[General]" >>${FILE}
echo "Host=local" >>${FILE}
echo "Port=8515" >>${FILE}
2020-06-14 14:06:45 +00:00
}
################################
# HAMLIB
################################
HAMLIB() {
2021-03-17 14:36:15 +00:00
cd ${DIR} || return
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}')
HAMLIBLINK=https://sourceforge.net/projects/hamlib/files/hamlib/${NEWRIG}/hamlib-${NEWRIG}.tar.gz
2021-03-17 14:36:15 +00:00
cd ${HOME}/Downloads || return
echo "###################################"
echo "# Installing Hamlib "
echo "###################################"
wget --tries 2 --connect-timeout=60 ${HAMLIBLINK}
tar -xzf hamlib-${NEWRIG}.tar.gz
rm hamlib-${NEWRIG}.tar.gz
2021-03-17 14:36:15 +00:00
cd hamlib-${NEWRIG} || return
./configure
make
sudo make install
sudo ldconfig
2020-06-14 14:06:45 +00:00
}
################################
# DIREWOLF
################################
DIREWOLF() {
2021-03-17 14:36:15 +00:00
cd ${HOME} || return
git clone https://www.github.com/wb2osz/direwolf
2021-03-17 14:36:15 +00:00
cd ${HOME}/direwolf || return
mkdir build && cd build
2021-04-02 20:26:14 +00:00
sudo apt-get install -y libasound2-dev cmake libudev-dev
cmake ..
make -j 4
sudo make install
make install-conf
sed -i "s/N0CALL/${CALL}/" "${HOME}/direwolf.conf"
sed -i 's/# ADEVICE plughw:1,0/ADEVICE plughw:2,0/' ${HOME}/direwolf.conf
sed -i '/#PTT\ \/dev\/ttyUSB0\ RTS/a #Uncomment line below for PTT with sabrent sound card\n#PTT RIG 2 localhost:4532' ${HOME}/direwolf.conf
rm -rf ${HOME}/direwolf
2020-06-14 14:06:45 +00:00
}
################################
# AX25
################################
AX25() {
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
2020-06-14 14:06:45 +00:00
}
################################
2021-01-09 16:28:41 +00:00
# PULSE AUDIO Control
2020-06-14 14:06:45 +00:00
################################
PULSE() {
sudo apt-get install -y pavucontrol
2020-06-14 14:06:45 +00:00
}