2021-08-05 16:45:47 +00:00
|
|
|
#!/bin/bash
|
2021-08-05 22:31:00 +00:00
|
|
|
|
|
|
|
#This test-patch script should serve as a
|
|
|
|
#template for future patch scripts.
|
|
|
|
#20210805 KM4ACK
|
|
|
|
|
2021-08-05 22:38:06 +00:00
|
|
|
HEADER(){
|
|
|
|
clear;echo;echo "====================="
|
|
|
|
echo "Build a Pi Patch Tool"
|
|
|
|
echo "====================="
|
|
|
|
}
|
|
|
|
|
2021-08-05 23:46:45 +00:00
|
|
|
#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
|
|
|
|
|
2021-08-05 22:31:00 +00:00
|
|
|
PATCHNAME=test-patch20210805
|
2021-08-05 23:46:45 +00:00
|
|
|
|
2021-08-05 22:31:00 +00:00
|
|
|
PATCHFILE=$HOME/.config/patch
|
2021-08-05 22:36:19 +00:00
|
|
|
touch $PATCHFILE
|
2021-08-05 22:31:00 +00:00
|
|
|
|
|
|
|
#check to see if patch already applied
|
|
|
|
PATCHCHECK=$(grep "$PATCHNAME" $PATCHFILE)
|
|
|
|
|
|
|
|
if [ -z $PATCHCHECK ]; then
|
2021-08-05 23:46:45 +00:00
|
|
|
#if patch hasn't been applied before, apply it now
|
2021-08-05 16:48:21 +00:00
|
|
|
clear;echo;echo
|
2021-08-05 22:31:00 +00:00
|
|
|
echo "This is a test patch"
|
2021-08-05 23:46:45 +00:00
|
|
|
#write patch name to a file so we can
|
|
|
|
#look and see if it has been applied before.
|
2021-08-05 22:31:00 +00:00
|
|
|
echo "$PATCHNAME" >> $PATCHFILE
|
2021-08-05 23:46:45 +00:00
|
|
|
|
2021-08-05 22:31:00 +00:00
|
|
|
else
|
|
|
|
#if patch previously applied, notify user and exit
|
|
|
|
echo "$PATCHNAME already applied to this system"
|
2021-08-06 12:40:04 +00:00
|
|
|
exit 1
|
2021-08-05 22:31:00 +00:00
|
|
|
fi
|