Skip to content

Commit 0b1d1f7

Browse files
committed
update
1 parent 5b7126e commit 0b1d1f7

File tree

1 file changed

+53
-13
lines changed

1 file changed

+53
-13
lines changed

update

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,43 @@ clear
117117
#####################################
118118
# Patch Check
119119
#####################################
120+
121+
#This check first looks at the README.md file to see if the PATCH var is YES.
122+
#If PATCH=YES, then it looks to see if the patches that are available have
123+
#been applied previously. If so, it skips the patch screen. If not, it gives
124+
#the user an option to install the patch(es).
125+
120126
PATCHCHECK=$(curl -s https://raw.githubusercontent.com/km4ack/pi-build/dev/patch/README.md | grep PATCH= | sed 's/PATCH=//')
121127

122128
if [ ${PATCHCHECK} = "YES" ]; then
129+
#Setup temp directory for BAP patches and download patches
130+
echo "##########################################################"
131+
echo "#Checking for available patches that haven't been applied#"
132+
echo "##########################################################"
133+
cd /run/user/$UID
134+
git init pi-build
135+
cd pi-build
136+
git remote add -f origin https://github.com/km4ack/pi-build.git
137+
git config core.sparseCheckout true
138+
echo "/patch" >> .git/info/sparse-checkout
139+
git pull origin dev
140+
141+
FILES=$(ls -I README.md /run/user/$UID/pi-build/patch)
142+
143+
#check if available patches have already been applied to BAP
144+
for i in $FILES; do
145+
146+
NAME=$(grep PATCHNAME= /run/user/$UID/pi-build/patch/$i | sed 's/PATCHNAME=//')
147+
RB=$(grep $NAME $HOME/.config/patch)
148+
if [ -z $RB ]; then
149+
echo "$NAME" >> /run/user/$UID/avail-patch.txt
150+
fi
151+
done
152+
#end check
153+
154+
if [ -f /run/user/$UID/avail-patch.txt ]; then
155+
rm /run/user/$UID/avail-patch.txt
156+
123157
cat <<EOF >${MYPATH}/patch.txt
124158
One or more patch scripts are currently
125159
available for Build a Pi. Full description
@@ -138,22 +172,28 @@ INTRO=$(yad --width=650 --height=300 --text-align=center --center --title="Build
138172
>/dev/null 2>&1)
139173
BUT=$?
140174

141-
if [ ${BUT} = 252 ]; then
142-
rm ${MYPATH}/patch.txt
143-
exit
144-
elif [ ${BUT} = 1 ]; then
145-
rm ${MYPATH}/patch.txt
146-
lxterminal -e bash $HOME/pi-build/patch-menu && exit
147-
elif [ ${BUT} = 2 ]; then
148-
rm ${MYPATH}/patch.txt
149-
echo "user declined patch updates
150-
continuing with Build a Pi update"
151-
fi
152-
175+
if [ ${BUT} = 252 ]; then
176+
echo "Button ${BUT} pressed"
177+
rm ${MYPATH}/patch.txt
178+
rm -rf /run/user/$UID/pi-build
179+
exit
180+
elif [ ${BUT} = 1 ]; then
181+
echo "Button ${BUT} pressed"
182+
rm ${MYPATH}/patch.txt
183+
lxterminal -e bash $HOME/pi-build/patch-menu && exit
184+
elif [ ${BUT} = 2 ]; then
185+
echo "Button ${BUT} pressed"
186+
rm ${MYPATH}/patch.txt
187+
echo "user declined patch updates continuing with Build a Pi update"
188+
rm -rf /run/user/$UID/pi-build
189+
fi
190+
else
191+
rm -rf /run/user/$UID/pi-build
192+
fi
153193
fi
154194

155195

156-
196+
157197
#Scan system for updated applications
158198
yad --width=550 --height=250 --text-align=center --center --title="Update" \
159199
--image ${LOGO} --window-icon=${LOGO} --image-on-top --separator="|" --item-separator="|" \

0 commit comments

Comments
 (0)