From adac400f09849dec5add7069c0be02030852a0c0 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Fri, 19 Apr 2024 11:17:16 +0900 Subject: [PATCH] RESET_COMPONENT: lowercasing and simplifying the code --- functions/prepare_component.sh | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/functions/prepare_component.sh b/functions/prepare_component.sh index a47e5fd2..da229d6b 100644 --- a/functions/prepare_component.sh +++ b/functions/prepare_component.sh @@ -10,7 +10,7 @@ prepare_component() { # USAGE: prepare_component "$action" "$component" "$call_source(optional)" action="$1" - component="$2" + component=$(echo "$2" | tr '[:upper:]' '[:lower:]') call_source="$3" log d "Preparing component: \"$component\", action: \"$action\"" @@ -48,7 +48,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(es-de|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 log i "--------------------------------" log i "Prepearing ES-DE" log i "--------------------------------" @@ -75,7 +75,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(retroarch|RetroArch|all)$ ]]; then + if [[ "$component" =~ ^(retroarch|all)$ ]]; then log i "--------------------------------" log i "Prepearing RetroArch" log i "--------------------------------" @@ -202,7 +202,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(citra|citra-emu|Citra|all)$ ]]; then + if [[ "$component" =~ ^(citra|citra-emu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" log i "Prepearing CITRA" @@ -247,7 +247,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(cemu|Cemu|all)$ ]]; then + if [[ "$component" =~ ^(cemu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing CEMU" @@ -274,7 +274,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(dolphin|dolphin-emu|Dolphin|all)$ ]]; then + if [[ "$component" =~ ^(dolphin|dolphin-emu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing DOLPHIN" @@ -327,7 +327,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(duckstation|Duckstation|all)$ ]]; then + if [[ "$component" =~ ^(duckstation|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" log i "Prepearing DUCKSTATION" @@ -372,7 +372,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(melonds|melonDS|MelonDS|all)$ ]]; then + if [[ "$component" =~ ^(melonds|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing MELONDS" @@ -410,7 +410,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(pcsx2|PCSX2|all)$ ]]; then + if [[ "$component" =~ ^(pcsx2|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing PCSX2" @@ -464,7 +464,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(ppsspp|PPSSPP|all)$ ]]; then + if [[ "$component" =~ ^(ppsspp|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" log i "Prepearing PPSSPPSDL" @@ -492,7 +492,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(primehack|Primehack|all)$ ]]; then + if [[ "$component" =~ ^(primehack|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing Primehack" @@ -535,7 +535,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(rpcs3|RPCS3|all)$ ]]; then + if [[ "$component" =~ ^(rpcs3|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" log i "Prepearing RPCS3" @@ -571,7 +571,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(ryujinx|Ryujinx|all)$ ]]; then + if [[ "$component" =~ ^(ryujinx|all)$ ]]; then # 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. if [[ "$action" == "reset" ]]; then # Run reset-only commands @@ -615,7 +615,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(yuzu|Yuzu|all)$ ]]; then + if [[ "$component" =~ ^(yuzu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing YUZU" @@ -668,7 +668,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(xemu|XEMU|all)$ ]]; then + if [[ "$component" =~ ^(xemu|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "------------------------" log i "Prepearing XEMU" @@ -712,7 +712,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(vita3k|Vita3K|all)$ ]]; then + if [[ "$component" =~ ^(vita3k|all)$ ]]; then if [[ "$action" == "reset" ]]; then # Run reset-only commands log i "----------------------" log i "Prepearing Vita3K" @@ -736,7 +736,7 @@ prepare_component() { fi fi - if [[ "$component" =~ ^(mame|MAME|all)$ ]]; then + if [[ "$component" =~ ^(mame|all)$ ]]; then # TODO: do a proper script # This is just a placeholder script to test the emulator's flow log i "----------------------" @@ -801,7 +801,7 @@ prepare_component() { fi - if [[ "$component" =~ ^(gzdoom|GZDOOM|all)$ ]]; then + if [[ "$component" =~ ^(gzdoom|all)$ ]]; then # TODO: do a proper script # This is just a placeholder script to test the emulator's flow log i "----------------------" @@ -821,7 +821,7 @@ prepare_component() { sed -i 's#RETRODECKSAVESDIR#'$saves_folder'#g' "/var/config/gzdoom/gzdoom.ini" # This is an unfortunate one-off because set_setting_value does not currently support JSON fi - if [[ "$component" =~ ^(boilr|BOILR|all)$ ]]; then + if [[ "$component" =~ ^(boilr|all)$ ]]; then log i "----------------------" log i "Prepearing BOILR" log i "----------------------" @@ -830,7 +830,7 @@ prepare_component() { cp -fvr "/app/libexec/steam-sync/config.toml" "/var/config/boilr" fi - if [[ ! "$component" =~ ^(retrodeck|es-de|ES-DE|retroarch|RetroArch|citra|citra-emu|Citra|cemu|Cemu|dolphin|dolphin-emu|Dolphin|duckstation|Duckstation|melonds|melonDS|MelonDS|pcsx2|PCSX2|pico8|pico-8|ppsspp|PPSSPP|primehack|Primehack|rpcs3|RPCS3|ryujinx|Ryujinx|yuzu|Yuzu|xemu|XEMU|vita3k|Vita3K|mame|MAME|gzdoom|GZDOOM|boilr|BOILR|)$ ]]; then + 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 log e "Supplied component $component not found, not resetting" fi