Finally fix cooker update checker

Improve finit handing of interruption
Fix some paths not being created during finit
This commit is contained in:
icenine451 2023-04-26 17:02:44 -04:00
parent 79598fb82b
commit e3ef868357
3 changed files with 9 additions and 6 deletions

View file

@ -1195,7 +1195,7 @@ prepare_emulator() {
if [[ ! $current_setting_name =~ (rdhome|sdcard) ]]; then # Ignore these locations
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths")
eval "$current_setting_name=$rdhome/$(basename $current_setting_value)"
mkdir "$rdhome/$(basename $current_setting_value)"
mkdir -p "$rdhome/$(basename $current_setting_value)"
fi
done < <(grep -v '^\s*$' $rd_conf | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f')
fi
@ -1870,7 +1870,8 @@ finit() {
case $finit_dest_choice in
"" ) # Cancel or X button quits
"Back" | "" ) # Back or X button quits
rm -f "$rd_conf" # Cleanup unfinished retrodeck.cfg if first install is interrupted
echo "Now quitting"
exit 2
;;
@ -1895,6 +1896,7 @@ finit() {
--text="SD Card was not find in the default location.\nPlease choose the SD Card root.\nA retrodeck folder will be created starting from the directory that you selected."
rdhome=$(finit_browse) # Calling the browse function
if [[ -z $rdhome ]]; then # If user hit the cancel button
rm -f "$rd_conf" # Cleanup unfinished retrodeck.cfg if first install is interrupted
exit 2
fi
elif [ ! -w "$sdcard" ] #SD card found but not writable
@ -1905,6 +1907,7 @@ finit() {
--title "RetroDECK" \
--ok-label "Quit" \
--text="SD card was found but is not writable\nThis can happen with cards formatted on PC.\nPlease format the SD card through the Steam Deck's Game Mode and run RetroDECK again."
rm -f "$rd_conf" # Cleanup unfinished retrodeck.cfg if first install is interrupted
echo "Now quitting"
exit 2
else
@ -1921,6 +1924,7 @@ finit() {
--text="Please choose the root folder for the RetroDECK data.\nA retrodeck folder will be created starting from the directory that you selected."
rdhome=$(finit_browse) # Calling the browse function
if [[ -z $rdhome ]]; then # If user hit the cancel button
rm -f "$rd_conf" # Cleanup unfinished retrodeck.cfg if first install is interrupted
exit 2
fi
;;

View file

@ -97,8 +97,7 @@ then
fi
# If there is no config file I initalize the file with the the default values
if [ ! -f "$rd_conf" ]
then
if [[ ! -f "$rd_conf" ]]; then
mkdir -p /var/config/retrodeck
echo "RetroDECK config file not found in $rd_conf"
echo "Initializing"
@ -126,7 +125,7 @@ then
if grep -qF "cooker" <<< $hard_version; then # If newly-installed version is a "cooker" build
set_setting_value $rd_conf "update_repo" "RetroDECK-cooker" retrodeck "options"
set_setting_value $rd_conf "update_check" "true" retrodeck "options"
update_ignore=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
update_ignore=$(curl --silent "https://api.github.com/repos/XargonWan/RetroDECK-cooker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
set_setting_value $rd_conf "update_ignore" "$update_ignore" retrodeck "options" # Store the latest online version to ignore for future checks, as internal version and online tag version may not match up.
fi

View file

@ -106,7 +106,7 @@ then
echo "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
cooker_base_version=$(echo $hard_version | cut -d'-' -f2)
update_ignore=$(curl --silent "https://api.github.com/repos/XargonWan/$update_repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
update_ignore=$(curl --silent "https://api.github.com/repos/XargonWan/RetroDECK-cooker/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
set_setting_value $rd_conf "update_ignore" "$update_ignore" retrodeck "options" # Store the latest online version to ignore for future checks, as internal version and online tag version may not match up.
choice=$(zenity --icon-name=net.retrodeck.retrodeck --info --no-wrap --ok-label="Upgrade" --extra-button="Don't Upgrade" --extra-button="Fresh Install" \
--window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" \