Skip to content

Commit ad206f8

Browse files
author
Benji Vesterby
committed
Adding update to new version feature
1 parent ba07071 commit ad206f8

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

gvm

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@
55
###############################################################################
66
SCRIPTVERSION="$(git describe --tags --always)"
77

8-
9-
SUMPATH=$(printf "https://github.com/devnw/gvm/releases/download/%s/gvm.sum" "$SCRIPTVERSION")
10-
EXPECTEDSUM=$(curl -L "$SUMPATH")
8+
GVMURL=$(printf "https://github.com/devnw/gvm/releases/download/%s/gvm" "$SCRIPTVERSION")
9+
SUMPATH=$(printf "%s.sum" "$GVMURL")
10+
EXPECTEDSUM=$(curl -sL "$SUMPATH")
1111

1212
if [[ "$EXPECTEDSUM" != "" && $(shasum -a 256 "$0") != "$EXPECTEDSUM" ]]
1313
then
14-
echo "Checksum mismatch; expected $EXPECTEDSUM, got $(shasum -a 256 "$0")"
15-
exit 1
14+
15+
printf "New Version of GVM [%s] Available would you like to update? " "$SCRIPTVERSION"
16+
17+
read -rp "[Yes: Y or y | No: Enter]? " yn
18+
19+
# Only trigger on `Y` or `y`
20+
if [[ "$yn" == "Y" || "$yn" == "y" ]]
21+
then
22+
curl -sL "$GVMURL" -o "$0"
23+
fi
1624
fi
1725

1826
help() {

0 commit comments

Comments
 (0)