mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2024-11-25 15:35:38 +00:00
Improve prepare_component safelock
- Regarding this issue: https://github.com/XargonWan/RetroDECK/issues/757
This commit is contained in:
parent
37f120119b
commit
35a3f5fd71
|
@ -12,10 +12,12 @@ prepare_component() {
|
||||||
action="$1"
|
action="$1"
|
||||||
component=$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
component=$(echo "$2" | tr '[:upper:]' '[:lower:]')
|
||||||
call_source="$3"
|
call_source="$3"
|
||||||
|
component_found="false"
|
||||||
|
|
||||||
log d "Preparing component: \"$component\", action: \"$action\""
|
log d "Preparing component: \"$component\", action: \"$action\""
|
||||||
|
|
||||||
if [[ "$component" == "retrodeck" ]]; then
|
if [[ "$component" == "retrodeck" ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them
|
if [[ "$action" == "reset" ]]; then # Update the paths of all folders in retrodeck.cfg and create them
|
||||||
while read -r config_line; do
|
while read -r config_line; do
|
||||||
local current_setting_name=$(get_setting_name "$config_line" "retrodeck")
|
local current_setting_name=$(get_setting_name "$config_line" "retrodeck")
|
||||||
|
@ -49,6 +51,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(es-de|all)$ ]]; then # For use after ESDE-related folders are moved or a reset
|
if [[ "$component" =~ ^(es-de|all)$ ]]; then # For use after ESDE-related folders are moved or a reset
|
||||||
|
component_found="true"
|
||||||
log i "--------------------------------"
|
log i "--------------------------------"
|
||||||
log i "Prepearing ES-DE"
|
log i "Prepearing ES-DE"
|
||||||
log i "--------------------------------"
|
log i "--------------------------------"
|
||||||
|
@ -77,6 +80,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(retroarch|all)$ ]]; then
|
if [[ "$component" =~ ^(retroarch|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
log i "--------------------------------"
|
log i "--------------------------------"
|
||||||
log i "Prepearing RetroArch"
|
log i "Prepearing RetroArch"
|
||||||
log i "--------------------------------"
|
log i "--------------------------------"
|
||||||
|
@ -211,6 +215,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(citra|citra-emu|all)$ ]]; then
|
if [[ "$component" =~ ^(citra|citra-emu|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "------------------------"
|
log i "------------------------"
|
||||||
log i "Prepearing CITRA"
|
log i "Prepearing CITRA"
|
||||||
|
@ -256,6 +261,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(cemu|all)$ ]]; then
|
if [[ "$component" =~ ^(cemu|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing CEMU"
|
log i "Prepearing CEMU"
|
||||||
|
@ -283,6 +289,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(dolphin|dolphin-emu|all)$ ]]; then
|
if [[ "$component" =~ ^(dolphin|dolphin-emu|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing DOLPHIN"
|
log i "Prepearing DOLPHIN"
|
||||||
|
@ -336,6 +343,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(duckstation|all)$ ]]; then
|
if [[ "$component" =~ ^(duckstation|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "------------------------"
|
log i "------------------------"
|
||||||
log i "Prepearing DUCKSTATION"
|
log i "Prepearing DUCKSTATION"
|
||||||
|
@ -381,6 +389,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(melonds|all)$ ]]; then
|
if [[ "$component" =~ ^(melonds|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing MELONDS"
|
log i "Prepearing MELONDS"
|
||||||
|
@ -419,6 +428,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(pcsx2|all)$ ]]; then
|
if [[ "$component" =~ ^(pcsx2|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing PCSX2"
|
log i "Prepearing PCSX2"
|
||||||
|
@ -463,6 +473,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(pico8|pico-8|all)$ ]]; then
|
if [[ "$component" =~ ^(pico8|pico-8|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then
|
if [[ ("$action" == "reset") || ("$action" == "postmove") ]]; then
|
||||||
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
|
dir_prep "$bios_folder/pico-8" "$HOME/.lexaloffle/pico-8" # Store binary and config files together. The .lexaloffle directory is a hard-coded location for the PICO-8 config file, cannot be changed
|
||||||
dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
|
dir_prep "$roms_folder/pico8" "$bios_folder/pico-8/carts" # Symlink default game location to RD roms for cleanliness (this location is overridden anyway by the --root_path launch argument anyway)
|
||||||
|
@ -473,6 +484,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(ppsspp|all)$ ]]; then
|
if [[ "$component" =~ ^(ppsspp|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "------------------------"
|
log i "------------------------"
|
||||||
log i "Prepearing PPSSPPSDL"
|
log i "Prepearing PPSSPPSDL"
|
||||||
|
@ -501,6 +513,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(primehack|all)$ ]]; then
|
if [[ "$component" =~ ^(primehack|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing Primehack"
|
log i "Prepearing Primehack"
|
||||||
|
@ -544,6 +557,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(rpcs3|all)$ ]]; then
|
if [[ "$component" =~ ^(rpcs3|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "------------------------"
|
log i "------------------------"
|
||||||
log i "Prepearing RPCS3"
|
log i "Prepearing RPCS3"
|
||||||
|
@ -580,6 +594,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(ryujinx|all)$ ]]; then
|
if [[ "$component" =~ ^(ryujinx|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
# NOTE: for techincal reasons the system folder of Ryujinx IS NOT a sumlink of the bios/switch/keys as not only the keys are located there
|
# NOTE: for techincal reasons the system folder of Ryujinx IS NOT a sumlink of the bios/switch/keys as not only the keys are located there
|
||||||
# When RetroDECK starts there is a "manage_ryujinx_keys" function that symlinks the keys only in Rryujinx/system.
|
# When RetroDECK starts there is a "manage_ryujinx_keys" function that symlinks the keys only in Rryujinx/system.
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
|
@ -624,6 +639,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(yuzu|all)$ ]]; then
|
if [[ "$component" =~ ^(yuzu|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing YUZU"
|
log i "Prepearing YUZU"
|
||||||
|
@ -677,6 +693,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(xemu|all)$ ]]; then
|
if [[ "$component" =~ ^(xemu|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "------------------------"
|
log i "------------------------"
|
||||||
log i "Prepearing XEMU"
|
log i "Prepearing XEMU"
|
||||||
|
@ -721,6 +738,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(vita3k|all)$ ]]; then
|
if [[ "$component" =~ ^(vita3k|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
if [[ "$action" == "reset" ]]; then # Run reset-only commands
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing Vita3K"
|
log i "Prepearing Vita3K"
|
||||||
|
@ -745,6 +763,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(mame|all)$ ]]; then
|
if [[ "$component" =~ ^(mame|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
# TODO: do a proper script
|
# TODO: do a proper script
|
||||||
# This is just a placeholder script to test the emulator's flow
|
# This is just a placeholder script to test the emulator's flow
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
|
@ -814,6 +833,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(gzdoom|all)$ ]]; then
|
if [[ "$component" =~ ^(gzdoom|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
# TODO: do a proper script
|
# TODO: do a proper script
|
||||||
# This is just a placeholder script to test the emulator's flow
|
# This is just a placeholder script to test the emulator's flow
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
|
@ -834,6 +854,7 @@ prepare_component() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$component" =~ ^(boilr|all)$ ]]; then
|
if [[ "$component" =~ ^(boilr|all)$ ]]; then
|
||||||
|
component_found="true"
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
log i "Prepearing BOILR"
|
log i "Prepearing BOILR"
|
||||||
log i "----------------------"
|
log i "----------------------"
|
||||||
|
@ -842,7 +863,7 @@ prepare_component() {
|
||||||
cp -fvr "/app/libexec/steam-sync/config.toml" "/var/config/boilr"
|
cp -fvr "/app/libexec/steam-sync/config.toml" "/var/config/boilr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! "$component" =~ ^(retrodeck|es-de|retroarch|citra|citra-emu|cemu|dolphin|dolphin-emu|duckstation|melonds|melonDS|pcsx2|pico8|pico-8|ppsspp|primehack|rpcs3|ryujinx|yuzu|xemu|vita3k|mame|gzdoom|boilr|)$ ]]; then
|
if [[ $component_found="false" ]]; then
|
||||||
log e "Supplied component $component not found, not resetting"
|
log e "Supplied component $component not found, not resetting"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue