kopia lustrzana https://github.com/km4ack/pi-build
initial commit
rodzic
d84a395a3a
commit
ea96f344bc
|
@ -0,0 +1,73 @@
|
|||
#!/bin/bash
|
||||
|
||||
#alpha script to test a patch system for quick fixes in BAP
|
||||
#KM4ACK 20210805
|
||||
|
||||
MYPATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
LOGO=${MYPATH}/logo.png
|
||||
DIR=/run/user/$UID
|
||||
|
||||
#Setup temp directory for BAP patches and download patches
|
||||
cd $DIR
|
||||
git init pi-build
|
||||
cd pi-build
|
||||
git remote add -f origin https://github.com/km4ack/pi-build.git
|
||||
git config core.sparseCheckout true
|
||||
echo "/patch" >> .git/info/sparse-checkout
|
||||
git pull origin dev
|
||||
|
||||
TEMP=/run/user/$UID/patch.txt
|
||||
MENU(){
|
||||
ls -I readme -I patch $DIR/pi-build/patch > $TEMP
|
||||
|
||||
INFO=$(PARSER='OFS="\n" {print $1}'
|
||||
MYTEMP=/run/user/$UID/patch1.txt
|
||||
tail -10 $TEMP | awk "$PARSER" | \
|
||||
yad --title="Build a Pi Patch Tool" --width=500 --height=500 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --multiple \
|
||||
--center --list --text="Select a Patch to Apply" \
|
||||
--column "Patch" \
|
||||
--button="Exit":1 \
|
||||
--button="Apply Patch":2)
|
||||
BUT=$?
|
||||
|
||||
PATCH=$(echo ${INFO} | awk -F "|" '{print $1}')
|
||||
|
||||
#cleanup and exit upon user request
|
||||
if [ ${BUT} = 1 ] || [ ${BUT} = 252 ];then
|
||||
echo "cleanup and exit Build a Pi patch tool"
|
||||
rm -rf $TEMP $DIR/pi-build
|
||||
${MYPATH}/update && exit
|
||||
fi
|
||||
|
||||
#verify patch has not been applied already
|
||||
echo "getting patchname"
|
||||
PATCHNAME=$(grep PATCHNAME= $DIR/pi-build/patch/${PATCH} | sed 's/PATCHNAME=//')
|
||||
PATCHCHECK=$(grep ${PATCHNAME} $HOME/.config/patch)
|
||||
|
||||
if [ -z $PATCHCHECK ]; then
|
||||
#apply patch & give user notice that patch has been applied
|
||||
echo "applying $PATCH"
|
||||
bash ${DIR}/pi-build/patch/${PATCH}
|
||||
|
||||
yad --form --width=500 --text-align=center --center --title="Build-a-Pi Patch Tool" --text-align=center \
|
||||
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>${PATCH}</b> patch has been applied" \
|
||||
--button=gtk-close
|
||||
|
||||
|
||||
|
||||
#rm -rf $TEMP $DIR/pi-build
|
||||
MENU
|
||||
else
|
||||
yad --form --width=500 --text-align=center --center --title="Build-a-Pi Patch Tool" --text-align=center \
|
||||
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>$PATCH</b> was applied previously\rNo need to apply again." \
|
||||
--button=gtk-close
|
||||
#rm -rf $TEMP $DIR/pi-build
|
||||
MENU
|
||||
exit
|
||||
fi
|
||||
}
|
||||
MENU
|
||||
|
Ładowanie…
Reference in New Issue