mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
Merge pull request #1056 from RetroDECK/cooker
Merge latest cooker into main
This commit is contained in:
commit
047dc63918
|
@ -255,7 +255,6 @@ fi
|
||||||
logs_folder="$rdhome/logs" # The path of the logs folder, here we collect all the logs
|
logs_folder="$rdhome/logs" # The path of the logs folder, here we collect all the logs
|
||||||
steamsync_folder="$rdhome/.sync" # Folder containing all the steam sync launchers for SRM
|
steamsync_folder="$rdhome/.sync" # Folder containing all the steam sync launchers for SRM
|
||||||
steamsync_folder_tmp="$rdhome/.sync-tmp" # Temp folder containing all the steam sync launchers for SRM
|
steamsync_folder_tmp="$rdhome/.sync-tmp" # Temp folder containing all the steam sync launchers for SRM
|
||||||
cheats_folder="$rdhome/cheats" # Folder containing all the cheats for the emulators
|
|
||||||
backups_folder="$rdhome/backups" # Folder containing all the RetroDECK backups
|
backups_folder="$rdhome/backups" # Folder containing all the RetroDECK backups
|
||||||
|
|
||||||
export GLOBAL_SOURCED=true
|
export GLOBAL_SOURCED=true
|
|
@ -149,9 +149,36 @@ update_rd_conf() {
|
||||||
conf_read # Read current settings into memory
|
conf_read # Read current settings into memory
|
||||||
mv -f $rd_conf $rd_conf_backup # Backup config file before update
|
mv -f $rd_conf $rd_conf_backup # Backup config file before update
|
||||||
cp $rd_defaults $rd_conf # Copy defaults file into place
|
cp $rd_defaults $rd_conf # Copy defaults file into place
|
||||||
conf_write # Write old values into new default file
|
conf_write # Write old values into new retrodeck.cfg file
|
||||||
|
|
||||||
# STAGE 2: To handle presets sections that use duplicate setting names
|
# STAGE 2: Create new folders that were added to the shipped retrodeck.cfg, if any
|
||||||
|
|
||||||
|
new_paths=$(awk -F= 'FNR==NR {keys[$1]=1; next} !($1 in keys)' \
|
||||||
|
<(grep -v '^\s*$' "$rd_conf_backup" | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f') \
|
||||||
|
<(grep -v '^\s*$' "$rd_conf" | awk '/^\[paths\]/{f=1;next} /^\[/{f=0} f'))
|
||||||
|
|
||||||
|
if [[ -n "$new_paths" ]]; then
|
||||||
|
log i "New paths found in RetroDECK config: \n $new_paths"
|
||||||
|
if [[ ! "$rdhome" == "/home/deck/retrodeck" ]]; then # If rdhome is not the normal internal path, set new folders to rdhome as their root
|
||||||
|
while read -r config_line; do
|
||||||
|
local current_setting_name=$(get_setting_name "$config_line" "retrodeck")
|
||||||
|
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths")
|
||||||
|
local relative_path="${current_setting_value#*retrodeck/}"
|
||||||
|
local new_setting_value="$rdhome/$relative_path"
|
||||||
|
set_setting_value "$rd_conf" "$current_setting_name" "$new_setting_value" "retrodeck" "paths"
|
||||||
|
create_dir "$new_setting_value"
|
||||||
|
done <<< "$new_paths"
|
||||||
|
else # rdhome is default internal location, so imported new paths are valid
|
||||||
|
while read -r config_line; do
|
||||||
|
local current_setting_name=$(get_setting_name "$config_line" "retrodeck")
|
||||||
|
local current_setting_value=$(get_setting_value "$rd_conf" "$current_setting_name" "retrodeck" "paths")
|
||||||
|
create_dir "$current_setting_value"
|
||||||
|
done <<< "$new_paths"
|
||||||
|
fi
|
||||||
|
conf_read
|
||||||
|
fi
|
||||||
|
|
||||||
|
# STAGE 3: To handle presets sections that use duplicate setting names
|
||||||
|
|
||||||
generate_single_patch $rd_defaults $rd_conf_backup $rd_update_patch retrodeck # Create a patch file for differences between defaults and current user settings
|
generate_single_patch $rd_defaults $rd_conf_backup $rd_update_patch retrodeck # Create a patch file for differences between defaults and current user settings
|
||||||
sed -i '/change^^version/d' $rd_update_patch # Remove version line from temporary patch file
|
sed -i '/change^^version/d' $rd_update_patch # Remove version line from temporary patch file
|
||||||
|
@ -160,7 +187,7 @@ update_rd_conf() {
|
||||||
rm -f $rd_update_patch # Cleanup temporary patch file
|
rm -f $rd_update_patch # Cleanup temporary patch file
|
||||||
conf_read # Read all settings into memory
|
conf_read # Read all settings into memory
|
||||||
|
|
||||||
# STAGE 3: Eliminate any preset incompatibility with existing user settings and new defaults
|
# STAGE 4: Eliminate any preset incompatibility with existing user settings and new defaults
|
||||||
|
|
||||||
# Fetch incompatible presets from JSON and create a lookup list
|
# Fetch incompatible presets from JSON and create a lookup list
|
||||||
incompatible_presets=$(jq -r '
|
incompatible_presets=$(jq -r '
|
||||||
|
@ -196,7 +223,6 @@ update_rd_conf() {
|
||||||
done < $rd_conf
|
done < $rd_conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
conf_read() {
|
conf_read() {
|
||||||
# This function will read the RetroDECK config file into memory
|
# This function will read the RetroDECK config file into memory
|
||||||
# USAGE: conf_read
|
# USAGE: conf_read
|
||||||
|
|
|
@ -68,7 +68,7 @@ prepare_component() {
|
||||||
# Declare the global variable with the new setting value
|
# Declare the global variable with the new setting value
|
||||||
declare -g "$current_setting_name=$new_setting_value"
|
declare -g "$current_setting_name=$new_setting_value"
|
||||||
log d "Setting: $current_setting_name=$current_setting_value"
|
log d "Setting: $current_setting_name=$current_setting_value"
|
||||||
if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create a logs folder normally, we want to maintain the current files exactly to not lose early-install logs.
|
if [[ ! $current_setting_name == "logs_folder" ]]; then # Don't create a logs folder normally, we want to maintain the current files exactly to not lose early-install logs.
|
||||||
create_dir "$new_setting_value"
|
create_dir "$new_setting_value"
|
||||||
else # Log folder-specific actions
|
else # Log folder-specific actions
|
||||||
mv "$rd_logs_folder" "$logs_folder" # Move existing logs folder from internal to userland
|
mv "$rd_logs_folder" "$logs_folder" # Move existing logs folder from internal to userland
|
||||||
|
|
Loading…
Reference in a new issue