set_setting_value upgrade

(handles similarly-named settings better)
Add PCSX2 and Duckstation config upgrades to post_update
This commit is contained in:
icenine451 2023-05-05 12:27:31 -04:00
parent ac2b8bb2c0
commit dc94e3b3c1
3 changed files with 14 additions and 4 deletions

View file

@ -323,7 +323,7 @@ set_setting_value() {
if [[ -z $current_section_name ]]; then if [[ -z $current_section_name ]]; then
sed -i 's^\^'"$setting_name_to_change"'=.*^'"$setting_name_to_change"'='"$setting_value_to_change"'^' $1 sed -i 's^\^'"$setting_name_to_change"'=.*^'"$setting_name_to_change"'='"$setting_value_to_change"'^' $1
else else
sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"'.*^s^\^'"$setting_name_to_change"'=.*^'"$setting_name_to_change"'='"$setting_value_to_change"'^' $1 sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"'=^s^\^'"$setting_name_to_change"'=.*^'"$setting_name_to_change"'='"$setting_value_to_change"'^' $1
fi fi
if [[ "$4" == "retrodeck" ]]; then # If a RetroDECK setting is being changed, also write it to memory for immediate use if [[ "$4" == "retrodeck" ]]; then # If a RetroDECK setting is being changed, also write it to memory for immediate use
eval "$setting_name_to_change=$setting_value_to_change" eval "$setting_name_to_change=$setting_value_to_change"
@ -334,7 +334,7 @@ set_setting_value() {
if [[ -z $current_section_name ]]; then if [[ -z $current_section_name ]]; then
sed -i 's^\^'"$setting_name_to_change"' = \".*\"^'"$setting_name_to_change"' = \"'"$setting_value_to_change"'\"^' $1 sed -i 's^\^'"$setting_name_to_change"' = \".*\"^'"$setting_name_to_change"' = \"'"$setting_value_to_change"'\"^' $1
else else
sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"'.*^s^\^'"$setting_name_to_change"' = \".*\"^'"$setting_name_to_change"' = \"'"$setting_value_to_change"'\"^' $1 sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"' = ^s^\^'"$setting_name_to_change"' = \".*\"^'"$setting_name_to_change"' = \"'"$setting_value_to_change"'\"^' $1
fi fi
;; ;;
@ -342,7 +342,7 @@ set_setting_value() {
if [[ -z $current_section_name ]]; then if [[ -z $current_section_name ]]; then
sed -i 's^\^'"$setting_name_to_change"' =.*^'"$setting_name_to_change"' = '"$setting_value_to_change"'^' $1 sed -i 's^\^'"$setting_name_to_change"' =.*^'"$setting_name_to_change"' = '"$setting_value_to_change"'^' $1
else else
sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"'.*^s^\^'"$setting_name_to_change"' =.*^'"$setting_name_to_change"' = '"$setting_value_to_change"'^' $1 sed -i '\^\['"$current_section_name"'\]^,\^\^'"$setting_name_to_change"' =^s^\^'"$setting_name_to_change"' =.*^'"$setting_name_to_change"' = '"$setting_value_to_change"'^' $1
fi fi
;; ;;

View file

@ -70,6 +70,7 @@ post_update() {
if [[ $prev_version -le "070" ]]; then if [[ $prev_version -le "070" ]]; then
# In version 0.7.0b, the following changes were made that required config file updates/reset or other changes to the filesystem: # In version 0.7.0b, the following changes were made that required config file updates/reset or other changes to the filesystem:
# - Update retrodeck.cfg and set new paths to $rdhome by default # - Update retrodeck.cfg and set new paths to $rdhome by default
# - Update PCSX2 and Duckstation configs to latest templates (to accomadate RetroAchievements feature)
# - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported) # - New ~/retrodeck/mods and ~/retrodeck/texture_packs directories are added and symlinked to multiple different emulators (where supported)
# - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists # - Expose ES-DE gamelists folder to user at ~/retrodeck/gamelists
# - Update RPCS3 vfs file contents. migrate from old location if needed # - Update RPCS3 vfs file contents. migrate from old location if needed
@ -85,6 +86,15 @@ post_update() {
set_setting_value $rd_conf "borders_folder" "$rdhome/borders" set_setting_value $rd_conf "borders_folder" "$rdhome/borders"
conf_read conf_read
mv -f "$pcsx2qtconf" "$pcsx2qtconf.bak"
generate_single_patch "$emuconfigs/PCSX2/PCSX2.ini" "$pcsx2qtconf.bak" "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch" pcsx2
deploy_single_patch "$emuconfigs/PCSX2/PCSX2.ini" "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch" "$pcsx2qtconf"
rm -f "/var/config/PCSX2/inis/PCSX2-cheevos-upgrade.patch"
mv -f "$duckstationconf" "$duckstationconf.bak"
generate_single_patch "$emuconfigs/duckstation/settings.ini" "$duckstationconf.bak" "/var/data/duckstation/duckstation-cheevos-upgrade.patch" pcsx2
deploy_single_patch "$emuconfigs/duckstation/settings.ini" "/var/data/duckstation/duckstation-cheevos-upgrade.patch" "$duckstationconf"
rm -f "/var/data/duckstation/duckstation-cheevos-upgrade.patch"
mkdir -p "$mods_folder" mkdir -p "$mods_folder"
mkdir -p "$texture_packs_folder" mkdir -p "$texture_packs_folder"
mkdir -p "$borders_folder" mkdir -p "$borders_folder"

@ -1 +1 @@
Subproject commit 717b78093797270877ec416e58082f1c71d435d8 Subproject commit 0b1cfb79e591e10488a3262d6b38db843c39a409