Add basic online version check

This commit is contained in:
icenine451 2023-03-26 15:08:00 -04:00
parent 8f8d9c2bb6
commit b577c3275b
2 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,7 @@ sdcard=/run/media/mmcblk0p1
power_user_warning=true
desktop_mode_warning=true
network_features=false
update_repo=RetroDECK
multi_user_mode=false
ask_default_user=true
default_user=

View file

@ -632,6 +632,17 @@ check_network_connectivity() {
fi
}
check_for_version_update() {
# This function will perform a basic online version check and alert the user if there is a new version available.
local current_version=$(sed -e 's/[\.a-z]//g' <<< $version)
local online_version=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed -e 's/[\.a-z]//g')
if [[ $current_version -le $online_version ]]; then
echo "There is a new version online!"
fi
}
validate_input() {
while IFS="^" read -r input action
do