pi-build/patch/hamlib4.3-20210920

63 wiersze
1.8 KiB
Bash

#!/bin/bash
#This test-patch script should serve as a
#template for future patch scripts.
#20210805 KM4ACK
#Give this patch a unique name. A good idea is
#to give it the application name that is being
#patched followed by the date. ie FLDIDI20210805
PATCHNAME=hamlib4.3-20210920
PATCHFILE=$HOME/.config/patch
touch $PATCHFILE
###############################
#Patch script commands go here#
###############################
clear;echo;echo
if [ -d $HOME/Downloads/hamlib-4.3 ]; then
cd $HOME/Downloads/hamlib-4.3
sudo make uninstall
sudo make clean
sudo apt install -y libusb-1.0 libusb-dev
./configure
make
sudo make install
sudo ldconfig
else
echo "###################################"
echo "hamlib source directory not found"
echo "Downloading hamlib"
echo "###################################"
sleep 2
cd $HOME/Downloads
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
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
cd hamlib-${NEWRIG} || return
sudo apt install -y libusb-1.0 libusb-dev
./configure
make
sudo make install
sudo ldconfig
fi
#############################################
#write patch name to a file so we can #
#look and see if it has been applied before.#
#This is checked by the patch-menu script #
#before running the patch #
#############################################
echo "$PATCHNAME" >> $PATCHFILE