chore(scripts): use unpack for p7zip archives #191

Merged
Boria138 merged 1 commits from scripts-7z into main 2026-06-05 04:03:49 +00:00
9 changed files with 36 additions and 21 deletions

No files matched your search

@@ -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
@@ -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"
@@ -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"
@@ -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}"
@@ -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"
@@ -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}"
@@ -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"
@@ -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"
@@ -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"