1
0
Fork 0
mirror of https://github.com/aclist/dztui.git synced 2025-04-04 19:43:00 +02:00

Add column version check

This commit is contained in:
aclist 2022-01-21 05:40:12 +09:00 committed by GitHub
parent 0f844b6950
commit 037451d6a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
#!/bin/bash
set -eo pipefail
version=0.2.3
release_url="https://raw.githubusercontent.com/aclist/dztui/main/dztui.sh"
aid=221100
game="dayz"
workshop="https://steamcommunity.com/sharedfiles/filedetails/?id="
@ -30,14 +31,32 @@ declare -A deps
deps=([awk]="5.1.1" [curl]="7.80.0" [jq]="1.6" [column]="2.37.2" [tr]="9.0" [comm]="9.0")
max_range=$(awk -F, '{print NF}' <<< $whitelist)
err(){
printf "[ERROR] %s\n" "$1"
return 1
}
version_check(){
upstream=$(curl -Ls "$release_url" | awk -F= 'NR==3 {print $2}')
printf "[INFO] Checking for new version\n"
if [[ ! $upstream == "$version" ]]; then
printf "[INFO] A newer version of DZTUI is available at:\n$release_url.\n"
while true; do
read -p "Continue anyway? [Y/n] " response
if [[ $response == "Y" ]]; then
break
elif [[ $response == "n" ]]; then
exit_msg
else
:
fi
done
fi
}
depcheck(){
for dep in "${!deps[@]}"; do
command -v $dep 2>&1>/dev/null || (printf "[ERROR] Requires %s >= %s\n" $dep ${deps[$dep]} ; exit 1)
done
}
err(){
printf "[ERROR] %s\n" "$1"
return 1
}
varcheck(){
[[ -z $key ]] && (err "Missing API key")