mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-22 05:55:38 +00:00
UPDATER: fixed cooker updater that was failing
This commit is contained in:
parent
8835995829
commit
83629157fa
|
@ -31,6 +31,8 @@ check_desktop_mode() {
|
|||
check_for_version_update() {
|
||||
# This function will perform a basic online version check and alert the user if there is a new version available.
|
||||
|
||||
log d "Entering funtcion check_for_version_update"
|
||||
|
||||
wget -q --spider "https://api.github.com/repos/XargonWan/$update_repo/releases/latest"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
@ -60,15 +62,18 @@ check_for_version_update() {
|
|||
# exit 1
|
||||
# fi
|
||||
# TODO: add the logic to check and update the branch from the configuration file
|
||||
log i "Showing new version found dialog"
|
||||
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="OK" --extra-button="Ignore this version" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK Update Available" \
|
||||
--text="There is a new version of RetroDECK on the stable release channel $online_version. Please update through the Discover app!\n\nIf you would like to ignore this version and recieve a notification at the NEXT version,\nclick the \"Ignore this version\" button.")
|
||||
rc=$? # Capture return code, as "OK" button has no text value
|
||||
if [[ $rc == "1" ]]; then # If any button other than "OK" was clicked
|
||||
log i "Selected: \"OK\""
|
||||
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks
|
||||
fi
|
||||
elif [[ "$update_repo" == "RetroDECK-cooker" ]] && [[ ! $version == $online_version ]]; then
|
||||
log i "Showing update request dialog as \"$online_version\" was found and is greater then \"$version\""
|
||||
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Yes" --extra-button="No" --extra-button="Ignore this version" \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "RetroDECK Update Available" \
|
||||
|
@ -76,17 +81,30 @@ check_for_version_update() {
|
|||
rc=$? # Capture return code, as "Yes" button has no text value
|
||||
if [[ $rc == "1" ]]; then # If any button other than "Yes" was clicked
|
||||
if [[ $choice == "Ignore this version" ]]; then
|
||||
log i "\"Ignore this version\" selected, updating \"$rd_conf\""
|
||||
set_setting_value $rd_conf "update_ignore" "$online_version" retrodeck "options" # Store version to ignore for future checks.
|
||||
fi
|
||||
else # User clicked "Yes"
|
||||
log i "Selected: \"Yes\""
|
||||
configurator_generic_dialog "RetroDECK Online Update" "The update process may take several minutes.\n\nAfter the update is complete, RetroDECK will close. When you run it again you will be using the latest version."
|
||||
(
|
||||
local latest_cooker_download=$(curl --silent https://api.github.com/repos/XargonWan/$update_repo/releases/latest | grep '"browser_download_url":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
create_dir "$rdhome/RetroDECK_Updates"
|
||||
wget -P "$rdhome/RetroDECK_Updates" $latest_cooker_download
|
||||
local temp_folder="$rdhome/RetroDECK_Updates"
|
||||
create_dir $temp_folder
|
||||
log i "Downloading version \"$online_version\" in \"$temp_folder/RetroDECK-cooker.flatpak\" from url: \"$latest_cooker_download\""
|
||||
wget -P "$temp_folder" "$latest_cooker_download"
|
||||
log d "Uninstalling old RetroDECK flatpak"
|
||||
flatpak-spawn --host flatpak remove --noninteractive -y net.retrodeck.retrodeck # Remove current version before installing new one, to avoid duplicates
|
||||
flatpak-spawn --host flatpak install --user --bundle --noninteractive -y "$rdhome/RetroDECK_Updates/RetroDECK-cooker.flatpak"
|
||||
rm -rf "$rdhome/RetroDECK_Updates" # Cleanup old bundles to save space
|
||||
log d "Installing new flatpak file from: \"$temp_folder/RetroDECK-cooker.flatpak\""
|
||||
if [ -f "$temp_folder/RetroDECK-cooker.flatpak" ]; then
|
||||
log d "Flatpak file \"$temp_folder/RetroDECK-cooker.flatpak\" found, proceeding."
|
||||
flatpak-spawn --host flatpak install --user --bundle --noninteractive -y "$temp_folder/RetroDECK-cooker.flatpak"
|
||||
else
|
||||
log e "Flatpak file \"$temp_folder/RetroDECK-cooker.flatpak\" NOT FOUND. Quitting"
|
||||
configurator_generic_dialog "RetroDECK Online Update" "There was an error during the update: flatpak file not found please check the log file."
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "$temp_folder" # Cleanup old bundles to save space
|
||||
) |
|
||||
zenity --icon-name=net.retrodeck.retrodeck --progress --no-cancel --pulsate --auto-close \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
|
@ -119,7 +137,7 @@ check_version_is_older_than() {
|
|||
|
||||
local current_version="$version"
|
||||
local new_version="$1"
|
||||
is_newer_version="false"
|
||||
local is_newer_version="false"
|
||||
|
||||
current_version_major_rev=$(sed 's/^\([0-9]*\)\..*/\1/' <<< "$current_version")
|
||||
new_version_major_rev=$(sed 's/^\([0-9]*\)\..*/\1/' <<< "$new_version")
|
||||
|
|
|
@ -30,6 +30,7 @@ configurator_process_complete_dialog() {
|
|||
configurator_generic_dialog() {
|
||||
# This dialog is for showing temporary messages before another process happens.
|
||||
# USAGE: configurator_generic_dialog "title text" "info text"
|
||||
log i "Showing a configurator_generic_dialog"
|
||||
zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap \
|
||||
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \
|
||||
--title "$1" \
|
||||
|
|
10
retrodeck.sh
10
retrodeck.sh
|
@ -99,13 +99,14 @@ https://retrodeck.net
|
|||
esac
|
||||
done
|
||||
|
||||
# UPDATE TRIGGERED
|
||||
log d "Update triggered"
|
||||
# if lockfile exists
|
||||
if [ -f "$lockfile" ]; then
|
||||
# ...but the version doesn't match with the config file
|
||||
log d "Lockfile found but the version doesn't match with the config file"
|
||||
if [ "$hard_version" != "$version" ]; then
|
||||
log i "Config file's version is $version but the actual version is $hard_version"
|
||||
if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build
|
||||
log d "Newly-installed version is a \"cooker\" build"
|
||||
configurator_generic_dialog "RetroDECK Cooker Warning" "RUNNING COOKER VERSIONS OF RETRODECK CAN BE EXTREMELY DANGEROUS AND ALL OF YOUR RETRODECK DATA\n(INCLUDING BIOS FILES, BORDERS, DOWNLOADED MEDIA, GAMELISTS, MODS, ROMS, SAVES, STATES, SCREENSHOTS, TEXTURE PACKS AND THEMES)\nARE AT RISK BY CONTINUING!"
|
||||
set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options"
|
||||
set_setting_value $rd_conf "update_check" "true" retrodeck "options"
|
||||
|
@ -137,7 +138,7 @@ if [ -f "$lockfile" ]; then
|
|||
fi
|
||||
fi
|
||||
else
|
||||
log i "Performing normal upgrade process for version" $cooker_base_version
|
||||
log i "Performing normal upgrade process for version $cooker_base_version"
|
||||
version=$cooker_base_version # Temporarily assign cooker base version to $version so update script can read it properly.
|
||||
post_update
|
||||
fi
|
||||
|
@ -170,10 +171,13 @@ desktop_mode_warning
|
|||
low_space_warning
|
||||
|
||||
# Check if there is a new version of RetroDECK available, if update_check=true in retrodeck.cfg and there is network connectivity available.
|
||||
log i "Check if there is a new version of RetroDECK available"
|
||||
if [[ $update_check == "true" ]]; then
|
||||
if [[ $(check_network_connectivity) == "true" ]]; then
|
||||
log d "Running function check_for_version_update"
|
||||
check_for_version_update
|
||||
fi
|
||||
log i "You're running the latest version"
|
||||
fi
|
||||
|
||||
# THIS IS A ONE-OFF FORCED REFRESH OF RETRODECK CONTROLLER PROFILES IN A 0.7.6b VERSION REFRESH - REMOVE BEFORE NEXT VERSION RELEASE
|
||||
|
|
Loading…
Reference in a new issue