From 0e0ec3028d713758805d7eff698e10b0c3f641b0 Mon Sep 17 00:00:00 2001 From: Htylol Date: Mon, 28 Oct 2024 23:49:24 +0500 Subject: [PATCH] minor edition --- data_from_portwine/scripts/functions_helper | 11 +++++++---- data_from_portwine/scripts/start.sh | 10 ++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index a00ae2f7..a52d32ca 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -63,12 +63,15 @@ export -f make_abbreviation check_variables () { [[ -z ${!1} ]] && export $1="$2" ;} -cli_edit_db () { +# Эксортирует несколько переменных за один раз (одной командой) +# и создаёт список этих переменных в $keys_all +# К примеру set_several_variables PW_MANGOHUD=1 PW_VKBASALT=0 +set_several_variables () { local key value unset keys_all - while (( $# > 0 )); do - key=$(echo "$1" | cut -d'=' -f1) - value=$(echo "$1" | cut -d'=' -f2) + while (( $# > 0 )) ; do + key=${1//=*/} + value=${1//*=/} keys_all+="$key " export "$key"="$value" shift diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index 2c793256..27aa9e64 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -56,7 +56,7 @@ if [[ "$1" == *.[Pp][Pp][Aa][Cc][Kk] ]] ; then elif [[ -f "$1" ]] ; then portwine_exe="$(realpath -s "$1")" elif [[ -f "$OLDPWD/$1" ]] \ -&& [[ "$1" == *.[Ee][Xx][Ee] || "$1" == *.[Bb][Aa][Tt] || "$1" == *.[Rr][Ee][Gg] || "$1" == *.[Mm][Ss][Ii] ]] +&& [[ "$1" =~ (.[Ee][Xx][Ee]$|.[Bb][Aa][Tt]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] then portwine_exe="$(realpath -s "$OLDPWD/$1")" elif [[ "$1" =~ (^--debug$|^--launch$|^--edit-db$) ]] \ @@ -65,10 +65,10 @@ then portwine_exe="$(realpath -s "$2")" elif [[ "$1" =~ (^--debug$|^--launch$|^--edit-db$) ]] \ && [[ -f "$OLDPWD/$2" ]] \ -&& [[ "$2" == *.[Ee][Xx][Ee] || "$2" == *.[Bb][Aa][Tt] || "$2" == *.[Rr][Ee][Gg] || "$2" == *.[Mm][Ss][Ii] ]] +&& [[ "$2" =~ (.[Ee][Xx][Ee]$|.[Bb][Aa][Tt]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] then portwine_exe="$(realpath -s "$OLDPWD/$2")" -elif [[ "$1" == *.[Ee][Xx][Ee] || "$1" == *.[Bb][Aa][Tt] || "$1" == *.[Mm][Ss][Ii] || "$1" == *.[Rr][Ee][Gg] ]] +elif [[ "$1" =~ (.[Ee][Xx][Ee]$|.[Bb][Aa][Tt]$|.[Mm][Ss][Ii]$|.[Rr][Ee][Gg]$) ]] then portwine_exe="$1" MISSING_DESKTOP_FILE="1" @@ -415,14 +415,12 @@ use: [--repair] [--reinstall] [--autoinstall] gui_pw_update ;; '--launch' ) - export START_FROM_STEAM=1 - export LD_PRELOAD= portwine_launch stop_portwine ;; '--edit-db' ) # --edit-db /полный/путь/до/файла.exe PW_MANGOHUD=1 PW_VKBASALT=0 (и т.д) для примера - cli_edit_db ${@:3} + set_several_variables ${@:3} edit_db_from_gui $keys_all exit 0 ;; esac