Skip to content

Commit ecc8019

Browse files
committed
chirp version checking
1 parent 765be0d commit ecc8019

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

app-check

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,25 +254,27 @@ CHECK() {
254254
if ! hash chirpw 2>/dev/null; then
255255
echo "CHIRP=Not_Installed" >> $UPDATEFILE
256256
else
257-
echo "CHIRP=Installed" >> $UPDATEFILE
258-
fi
259-
OLDCODE(){
260-
#old code left for reference
261-
if ! hash chirpw 2>/dev/null; then
262-
echo "CHIRP=Not_Installed" >> $UPDATEFILE
263-
else
257+
#bash function this could be moved to the top of the file and used globally
258+
#to short hand lookups on GIT release pages
259+
lastrelease() { git ls-remote --tags "$1" | cut -d/ -f3- | tail -n1; }
260+
264261
CP=$(chirpw --version)
265262
CHIRP=$(echo ${CP} | awk '{ print $2 }' | sed 's/daily-//')
266-
NEWCHIRP=$(curl -s https://trac.chirp.danplanet.com/chirp_daily/LATEST/ |
267-
grep .tar.gz | awk -F 'chirp-daily-' '{print $2}' | head -c 8)
263+
NEWCHIRP=$(curl -s https://github.com/goldstar611/chirp-appimage/releases | grep Release- | head -1 | sed 's/.*Release-//;s/">//')
264+
265+
CP=$(chirp --version)
266+
CHIRP=$(echo ${CP} | awk '{ print $2 }' | sed 's/daily-//')
267+
#function above called here as shorthand
268+
NEWCHIRP=$(lastrelease https://github.com/goldstar611/chirp-appimage)
268269

269270
if (($(echo "${NEWCHIRP} ${CHIRP}" | awk '{print ($1 > $2)}'))); then
270-
echo "CHIRP=NEEDS-UPDATE" >> $UPDATEFILE
271+
echo "CHIRP=NEEDS-UPDATE" >> $UPDATEFILE
271272
else
272-
echo "CHIRP=is_latest_version" >> $UPDATEFILE
273+
echo "CHIRP=is_latest_version" >> $UPDATEFILE
273274
fi
275+
276+
274277
fi
275-
}
276278
#----------------------------------------------------#
277279
# DIREWOLF
278280
#----------------------------------------------------#

0 commit comments

Comments
 (0)