From a04b0e41e9cc33140f0d3714b74566b1fedc0c46 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Fri, 5 Jun 2026 09:00:46 +0500 Subject: [PATCH] chore(scripts): use unpack for p7zip archives Signed-off-by: Boris Yumankulov --- .../share/portproton/scripts/functions_helper | 37 +++++++++++++------ .../pw_autoinstall/PW_DC_UNIVERSE_ONLINE | 2 +- .../portproton/scripts/pw_autoinstall/PW_EVE | 4 +- .../scripts/pw_autoinstall/PW_FARLIGHT84 | 4 +- .../scripts/pw_autoinstall/PW_LAST_CHAOS | 2 +- .../scripts/pw_autoinstall/PW_LOST_LIGHT | 2 +- .../scripts/pw_autoinstall/PW_MINI_WORLD | 2 +- .../scripts/pw_autoinstall/PW_RISE_OF_FLIGHT | 2 +- .../scripts/pw_autoinstall/PW_SATURN | 2 +- 9 files changed, 36 insertions(+), 21 deletions(-) diff --git a/build-aux/share/portproton/scripts/functions_helper b/build-aux/share/portproton/scripts/functions_helper index c6384757..6423eb1b 100755 --- a/build-aux/share/portproton/scripts/functions_helper +++ b/build-aux/share/portproton/scripts/functions_helper @@ -689,6 +689,16 @@ unpack () { *.tar.gz) local command="tar -xhzf" ;; *.tar.zst) local command="tar -I zstd -xhf" ;; *.tar) local command="tar -xhf" ;; + *.7z|*.zip|*.exe|*.nupkg) + if [[ -z "$pw_7z" ]] ; then + if command -v 7z &>/dev/null + then pw_7z="7z" + else pw_7z="${PW_PLUGINS_PATH}/portable/lib/p7zip/7z" + fi + fi + local command="$pw_7z" + local is_p7zip=true + ;; esac case $3 in @@ -697,15 +707,27 @@ unpack () { # If gamescope session is active, use PW_TERM for unpack if check_gamescope_session ; then - $PW_TERM "echo ; echo ; echo \"Unpacking file: $1. Please wait...\" ; $command \"$1\" -C \"$2\"" + if [[ "$is_p7zip" == "true" ]] ; then + $PW_TERM "echo ; echo ; echo \"Unpacking file: $1. Please wait...\" ; \"$command\" x -y \"$1\" -o\"$2\"" + else + $PW_TERM "echo ; echo ; echo \"Unpacking file: $1. Please wait...\" ; $command \"$1\" -C \"$2\"" + fi [[ "$?" != 0 ]] && return 1 || return 0 elif [[ "$silent" != "true" ]] ; then print_info "Unpacking file: $(basename "$1") Please wait..." set -o pipefail - $command "$1" -C "$2" 2>/dev/null + if [[ "$is_p7zip" == "true" ]] ; then + "$command" x -y "$1" "-o$2" 2>/dev/null + else + $command "$1" -C "$2" 2>/dev/null + fi [[ "${PIPESTATUS[0]}" != 0 ]] && print_error "File $1 unpacking error." && return 1 || return 0 else - $command "$1" -C "$2" && return 0 || return 1 + if [[ "$is_p7zip" == "true" ]] ; then + "$command" x -y "$1" "-o$2" && return 0 || return 1 + else + $command "$1" -C "$2" && return 0 || return 1 + fi fi } @@ -1818,10 +1840,6 @@ pw_check_and_download_plugins () { # export PW_PLUGINS_PATH="${PORT_WINE_TMP_PATH}/plugins${PW_PLUGINS_VER}" fi fi - if command -v 7z &>/dev/null - then export pw_7z="7z" - else export pw_7z="${PW_PLUGINS_PATH}/portable/lib/p7zip/7z" - fi return 0 } @@ -2507,10 +2525,7 @@ pw_specialk_sync_files () { if [[ ! -d "$SPECIALK_PATH" ]] && try_download "github.com/SpecialKO/SpecialK/releases/download/${PW_SPECIALK_VER}/SpecialK.7z" "${PORT_DATA_PATH}/data/tmp/SpecialK.7z" ; then create_new_dir "$SPECIALK_PATH" - if [[ -z "$pw_7z" ]] ; then - if command -v 7z &>/dev/null ; then pw_7z="7z"; else pw_7z="${PW_PLUGINS_PATH}/portable/lib/p7zip/7z"; fi - fi - $pw_7z x "${PORT_DATA_PATH}/data/tmp/SpecialK.7z" -o"$SPECIALK_PATH" >/dev/null + unpack "${PORT_DATA_PATH}/data/tmp/SpecialK.7z" "$SPECIALK_PATH" silent try_remove_file "${PORT_DATA_PATH}/data/tmp/SpecialK.7z" fi diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_DC_UNIVERSE_ONLINE b/build-aux/share/portproton/scripts/pw_autoinstall/PW_DC_UNIVERSE_ONLINE index c1b24476..6c9aeccf 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_DC_UNIVERSE_ONLINE +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_DC_UNIVERSE_ONLINE @@ -13,7 +13,7 @@ export PORTWINE_CREATE_SHORTCUT_NAME="DC Universe Online" start_portproton if try_download "https://launch.daybreakgames.com/installer/DCUO_setup.exe" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/Daybreak Game Company" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/Program Files (x86)/Daybreak Game Company" PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/Daybreak Game Company/LaunchPad.exe" try_remove_file "${PW_AUTOINSTALL_EXE}" try_remove_file "${PW_EXE_FILE}.ppdb" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_EVE b/build-aux/share/portproton/scripts/pw_autoinstall/PW_EVE index 947341a1..74d4e894 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_EVE +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_EVE @@ -26,10 +26,10 @@ if try_download "https://launcher.ccpgames.com/eve-online/release/win32/x64/eve- then EVE_LAUNCHER_DIR="${WINEPREFIX}/drive_c/users/steamuser/AppData/Local/eve-online" - $pw_7z x "${PORT_WINE_TMP_PATH}/eve-online-latest+Setup.exe" -o"${EVE_LAUNCHER_DIR}" -y + unpack "${PORT_WINE_TMP_PATH}/eve-online-latest+Setup.exe" "${EVE_LAUNCHER_DIR}" EVE_VERSION="$(cat "${EVE_LAUNCHER_DIR}/RELEASES" | awk '{print $2}' | awk -F"-" '{print $3}')" - $pw_7z x "${EVE_LAUNCHER_DIR}/eve-online-${EVE_VERSION}-full.nupkg" -o"${EVE_LAUNCHER_DIR}/tmp" -y + unpack "${EVE_LAUNCHER_DIR}/eve-online-${EVE_VERSION}-full.nupkg" "${EVE_LAUNCHER_DIR}/tmp" create_new_dir "${EVE_LAUNCHER_DIR}/app-$EVE_VERSION" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_FARLIGHT84 b/build-aux/share/portproton/scripts/pw_autoinstall/PW_FARLIGHT84 index bbc544bf..45cc95e5 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_FARLIGHT84 +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_FARLIGHT84 @@ -15,8 +15,8 @@ start_portproton if try_download "https://static-gl.lilithgame.com/p/pcsdk/launcher/10060/prodef4621e968ad6b383b8754148b63/0/launcher/res/release/Farlight84_setup_1.3.0.1_238.exe" "${PW_AUTOINSTALL_EXE}" no_mirror then create_new_dir "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84" - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/Farlight84" - "$pw_7z" x -y "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84/launcher.7z" -o"$WINEPREFIX/drive_c/Program Files (x86)/Farlight84" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84" + unpack "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84/launcher.7z" "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84" PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/Farlight84/Farlight84Launcher.exe" try_remove_file "$WINEPREFIX/drive_c/Program Files (x86)/Farlight84/launcher.7z" try_remove_file "${PW_AUTOINSTALL_EXE}" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_LAST_CHAOS b/build-aux/share/portproton/scripts/pw_autoinstall/PW_LAST_CHAOS index 720dd20c..3c91b863 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_LAST_CHAOS +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_LAST_CHAOS @@ -13,7 +13,7 @@ export PORTWINE_CREATE_SHORTCUT_NAME="Last Chaos" start_portproton if try_download "https://last-chaos.ru/download/Last%20Chaos.zip" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"${WINEPREFIX}/drive_c/Program Files/" + unpack "${PW_AUTOINSTALL_EXE}" "${WINEPREFIX}/drive_c/Program Files/" PW_EXE_FILE="${WINEPREFIX}/drive_c/Program Files/Last Chaos/LC.exe" try_remove_file "${PW_AUTOINSTALL_EXE}" try_remove_file "${PW_EXE_FILE}.ppdb" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_LOST_LIGHT b/build-aux/share/portproton/scripts/pw_autoinstall/PW_LOST_LIGHT index 550827c1..82572cba 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_LOST_LIGHT +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_LOST_LIGHT @@ -15,7 +15,7 @@ URL_LOST_LIGHT="$(curl -s --list-only "https://adl.easebar.com/d/g/yhtj/c/lostli start_portproton if try_download "${URL_LOST_LIGHT}" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/LostLight" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/Program Files (x86)/LostLight" export PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/LostLight/launcher.exe" pw_create_unique_exe "lostlight_launcher_pp" try_remove_file "${PW_AUTOINSTALL_EXE}" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_MINI_WORLD b/build-aux/share/portproton/scripts/pw_autoinstall/PW_MINI_WORLD index a021bd40..b58c07e0 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_MINI_WORLD +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_MINI_WORLD @@ -15,7 +15,7 @@ export PORTWINE_CREATE_SHORTCUT_NAME="Mini World" start_portproton if try_download "https://mwu-api.miniworldgame.com/app_install/${URL_VER//[[:space:]]/}universal" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/miniworldOverseasgame" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/miniworldOverseasgame" PW_EXE_FILE="$WINEPREFIX/drive_c/users/steamuser/AppData/Roaming/miniworldOverseasgame/MicroMiniNew.exe" try_remove_file "${PW_AUTOINSTALL_EXE}" try_remove_file "${PW_EXE_FILE}.ppdb" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_RISE_OF_FLIGHT b/build-aux/share/portproton/scripts/pw_autoinstall/PW_RISE_OF_FLIGHT index 1ee2d575..b95c7bda 100755 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_RISE_OF_FLIGHT +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_RISE_OF_FLIGHT @@ -14,7 +14,7 @@ export PORTWINE_CREATE_SHORTCUT_NAME="Rise of Flight" start_portproton if try_download "https://il2bosrd1.cdnvideo.ru/ROF/ROF_UE.zip" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/1C-777/Rise of Flight" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/Program Files (x86)/1C-777/Rise of Flight" pw_kill_autostart "3rd_party" & pw_run "$WINEPREFIX/drive_c/Program Files (x86)/1C-777/Rise of Flight/ROF_UE/setup.exe" PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/1C-777/Rise of Flight/bin_game/release/rof_updater.exe" diff --git a/build-aux/share/portproton/scripts/pw_autoinstall/PW_SATURN b/build-aux/share/portproton/scripts/pw_autoinstall/PW_SATURN index 81146541..3bf836ee 100644 --- a/build-aux/share/portproton/scripts/pw_autoinstall/PW_SATURN +++ b/build-aux/share/portproton/scripts/pw_autoinstall/PW_SATURN @@ -12,7 +12,7 @@ export PW_AUTOINSTALL_EXE="${PORT_WINE_TMP_PATH}/saturn.zip" start_portproton if try_download "https://cdn-s3.quadrosim.ru/saturn/saturn.zip" "${PW_AUTOINSTALL_EXE}" no_mirror then - "$pw_7z" x -y "${PW_AUTOINSTALL_EXE}" -o"$WINEPREFIX/drive_c/Program Files (x86)/saturn" + unpack "${PW_AUTOINSTALL_EXE}" "$WINEPREFIX/drive_c/Program Files (x86)/saturn" PW_EXE_FILE="$WINEPREFIX/drive_c/Program Files (x86)/saturn/Saturn.exe" try_remove_file "${PW_AUTOINSTALL_EXE}" try_remove_file "${PW_EXE_FILE}.ppdb" -- 2.54.0