From faf1902eb45342b400fda900918159b96d7a29a0 Mon Sep 17 00:00:00 2001 From: VHSgunzo Date: Thu, 16 Jan 2025 22:20:10 +0300 Subject: [PATCH] v0.80.1 --- CHANGELOG.md | 18 + LICENSE | 2 +- README.md | 3 +- lux-wine | 57 +--- lwrap/PKGBUILD | 10 +- lwrap/lwexec | 109 ------ lwrap/lwrap | 797 +++++++++++++------------------------------- lwrap/lwrap.install | 19 +- 8 files changed, 283 insertions(+), 732 deletions(-) delete mode 100755 lwrap/lwexec diff --git a/CHANGELOG.md b/CHANGELOG.md index 580389f..f92f107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# v0.80.1 + +* Update [lwrun](https://github.com/VHSgunzo/runimage/releases/download/v0.40.1) container `v0.40.1` +* Update [GE-Proton](https://github.com/VHSgunzo/ge-proton-lw/releases/tag/v9.22) `v9.22` +* Change container filesystem to [DwarFS](https://github.com/mhx/dwarfs) (reduce size) +* Enable `OverlayFS` (read-write) mode by default +* Now you can install any apps and updates from the container repos without rebuilding the container +* Fix `firefox`, `steam`, `lux-wine` decorations (now as in the system) +* Remove `AMDVLK` vulkan driver +* Update `lwrap` +* Add `ru_RU.KOI8-R` locale +* Remove `lwexec` and all the other pieces that are now part of the container. +* Add [continuous](https://github.com/VHSgunzo/lwrun/releases/download/continuous) update CI for lwrun +* Add ability to enable sandbox for `HOME` or create tmpfs `HOME` +* Add ability to `lwrun` to system `/usr/bin` `/bin` `/opt` path +* Replace `glibc` and `lib32-glibc` with `glibc-eac` and `lib32-glibc-eac` +* Add an attempt to use a local proprietary Nvidia driver (if there are no 32-bit libs, the driver will be downloaded as before) + # v0.78.5.5 * Update [lwrun](https://huggingface.co/lux-wine/lwrun/tree/main/releases/v0.39.1) packages diff --git a/LICENSE b/LICENSE index 2721e2f..f74c4e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 VHSgunzo +Copyright (c) 2025 VHSgunzo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 8b00945..5ffc027 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ wget -qO - lux-wine-git.static.hf.space|sed 1d|bash ## **Terminal usage**: ``` ┌──[user@linux]─[~] -└──╼ $ lwrap {lwrap arg} blabla.exe {exe args} +└──╼ $ lwrun {lwrun arg} blabla.exe {exe args} -explorer Wine explorer -cmd Open CMD or open file in CMD @@ -107,6 +107,7 @@ lwrun --uninstall - [x] Easy installation without root rights and dependencies - [x] The ability to install completely offline - [x] Own portable [lwrun container](https://github.com/VHSgunzo/lwrun) with isolation from the host system +- [x] Ability to install apps from container repositories without root permissions - [x] Automatic rolling update system - [x] Quick initialization and launch - [x] Ability to specify EXE arguments and save them in settings diff --git a/lux-wine b/lux-wine index 8c91631..d5ee2f7 100755 --- a/lux-wine +++ b/lux-wine @@ -1,6 +1,6 @@ #!/usr/bin/env bash -export LW_VERSION="0.78.5.5" +export LW_VERSION="0.80.1" export LW_DEVELOPERS="VHSgunzo" export RED='\033[1;91m' @@ -59,7 +59,7 @@ OLD_LW_DIR="$HOME/.local/share/LutrisWine" [ ! -n "$LW_NAME" ] && export LW_NAME="$(basename "$0")" [ ! -n "$LW_DIR" ] && export LW_DIR="$HOME/.local/share/LuxWine" [ ! -n "$LW_BIN_DIR" ] && export LW_BIN_DIR="$LW_DIR/bin" -[ ! -n "$LWRAP" ] && export LWRAP="$LW_BIN_DIR/lwrap" +[ ! -n "$LWRUN" ] && export LWRUN="$LW_BIN_DIR/lwrun" if [ ! -n "$LW_TRAY" ] then [ "$DESKTOP_SESSION" == "plasma" ] && \ @@ -1561,7 +1561,7 @@ create_shortcut() { SHRT_NAME="$SHRT_NAME ($(basename "$WINEPREFIX"))" DESKF="${LW_DEF_TMP}/${SHRT_NAME}.desktop" echo "[Desktop Entry]" > "$DESKF" - (LW_SOURCE="$LWRAP" + (LW_SOURCE="$LWRUN" [[ "$1" =~ "'" ]] && \ SHRTEXEPATH="\"$1\""||\ SHRTEXEPATH="'$1'" @@ -3770,11 +3770,11 @@ is_app_exist() { do [ -n "$(if [ -n "$args" ] then - awk -v s="Exec='$LWRAP' '$1' $args" '$0==s' "$app" 2>/dev/null - awk -v s="Exec='$LWRAP' \"$1\" $args" '$0==s' "$app" 2>/dev/null + awk -v s="Exec='$LWRUN' '$1' $args" '$0==s' "$app" 2>/dev/null + awk -v s="Exec='$LWRUN' \"$1\" $args" '$0==s' "$app" 2>/dev/null else - awk -v s="Exec='$LWRAP' '$1'" '$0==s' "$app" 2>/dev/null - awk -v s="Exec='$LWRAP' \"$1\"" '$0==s' "$app" 2>/dev/null + awk -v s="Exec='$LWRUN' '$1'" '$0==s' "$app" 2>/dev/null + awk -v s="Exec='$LWRUN' \"$1\"" '$0==s' "$app" 2>/dev/null fi|head -1)" ] && ret=0 && echo "$app" && break done return $ret @@ -4160,13 +4160,11 @@ lu_help() { exit 1 fi echo_help() { - [[ "$RUNSRC" =~ "lwrun" ]] && \ - local LW_NAME="lwrap" echo -e " ${GREEN}Lux Wine ${RED}v${LW_VERSION} ${GREEN}by $LW_DEVELOPERS ${RED}Usage: $RED┌──[$GREEN$USER$YELLOW@$BLUE`uname -a|awk '{print$2}'`$RED]─[$GREEN$PWD$RED] - $RED└──╼ \$$GREEN $LW_NAME $BLUE{$LW_NAME arg} ${RED}blabla.exe $YELLOW{exe args} + $RED└──╼ \$$GREEN lwrun $BLUE{lwrun arg} ${RED}blabla.exe $YELLOW{exe args} ${RED}-explorer $GREEN Wine explorer ${RED}-cmd $GREEN Open CMD or open file in CMD @@ -6915,44 +6913,6 @@ if [[ "$EUID" == 0 && "$ALLOW_ROOT" != 1 ]] print_error yad "Don't run Lux Wine as root!" exit 1 else - (if [[ "$RUNSRC" =~ "lwrun" ]] - then - lwait_fl="/tmp/.lwait.$RUNPID" - [[ -f "$lwait_fl" && ! -d "/proc/$RUNPID" ]] && \ - rm -f "$lwait_fl" - if [ ! -f "$lwait_fl" ] - then - find_processes() { - processes="$(ls -l /proc/*/exe 2>/dev/null|grep ' ->')" - for ps in "${IGNPS[@]}" - do processes="$(grep -wv "$ps"<<<"$processes")" - done - } - IGNPS=( - 'tee' 'ls' 'ssrv' 'cat' 'tini' - 'sleep' 'gamemoded' 'bash' 'grep' - ) - find_processes - wait_lwpids=100 - while [[ "$wait_lwpids" -gt 0 && \ - ! -n "$processes" && -d "/proc/$LWPID" ]] - do - wait_lwpids="$(( $wait_lwpids - 1 ))" - sleep 0.01 2>/dev/null - find_processes - done - touch "$lwait_fl" - while [[ -f "$lwait_fl" && \ - -n "$processes" && -d "/proc/$LWPID" ]] - do - sleep 1 - find_processes - done - rm -f "$lwait_fl" - sleep 0.5 - fi - fi) 2>/dev/null & - lwait_pid=$! lite_init "$@" case $1 in -init) full_init "$@" ;; @@ -6992,4 +6952,3 @@ if [[ "$EUID" == 0 && "$ALLOW_ROOT" != 1 ]] *) lu_start "$@" ;; esac fi -wait "$lwait_pid" &>/dev/null diff --git a/lwrap/PKGBUILD b/lwrap/PKGBUILD index 5e1fbdd..9037bf2 100644 --- a/lwrap/PKGBUILD +++ b/lwrap/PKGBUILD @@ -1,8 +1,8 @@ # Maintainer: VHSgunzo pkgname='lwrap' -pkgver='0.78.5' -pkgrel='5' +pkgver='0.80' +pkgrel='1' pkgdesc='Lux Wine wrapper for RunImage container' arch=('x86_64') url='https://github.com/VHSgunzo/lux-wine' @@ -41,8 +41,8 @@ optdepends=( 'lib32-opencl-icd-loader' 'opencl-icd-loader' 'lib32-llvm' 'wine-prefix-dotnet' ) -source=('lwrap' 'lwexec') -sha256sums=('SKIP' 'SKIP') +source=('lwrap') +sha256sums=('SKIP') install='lwrap.install' shopt -s extglob @@ -50,9 +50,9 @@ shopt -s extglob package() { install -dm755 "$pkgdir/usr/bin" install -Dm755 "$pkgname" "$pkgdir/opt/$pkgname/bin/$pkgname" - install -Dm755 "lwexec" "$pkgdir/opt/$pkgname/bin/lwexec" cp -ar --no-preserve=ownership "$(realpath ../../)"/!(.git*|$pkgname|lutris-wine) "$pkgdir/opt/$pkgname" mv -f "$pkgdir/opt/$pkgname/lux-wine" "$pkgdir/opt/$pkgname/bin/lux-wine" + ln -sfr "$pkgdir/opt/$pkgname/bin/lux-wine" "$pkgdir/usr/bin/lux-wine" ln -sfr "$pkgdir/opt/$pkgname/bin/$pkgname" "$pkgdir/usr/bin/$pkgname" mkdir -p "$pkgdir/usr"/{lib,lib32} ln -sfr "$pkgdir/usr/lib/syslog-ng/libcef.so" "$pkgdir/usr/lib/libcef.so" diff --git a/lwrap/lwexec b/lwrap/lwexec deleted file mode 100755 index 289bdb1..0000000 --- a/lwrap/lwexec +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash - -PATH="$PATH:$RUNSTATIC" -JOBNUMFL="$LWEXECFLDIR/job" - -get_child_pids() { - local child_pids="$(ps --forest -o pid= -g $(ps -o sid= -p $1 2>/dev/null) 2>/dev/null)" - echo -e "$1\n$(ps -o pid=,cmd= -p $child_pids 2>/dev/null|sort -n|\ - sed "0,/$1/d" 2>/dev/null|grep -Pv '\d+ sleep \d+'|awk '{print$1}')"|sort -nu -} - -try_kill() { - ret=1 - if [ -n "$1" ] - then - for pid in $1 - do - trykillnum=1 - while [[ -n "$pid" && -d "/proc/$pid" ]] - do - if [[ "$trykillnum" -le 3 ]] - then - kill -2 $pid 2>/dev/null - ret=$? - sleep 0.05 - else - kill -9 $pid 2>/dev/null - ret=$? - wait $pid &>/dev/null - wait_pid "$pid" - fi - trykillnum="$(( $trykillnum + 1 ))" - done - done - fi - return $ret -} - -wait_pid() { - if [ -n "$1" ] - then - if [ "$UNLIM_WAIT" == 1 ] - then - while [ -d "/proc/$1" ]; do sleep 0.1; done - else - [ -n "$2" ] && \ - timeout="$2"|| - timeout="100" - waittime=1 - while [[ -d "/proc/$1" && "$waittime" -le "$timeout" ]] - do - sleep 0.01 - waittime="$(( $waittime + 1 ))" - done - fi - fi -} - -killjobpids() { try_kill "$(get_child_pids "$execjobpid")" ; } - -check_args_spaces() { - for arg in "$@" - do - (echo "$arg"|grep -Po '\s' &>/dev/null||\ - echo "$arg"|grep -Eo '.*(.*|.*).*' &>/dev/null) && \ - arg="$(echo "$arg"|sed 's|.*|"&"|' 2>/dev/null)" - args+=("$arg") - done -} - -cleanup() { [[ -d "$execjobdir" && -n "$jobnum" ]] && rm -rf "$execjobdir" 2>/dev/null ; } - -if [[ -d "$LWEXECFLDIR" && -e "$JOBNUMFL" ]] - then - trap 'killjobpids;cleanup' SIGINT SIGTERM - trap 'cleanup' EXIT - unset args - jobnum="$(cat "$JOBNUMFL" 2>/dev/null)" - if [ -n "$jobnum" ] - then - execjobdir="$LWEXECFLDIR/$jobnum" - execenvfl="$execjobdir/env" - execjobfl="$execjobdir/exec" - execjoboutfl="$execjobdir/out" - execjobstatfl="$execjobdir/stat" - export -p|\ - grep -v 'SHELL='|\ - grep -v 'DISPLAY='|\ - grep -v 'XDG_DATA_DIRS='|\ - grep -v 'XDG_CONFIG_DIRS='|\ - grep -v 'XDG_RUNTIME_DIR='|\ - grep -v 'DBUS_SESSION_BUS_ADDRESS=' \ - > "$execenvfl" 2>/dev/null - if [ -n "$1" ] - then - check_args_spaces "$@" - echo "${args[@]}" > "$execjobfl" - else cat > "$execjobfl" 2>/dev/null - fi - execjobpid="$(cat "$execjobstatfl" 2>/dev/null)" - cat "$execjoboutfl" 2>/dev/null - execstat="$(cat "$execjobstatfl" 2>/dev/null)" - fi - [ -n "$execstat" ]||execstat=1 - exit $execstat - else - echo "LWEXECFLDIR is not configured!" - exit 1 -fi diff --git a/lwrap/lwrap b/lwrap/lwrap index 2c3b11a..a1c8701 100755 --- a/lwrap/lwrap +++ b/lwrap/lwrap @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/bash # Lux Wine wrapper for RunImage container shopt -s extglob @@ -9,50 +9,20 @@ GREEN='\033[1;92m' YELLOW='\033[1;33m' RESETCOLOR='\033[1;00m' -# YC_S3="https://storage.yandexcloud.net" -GIT_REPO='https://github.com/VHSgunzo' -GIT_HF_REPO='https://huggingface.co/spaces/lux-wine' -# GIT_YC_REPO="$YC_S3/lux-wine" LW_DIR="$HOME/.local/share/LuxWine" MENU_APPS_DIR="$HOME/.local/share/applications" -LW_APPS_DIR="$MENU_APPS_DIR/LuxWineApps" LW_CFG="$LW_DIR/luwine.wcfg" -TMP_LW_CFG="$LW_DIR/tmp/luwine.wcfg" LWBIN_DIR="$LW_DIR/bin" -LWSRC="$LWBIN_DIR/lux-wine" -GIT_RAW='https://raw.githubusercontent.com/VHSgunzo/lux-wine/main' -GIT_LWSRC="$GIT_RAW/lux-wine" -GIT_HF_LWSRC="$GIT_HF_REPO/git/resolve/main/lux-wine" -# GIT_YC_LWSRC="$GIT_YC_REPO/git/lux-wine" -GIT_LWZIP="$GIT_REPO/lux-wine/archive/refs/heads/main.zip" -GIT_HF_LWZIP="$GIT_HF_REPO/git/resolve/main/main.zip" -# GIT_YC_LWZIP="$GIT_YC_REPO/main.zip" -GIT_LWRAP="$GIT_RAW/lwrap/lwrap" -GIT_HF_LWRAP="$GIT_HF_REPO/git/resolve/main/lwrap/lwrap" -# GIT_YC_LWRAP="$GIT_YC_REPO/git/lwrap/lwrap" -GIT_LWRUN="$GIT_REPO/lwrun/releases" -GIT_HF_LWRUN="${GIT_HF_REPO//\/spaces/}/lwrun/resolve/main/releases" -# YC_LWRUN="$YC_S3/lwrun" +LWSRC='/opt/lwrap/bin/lux-wine' HOME_ICONS="$HOME/.local/share/icons" HOME_DESK_DIRS="$HOME/.local/share/desktop-directories" HSTEAM_DESKF="$MENU_APPS_DIR/steam-lw.desktop" -RSTEAM_DESKF="$RUNROOTFS/usr/share/applications/steam.desktop" -F_RC="$HOME/.config/fish/config.fish" -B_RC="$HOME/.bashrc" -Z_RC="$HOME/.zshrc" HBIN_DIR="$HOME/.local/bin" LWRUN_LN="$HBIN_DIR/lwrun" -LWRAP_LN="$HBIN_DIR/lwrap" -LWRAP="$LWBIN_DIR/lwrap" -LWBASH="$LWBIN_DIR/bash" +OLDLWRAP="$LWBIN_DIR/lwrap" LWRUN="$LWBIN_DIR/lwrun" RUNIMAGE_LW="$LWBIN_DIR/runimage-lw" -LWRAP_DIR='/opt/lwrap' -LWRUNTIME="$LWRAP_DIR/runtime.tar.zst" -HLWDIRLN="$HOME/LuxWine" -LW_DEF_TMP="$LW_DIR/tmp" -LWRPIDFL="$LW_DEF_TMP/lwrpid" -LWEXEC="$LWBIN_DIR/lwexec" +PKGUPDFL="$LWBIN_DIR/.update" HICOLOR_SIZES=( "512x512" "256x256" "192x192" "128x128" "96x96" "80x80" "72x72" "64x64" "48x48" @@ -64,20 +34,12 @@ LW_MIMETYPES=( 'application/x-ms-shortcut' 'text/x-ms-regedit' ) -if [[ -n "$RUNSRC" && -d "$RUNROOTFS" ]] && \ - [[ -x "$LWRAP" && "$NO_EXT_LWRAP" != 1 ]] - then - NO_EXT_LWRAP=1 "$LWRAP" "$@" - exit $? -fi -unset NO_EXT_LWRAP - CFG_CHK_UPDATE="$(grep '^CHK_UPDATE=.*$' "$LW_CFG" 2>/dev/null)" [ -n "$CFG_CHK_UPDATE" ] && \ eval "$CFG_CHK_UPDATE"||\ CHK_UPDATE='3' -[ ! -n "$(tty|grep -v 'not a'|grep -Eo 'tty|pts')" ] && \ +[[ ! "$(LANG= tty|grep -v 'not a')" =~ tty|pts ]] && \ NOT_TERM=1||NOT_TERM=0 error_msg() { @@ -107,124 +69,96 @@ warn_msg() { fi } -check_path() { - if [ "$1" == "$F_RC" ] - then grep -om1 '^set -U fish_user_paths "$HOME/.local/bin"' "$1" &>/dev/null - else grep -om1 '^export PATH=.*/.local/bin' "$1" &>/dev/null - fi -} - -add_path() { - if [ "$1" == "$F_RC" ] - then check_path "$1"||(mkdir -p "$(dirname "$1")" && echo -e '\nset -U fish_user_paths "$HOME/.local/bin"' >> "$1") - else check_path "$1"||echo -e '\nexport PATH="$HOME/.local/bin:$PATH"' >> "$1" - fi -} - -ln_lwrap() { [[ -x "$LWRAP" && -x "$LWRAP_LN" ]]||(mkdir -p "$HBIN_DIR" && ln -sfr "$LWRAP" "$LWRAP_LN") ; } - make_install() { + add_path() { + check_path() { + if [ "$1" == "$F_RC" ] + then grep -om1 '^set -U fish_user_paths "$HOME/.local/bin"' "$1" &>/dev/null + else grep -om1 '^export PATH=.*/.local/bin' "$1" &>/dev/null + fi + } + if [ "$1" == "$F_RC" ] + then check_path "$1"||(mkdir -p "$(dirname "$1")" && echo -e '\nset -U fish_user_paths "$HOME/.local/bin"' >> "$1") + else check_path "$1"||echo -e '\nexport PATH="$HOME/.local/bin:$PATH"' >> "$1" + fi + } + F_RC="$HOME/.config/fish/config.fish" + B_RC="$HOME/.bashrc" + Z_RC="$HOME/.zshrc" if [ "$1" == "force" ] then QUIET_MODE=1 uninstall_lw force else QUIET_MODE=1 uninstall_lw update fi - [ -f 'lux-wine' ] && \ - local lwf='lux-wine'||\ - local lwf='bin/lux-wine' - install -Dm755 "$lwf" "$LWSRC" - if is_not_pts_home + grep -m1 '^Exec=".*"' -lr ./*|\ + xargs -d'\n' sed -i "s|^Exec=\".*\"|Exec=\"$LWRUN\"|g" 2>/dev/null + install -Dm644 LuxWine.menu "$HOME/.config/menus/applications-merged/LuxWine.menu" + if [ "$KDE_SESSION_VERSION" == 6 ] + then install -Dm755 LuxWineService.desktop "$HOME/.local/share/kio/servicemenus/LuxWineService.desktop" + elif [ "$KDE_SESSION_VERSION" == 5 ] + then install -Dm755 LuxWineService.desktop "$HOME/.local/share/kservices5/ServiceMenus/LuxWineService.desktop" + fi + mkdir -p "$MENU_APPS_DIR" + mkdir -p "$HOME_DESK_DIRS" + cp -rf mime "$HOME/.local/share/mime" + cp -rf applications "$MENU_APPS_DIR/LuxWine" + cp -rf directories/* "$HOME_DESK_DIRS/" + RSTEAM_DESKF="$RUNROOTFS/usr/share/applications/steam.desktop" + if [[ -d "$RUNROOTFS" && -f "$RSTEAM_DESKF" ]] then - grep -m1 '^Exec=".*"' -lr ./*|\ - xargs -d'\n' sed -i "s|^Exec=\".*\"|Exec=\"$LWRAP\"|g" 2>/dev/null - if [ -f 'lwrap' ] - then local lwrapf='lwrap' - elif [ -f 'bin/lwrap' ] - then local lwrapf='bin/lwrap' - else local lwrapf='lwrap/lwrap' - fi - if [ -f 'lwexec' ] - then local lwexecf='lwexec' - elif [ -f 'bin/lwexec' ] - then local lwexecf='bin/lwexec' - else local lwexecf='lwrap/lwexec' - fi - if [ -x "$RUNSTATIC/bash" ] - then - sed -i "1 s|^.*$|#!$LWBASH|" "$lwrapf" - sed -i "1 s|^.*$|#!$LWBASH|" "$lwexecf" - install -Dm755 "$RUNSTATIC/bash" "$LWBASH" - fi - install -Dm755 "$lwrapf" "$LWRAP" - ln_lwrap - install -Dm755 "$lwexecf" "$LWEXEC" - install -Dm644 LuxWine.menu "$HOME/.config/menus/applications-merged/LuxWine.menu" - if [ "$KDE_SESSION_VERSION" == 6 ] - then install -Dm755 LuxWineService.desktop "$HOME/.local/share/kio/servicemenus/LuxWineService.desktop" - elif [ "$KDE_SESSION_VERSION" == 5 ] - then install -Dm755 LuxWineService.desktop "$HOME/.local/share/kservices5/ServiceMenus/LuxWineService.desktop" - fi - mkdir -p "$MENU_APPS_DIR" - mkdir -p "$HOME_DESK_DIRS" - cp -rf mime "$HOME/.local/share/mime" - cp -rf applications "$MENU_APPS_DIR/LuxWine" - cp -rf directories/* "$HOME_DESK_DIRS/" - if [[ -d "$RUNROOTFS" && -f "$RSTEAM_DESKF" ]] - then - cp -rf "$RSTEAM_DESKF" "$HSTEAM_DESKF" - sed -i "s|^Exec.*steam-runtime|Exec='$HBIN_DIR/steam-runtime'|g" "$HSTEAM_DESKF" - sed -i "s|^Name=Steam (Runtime)|Name=Steam (RunImage LW)|g" "$HSTEAM_DESKF" - HICNSTM="$HOME_ICONS/steam.png" - for hi_icon_size in ${HICOLOR_SIZES[@]} - do - HICONS_DIR="$HOME_ICONS/hicolor/$hi_icon_size/apps" - RSTEAM_ICON="$RUNROOTFS/usr/share/icons/hicolor/$hi_icon_size/apps/steam.png" - HSTEAM_ICON="$HICONS_DIR/steam.png" - if [[ -f "$RSTEAM_ICON" && ! -f "$HSTEAM_ICON" ]] - then - mkdir -p "$HICONS_DIR" - [ -L "$HSTEAM_ICON" ] && \ - rm -f "$HSTEAM_ICON" - cp -rf "$RSTEAM_ICON" "$HSTEAM_ICON" - fi - if [[ -f "$RSTEAM_ICON" && ! -f "$HICNSTM" ]] - then - mkdir -p "$HOME_ICONS" - [ -L "$HICNSTM" ] && \ - rm -f "$HICNSTM" - cp -rf "$RSTEAM_ICON" "$HICNSTM" - fi - done - fi - [ "$ENABLE_HOSTEXEC" == 1 ] && \ - local INSTALL_SHELL="$(hostexec echo '$SHELL')"||\ - local INSTALL_SHELL="$SHELL" - case "$(basename "$INSTALL_SHELL")" in - zsh) add_path "$Z_RC" ;; - bash) add_path "$B_RC" ;; - fish) add_path "$F_RC" ;; - esac - update-desktop-database -q "$MENU_APPS_DIR" &>/dev/null - update-mime-database "$HOME/.local/share/mime" &>/dev/null - for mimetype in "${LW_MIMETYPES[@]}" - do xdg-mime default LuxWine.desktop "$mimetype" &>/dev/null + cp -rf "$RSTEAM_DESKF" "$HSTEAM_DESKF" + sed -i "s|^Exec.*steam-runtime|Exec='$HBIN_DIR/steam-runtime'|g" "$HSTEAM_DESKF" + sed -i "s|^Name=Steam (Runtime)|Name=Steam (RunImage LW)|g" "$HSTEAM_DESKF" + HICNSTM="$HOME_ICONS/steam.png" + for hi_icon_size in ${HICOLOR_SIZES[@]} + do + HICONS_DIR="$HOME_ICONS/hicolor/$hi_icon_size/apps" + RSTEAM_ICON="$RUNROOTFS/usr/share/icons/hicolor/$hi_icon_size/apps/steam.png" + HSTEAM_ICON="$HICONS_DIR/steam.png" + if [[ -f "$RSTEAM_ICON" && ! -f "$HSTEAM_ICON" ]] + then + mkdir -p "$HICONS_DIR" + [ -L "$HSTEAM_ICON" ] && \ + rm -f "$HSTEAM_ICON" + cp -rf "$RSTEAM_ICON" "$HSTEAM_ICON" + fi + if [[ -f "$RSTEAM_ICON" && ! -f "$HICNSTM" ]] + then + mkdir -p "$HOME_ICONS" + [ -L "$HICNSTM" ] && \ + rm -f "$HICNSTM" + cp -rf "$RSTEAM_ICON" "$HICNSTM" + fi done fi + [ "$INSIDE_RUNIMAGE" == 1 ] && \ + local INSTALL_SHELL="$(hostexec printenv SHELL)"||\ + local INSTALL_SHELL="$SHELL" + case "$(basename "$INSTALL_SHELL")" in + zsh) add_path "$Z_RC" ;; + bash) add_path "$B_RC" ;; + fish) add_path "$F_RC" ;; + esac + update-desktop-database -q "$MENU_APPS_DIR" &>/dev/null + update-mime-database "$HOME/.local/share/mime" &>/dev/null + for mimetype in "${LW_MIMETYPES[@]}" + do xdg-mime default LuxWine.desktop "$mimetype" &>/dev/null + done cp -rf registry_patch "$LW_DIR/" cp -rf LICENSE "$LW_DIR/" cp -rf themes "$LW_DIR/" cp -rf icons "$LW_DIR/" cp -rf gif "$LW_DIR/" cp -rf db "$LW_DIR/" + LWRUNTIME="/opt/lwrap/runtime.tar.zst" if [ -f "$LWRUNTIME" ] then + TMP_LW_CFG="$LW_DIR/tmp/luwine.wcfg" tar -xf "$LWRUNTIME" -C "$LW_DIR" && \ [[ ! -f "$LW_CFG" && -f "$TMP_LW_CFG" ]] && \ cp -f "$TMP_LW_CFG" "$LW_CFG" fi - grep "$LWRUN_LN" -lr "$MENU_APPS_DIR"|\ - xargs -d'\n' sed -i "s|$LWRUN_LN|$LWRAP|g" 2>/dev/null - grep "$LWRUN" -lr "$MENU_APPS_DIR"|\ - xargs -d'\n' sed -i "s|$LWRUN|$LWRAP|g" 2>/dev/null + grep "$OLDLWRAP" -lr "$MENU_APPS_DIR"|\ + xargs -d'\n' sed -i "s|$OLDLWRAP|$LWRUN|g" 2>/dev/null } mv_lwrun() { @@ -235,80 +169,65 @@ mv_lwrun() { fi } -is_not_pts_home() { - [[ "$SANDBOX_HOME" != 1 && "$SANDBOX_HOME_DL" != 1 && ! -d "$SANDBOXHOMEDIR/lwrap" && \ - "$PORTABLE_HOME" != 1 && "$TMP_HOME" != 1 && "$TMP_HOME_DL" != 1 && ! -d "$PORTABLEHOMEDIR/lwrap" ]] -} - try_install_lwrun() { - finalize_install() { - chmod u+x "$LWRUN" - ln_lwrun - export LWRUN_INSTALLED=1 - info_msg "lwrun installed!" - if [ ! -n "$TMP_LWRUN" ] && \ - is_net_conn + readrealpath() { + if is_exe_exist readlink + then readlink -f "$@" 2>/dev/null + elif is_exe_exist realpath + then realpath "$@" 2>/dev/null + else return 1 + fi + } + ln_lwrun() { + mkdir -p "$HBIN_DIR" + if [ "$(readrealpath "$LWRUN_LN")" != "$LWRUN" ] + then + info_msg "Update lwrun link..." + ln -sf "$LWRUN" "$LWRUN_LN" + fi + for steam in {steam,steam-runtime,steam-native} + do + STEAM_LN="$HBIN_DIR/$steam" + if [ "$(readrealpath "$STEAM_LN")" != "$LWRUN" ] + then + info_msg "Update $steam link..." + ln -sf "$LWRUN" "$STEAM_LN" + fi + done + if [ "$(readrealpath "$RUNIMAGE_LW")" != "$LWRUN" ] then - update_lwrap - "$LWRAP" --install + info_msg "Update runimage link..." + mkdir -p "$LWBIN_DIR" + ln -sf "$LWRUN" "$RUNIMAGE_LW" + ln -sf "$LWRUN" "$HBIN_DIR/runimage-lw" fi - try_shutdown_lw && \ - return 0||return 1 } - if is_not_pts_home + if [[ "$RUNSRC" =~ "lwrun" && -f "$REALRUNSRC" && "$LWLN_ONLY" != 1 && \ + "$REALRUNSRC" != "$LWRUN" && ! "${REALRUNSRC,,}" =~ .*/(run$|cdrom/lwrun|sr[0-9]/lwrun)$ && \ + ! "$REALRUNSRC" =~ ^/(usr/bin|bin|opt)/lwrun$ ]] then - REALP_LWRUN="$(readrealpath "$LWRUN")" - if [[ "$RUNSRC" =~ "lwrun" && -f "$RUNSRCRPTH" && \ - "$RUNSRCRPTH" != "$LWRUN" && ! "$RUNSRCRPTH" =~ "Run" && \ - "$LWRUN_INSTALLED" != 1 ]] + info_msg "Installing lwrun..." + mkdir -p "$LWBIN_DIR" + if mv_lwrun "$REALRUNSRC" "$LWRUN" then - info_msg "Installing lwrun..." - mkdir -p "$LWBIN_DIR" - if mv_lwrun "$RUNSRCRPTH" "$LWRUN" - then finalize_install - else - error_msg "Failed to install lwrun!" - is_lwrun && \ - return 1||exit 1 - fi - elif [[ "$RUNSRCRPTH" =~ "Run" && "$RUNSRCRPTH" != "$REALP_LWRUN" ]] - then - mkdir -p "$LWBIN_DIR" - ln -sf "$RUNSRCRPTH" "$LWRUN" ln_lwrun - return 0 - elif [[ ! -n "$TMP_LWRUN" && "$LWRUN_PKG" == 1 && \ - "$LWRUN_INSTALLED" != 1 ]] - then finalize_install + info_msg "lwrun installed!" + try_shutdown_lw && \ + return 0||return 1 + else + error_msg "Failed to install lwrun!" + is_lwrun && \ + return 1||exit 1 fi - fi -} - -ln_lwrun() { - if is_lwrun + elif [[ "$REALRUNSRC" != "$(readrealpath "$LWRUN")" ]] && \ + [[ "${REALRUNSRC,,}" =~ .*/(run|cdrom.*/lwrun|sr[0-9]/lwrun)$ ||\ + "$REALRUNSRC" =~ ^/(usr/bin|bin|opt)/lwrun$ || "$LWLN_ONLY" == 1 ]] then - mkdir -p "$HBIN_DIR" - REALP_LWRUN="$(readrealpath "$LWRUN")" - if [ "$(readrealpath "$LWRUN_LN")" != "$REALP_LWRUN" ] - then - info_msg "Update lwrun link..." - ln -sfr "$LWRUN" "$LWRUN_LN" - fi - for steam in {steam,steam-runtime,steam-native} - do - if [ ! -f "$HBIN_DIR/$steam" ] - then - info_msg "Update $steam link..." - ln -sfr "$LWRUN" "$HBIN_DIR/$steam" - fi - done - if [ "$(readrealpath "$RUNIMAGE_LW")" != "$REALP_LWRUN" ] - then - info_msg "Update runimage link..." - mkdir -p "$LWBIN_DIR" - ln -sfr "$LWRUN" "$RUNIMAGE_LW" - ln -sfr "$LWRUN" "$HBIN_DIR/runimage-lw" - fi + mkdir -p "$LWBIN_DIR" + ln -sf "$REALRUNSRC" "$LWRUN" + ln_lwrun + [ "$LWLN_ONLY" != 1 ] && \ + return 0||exit fi } @@ -316,29 +235,31 @@ uninstall_lw() { if [ "$1" == "force" ] || is_lw || is_lwrun then info_msg "Removing Lux Wine..." - rm -rf "$HSTEAM_DESKF" + rm -f "$HSTEAM_DESKF" rm -rf "$MENU_APPS_DIR/LuxWine" rm -rf "$HOME_DESK_DIRS/LuxWine"* - rm -rf "$HOME/.config/menus/applications-merged/LuxWine.menu" + rm -f "$HOME/.config/menus/applications-merged/LuxWine.menu" rm -rf "$HOME/.local/share/kservices5/ServiceMenus/LuxWine"* rm -rf "$HOME/.local/share/kio/servicemenus/LuxWine"* + rm -f "$OLDLWRAP" + rm -f "$LWBIN_DIR/lux-wine" + rm -f "$LWBIN_DIR/bash" + rm -f "$LWBIN_DIR/lwexec" + rm -f "$HBIN_DIR/lwrap" if [ "$1" == "update" ] then - rm -rf "$LWSRC" - rm -rf "$LWRAP" - rm -rf "$LWBASH" rm -rf "$LW_DIR/db" rm -rf "$LW_DIR/gif" rm -rf "$LW_DIR/icons" rm -rf "$LW_DIR/themes" - rm -rf "$LW_DIR/LICENSE" - rm -rf "$LW_DIR/.lwcfgchksum" + rm -f "$LW_DIR/LICENSE" + rm -f "$LW_DIR/.lwcfgchksum" rm -rf "$LW_DIR/registry_patch" else + chmod u+rw -R "$LWBIN_DIR/overlayfs/lux-wine/workdir" 2>/dev/null rm -rf "$LW_DIR" - rm -rf "$HLWDIRLN" + rm -rf "$HOME/LuxWine" rm -rf "$LWRUN_LN" - rm -rf "$LWRAP_LN" rm -rf "$HBIN_DIR/runimage-lw" rm -rf "$MENU_APPS_DIR/LuxWine"* rm -rf "$HOME/Desktop/LuxWine.desktop" @@ -362,68 +283,22 @@ is_net_conn() { fi } -exzip() { - if is_exe_exist unzip - then - unzip "$1" -d "$2" &>/dev/null - elif is_exe_exist 7z - then - 7z x "$1" -o"$2" &>/dev/null - elif is_exe_exist bsdtar - then - mkdir -p "$2" - bsdtar -x -f "$1" -C "$2" &>/dev/null - else - error_msg "zip archivator not found!" - exit 1 - fi -} +is_lw() { [ -f "$MENU_APPS_DIR/LuxWine/LuxWine.desktop" ] ; } -is_lw() { (is_not_pts_home && [[ -x "$LWSRC" && -x "$LWRAP" ]])||[ -x "$LWSRC" ] ; } +is_old_lw() { [ -x "$LWBIN_DIR/lux-wine" ] ; } is_lwrun() { [ -x "$LWRUN" ] ; } -try_dl_lwzip() { - local lwzipurl=( -# "$GIT_YC_LWZIP" - "$GIT_HF_LWZIP" - "$GIT_LWZIP" - ) - for url in "${lwzipurl[@]}" - do - try_dl "$url" "$TMP_LW.zip" && \ - return 0 - done - return 1 -} - install_lw() { - install_local_lw() { - if [ -d "/opt/lwrap" ] - then - info_msg "Installing Lux Wine from container..." - (mkdir -p "$TMP_LW" && \ - cp -rf "/opt/lwrap"/!(runtime.tar.zst|prefix_backups) "$TMP_LW" && \ - cd "$TMP_LW" && \ - make_install "$1" - rm_tmplw) - fi - } - rm_tmplw() { [[ -d "$TMP_LW" || -f "$TMP_LW.zip" ]] && rm -rf "$TMP_LW"* ; } TMP_LW="/tmp/lux-wine.$RANDOM" - if [ "$1" != "local" ] && \ - is_net_conn + if [ -d "/opt/lwrap" ] then info_msg "Installing Lux Wine..." - if try_dl_lwzip - then - (exzip "$TMP_LW.zip" "$TMP_LW" && \ - cd "$TMP_LW/lux-wine-main" && \ - make_install "$1" - rm_tmplw) - else install_local_lw "$1" - fi - else install_local_lw "$1" + (mkdir -p "$TMP_LW" && \ + cp -rf "/opt/lwrap"/!(runtime.tar.zst|prefix_backups) "$TMP_LW" && \ + cd "$TMP_LW" && \ + make_install "$1" + [ -d "$TMP_LW" ] && rm -rf "$TMP_LW") fi if is_lw then info_msg "Lux Wine installed!" @@ -433,167 +308,40 @@ install_lw() { fi } -vers_parser() { grep -Po '\d+'|sed ':a;/$/N;s/\n//;ta' ; } - -set_git_lw_version() { - unset GIT_LW_VERSION - local lwsrcusrls=( -# "$GIT_YC_LWSRC" - "$GIT_HF_LWSRC" - "$GIT_LWSRC" - ) - for url in "${lwsrcusrls[@]}" - do - GIT_LW_VERSION="$(NO_ARIA2C=1 NO_DL_GUI=1 NO_DL_REPEAT=1 \ - try_dl "$url" /dev/stdout 2>/dev/null|get_lw_version)" - [ -n "$GIT_LW_VERSION" ] && return 0 - done - return 1 -} - -get_lw_version() { - if [ -n "$1" ] - then grep -m1 'LW_VERSION' "$1" 2>/dev/null|vers_parser - else grep -m1 'LW_VERSION'|vers_parser - fi -} - -try_dllwrap_mirror() { - local lwrapurl=( -# "$GIT_YC_LWRAP" - "$GIT_HF_LWRAP" - "$GIT_LWRAP" - ) - for url in "${lwrapurl[@]}" - do - try_dl "$url" "$TMP_LWRAP" && \ - return 0 - done - return 1 -} - -update_lwrap() { - info_msg "Update lwrap..." - TMP_LWRAP="${LWRAP}.new$BASHPID" - if try_dllwrap_mirror - then - mv -f "$TMP_LWRAP" "$LWRAP" - chmod +x "$LWRAP" - ln_lwrap - else - error_msg "Failed to get lwrap!" - return 1 - fi -} - -update_lw() { - if is_lw - then - info_msg "Checking the Lux Wine update..." - set_git_lw_version - LW_VERSION="$(get_lw_version "$LWSRC")" - if [[ -n "$GIT_LW_VERSION" && -n "$LW_VERSION" ]] - then - if [ "$LW_VERSION" != "$GIT_LW_VERSION" ] - then - if is_update "Lux Wine" - then - info_msg "Lux Wine update..." - if update_lwrap - then "$LWRAP" --install||\ - exit 1 - else exit 1 - fi - fi - else - info_msg "The latest version is already installed!" - touch "$LWSRC" - fi - else - error_msg "Failed to check for updates!" - return 1 - fi - else - error_msg "Lux Wine is not installed!" - exit 1 - fi -} - -get_lwrun_git_ver() { - NO_ARIA2C=1 NO_DL_GUI=1 NO_DL_REPEAT=1 try_dl "$GIT_LWRUN/latest" \ - /dev/stdout 2>/dev/null|grep -m1 "Release v.*"|awk '{print$2}' -} - -get_lwrun_hf_ver() { - NO_ARIA2C=1 NO_DL_GUI=1 NO_DL_REPEAT=1 try_dl \ - "${GIT_HF_LWRUN/resolve/tree}" /dev/stdout \ - 2>/dev/null|grep -Po "v\d+\.\d+\.\d+"|tail -1 -} - -# get_lwrun_yc_ver() { -# NO_ARIA2C=1 NO_DL_GUI=1 NO_DL_REPEAT=1 try_dl \ -# "$YC_LWRUN" /dev/stdout 2>/dev/null|tr '<' '\n'|\ -# grep '^Key>'|sed 's|^Key>||g'|grep '^releases'|\ -# awk -F/ 'END {print$2}' -# } - -set_git_lwrun_ver() { -# for src in yc git hf - for src in git hf - do - GIT_LWRUN_VERSION="$(get_lwrun_${src}_ver)" - [ -n "$GIT_LWRUN_VERSION" ] && return 0 - done - return 1 -} - -try_dllwrun_mirror() { - local lwrunurl=( -# "$YC_LWRUN/releases/$GIT_LWRUN_VERSION/lwrun" - "$GIT_HF_LWRUN/$GIT_LWRUN_VERSION/lwrun" - "$GIT_LWRUN/download/$GIT_LWRUN_VERSION/lwrun" - ) - for url in "${lwrunurl[@]}" - do - try_dl "$url" "$TMP_LWRUN" && \ - return 0 - done - return 1 -} - try_dl_lwrun() { - TMP_LWRUN="$LWRUN.new$BASHPID" + try_dllwrun_mirror() { + local GIT_LWRUN_VERSION='continuous' + local GIT_LWRUN="https://github.com/VHSgunzo/lwrun/releases" + local GIT_HF_LWRUN="https://huggingface.co/lux-wine/lwrun/resolve/main/releases" + # YC_LWRUN="https://storage.yandexcloud.net/lwrun" + local lwrunurl=( + # "$YC_LWRUN/releases/$GIT_LWRUN_VERSION/lwrun" + "$GIT_HF_LWRUN/$GIT_LWRUN_VERSION/lwrun" + "$GIT_LWRUN/download/$GIT_LWRUN_VERSION/lwrun" + ) + for url in "${lwrunurl[@]}" + do + try_dl "$url" "$TMP_LWRUN" && \ + return 0 + done + return 1 + } + local ret=1 + TMP_LWRUN="$LW_DIR/tmp/lwrun" info_msg "Downloading lwrun..." - set_git_lwrun_ver - if [ -n "$GIT_LWRUN_VERSION" ] && \ - try_dllwrun_mirror + if try_dllwrun_mirror then info_msg "lwrun downloaded!" - RUNSRCRPTH="$TMP_LWRUN" \ - RUNSRC="lwrun" try_install_lwrun && - return 0||return 1 + chmod +x "$TMP_LWRUN" + exec "$TMP_LWRUN" + ret=0 else error_msg "Failed to download lwrun!" [ -f "$TMP_LWRUN" ] && \ rm -rf "$TMP_LWRUN"* exit 1 fi -} - -runimage_lw() { - [ "$NOT_TERM" != 1 ] && \ - unset HOSTEXEC_IN_TERM||\ - HOSTEXEC_IN_TERM=( - "xterm" "-fa" "Monospace" - "-fs" "11" "-geometry" "130x45" - "-bg" "black" "-fg" "white" \ - "-T" "Updating RunImage packages..." "-e" - ) - if [ "$ENABLE_HOSTEXEC" == 1 ] - then "${HOSTEXEC_IN_TERM[@]}" hostexec ptyspawn importenv '$RUNPID' \ - env DONT_NOTIFY=1 NO_RPIDSMON=1 "$RUNIMAGE_LW" "$@" - else "$RUNIMAGE_LW" "$@" - fi + return $ret } yn_case() { @@ -633,7 +381,7 @@ is_update() { } try_shutdown_lw() { - if [ -n "$(pgrep -fa lux-wine|grep -om1 'LuxWine/bin')" ] + if [ -n "$(pgrep -fa lux-wine|grep -E "$LWSRC|$LW_DIR/bin/lux-wine"|grep -v grep)" ] then if [ "$FORCE_UPDATE" != 1 ] then @@ -658,51 +406,33 @@ try_shutdown_lw() { no_color() { sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g" ; } -update_runimage() { +update_lwrun() ( + local ret=1 if is_update "RunImage" "Do you want to check updates for RunImage packages?" then - if (runimage_lw --rU && try_shutdown_lw) - then return 0 - else return 1 - fi - else - touch "$LWRUN" - return 1 - fi -} - -lwrap_init() { - if [ "$ENABLE_HOSTEXEC" == 1 ] - then hostexec ptyspawn importenv '$RUNPID' "$LWRAP" -init - else "$LWRAP" -init + mkdir -p "$LWBIN_DIR" + date '+%y.%m.%d.%H%M%S' > "$PKGUPDFL" + [ "$NOT_TERM" == 1 ] && \ + IN_TERM=( + "xterm" "-fa" "Monospace" + "-fs" "11" "-geometry" "130x45" + "-bg" "black" "-fg" "white" \ + "-T" "Updating RunImage packages..." "-e" + )||unset IN_TERM + HOSTEXEC_ARGS=(hostexec env RIM_RUN_IN_ONE=0) + "${HOSTEXEC_ARGS[@]}" ls "$RUNIMAGE_LW" &>/dev/null||\ + "${HOSTEXEC_ARGS[@]}" LWLN_ONLY=1 "$RUNSRC" + "${HOSTEXEC_ARGS[@]}" "$RUNIMAGE_LW" "${IN_TERM[@]}" rim-update + ret="$?" fi -} - -update_lwrun() { - if is_lwrun - then - local ret=1 - info_msg "Checking the lwrun update..." - if [ "$NO_RUNPKG_UPDATE" != 1 ] - then - update_runimage - ret=$? - [ "$ret" == 0 ] && \ - lwrap_init - fi - return $ret - else - error_msg "lwrun is not installed!" - exit 1 - fi -} + return $ret +) is_exe_exist() { command -v "$@" &>/dev/null ; } which_exe() { command -v "$@" ; } check_url_stat_code() { - set -o pipefail if is_exe_exist curl then curl -sL -o /dev/null -I -w "%{http_code}" "$@" 2>/dev/null elif is_exe_exist wget @@ -780,7 +510,7 @@ try_dl() { fi if is_url "$URL" then - WGET_ARGS=(--no-check-certificate -t 3 -T 5 -w 0.5 "$URL" -O "$FILEDIR/$FILENAME") + WGET_ARGS=(--no-check-certificate --content-disposition -t 3 -T 5 -w 0.5 "$URL" -O "$FILEDIR/$FILENAME") [ ! -d "$FILEDIR" ] && \ mkdir -p "$FILEDIR" if [[ "$NOT_TERM" == 1 && "$NO_DL_GUI" != 1 ]] && \ @@ -849,7 +579,7 @@ try_dl() { elif is_exe_exist curl then curl -R --progress-bar --insecure --fail -L "$URL" -o \ - "$FILEDIR/$FILENAME" |& tr '\r' '\n'|sed '0,/100/{/100/d;}'|\ + "$FILEDIR/$FILENAME" |& tr '\r' '\n'|\ sed -ur 's|[# ]+||g;s|.*=.*||g;s|.*|#Downloading at &\n&|g'|\ dl_progress elif is_exe_exist wget2 @@ -892,28 +622,38 @@ try_dl() { fi } -try_set_lwrpid() { lwrpid="$(cat "$LWRPIDFL" 2>/dev/null)" ; } - rm_broken_link() { find -L "$1" -type l -exec rm -rf {} \; 2>/dev/null ; } -readrealpath() { - if is_exe_exist readlink - then readlink -f "$@" 2>/dev/null - elif is_exe_exist realpath - then realpath "$@" 2>/dev/null - else return 1 +try_update_old_lwrun() { + if [ "$RUNIMAGE_VERSION" == '0.39.1' ] + then + runimage_lw() { + [ "$NOT_TERM" != 1 ] && \ + unset HOSTEXEC_IN_TERM||\ + HOSTEXEC_IN_TERM=( + "xterm" "-fa" "Monospace" + "-fs" "11" "-geometry" "130x45" + "-bg" "black" "-fg" "white" \ + "-T" "Updating RunImage packages..." "-e" + ) + "${HOSTEXEC_IN_TERM[@]}" hostexec ptyspawn importenv '$RUNPID' \ + env DONT_NOTIFY=1 NO_RPIDSMON=1 RIM_CMPRS_LVL=22 RIM_UPDATE_CLEANUP=1 \ + "$RUNIMAGE_LW" "$@" + } + info_msg "Checking the lwrun update..." + if runimage_lw --rU + then FORCE_UPDATE=1 try_shutdown_lw + fi + date '+%y.%m.%d.%H%M%S' > "$PKGUPDFL" + return 1 fi } print_help() { - HLPHOSTNAME="$(uname -a|awk '{print$2}')" - [[ "$RUNSRC" =~ "lwrun" ]] && \ - HLPEXENAME="lwrun"||\ - HLPEXENAME="lwrap" echo -e " ${RED}Usage: $RED┌──[$GREEN$RUNUSER$YELLOW@$BLUE${RUNHOSTNAME}$RED]─[$GREEN$PWD$RED] - $RED└──╼ \$$GREEN $HLPEXENAME ${BLUE}{args} + $RED└──╼ \$$GREEN lwrap ${BLUE}{args} ${BLUE}--lwrap-help $GREEN Show this usage info ${BLUE}--install $YELLOW{force|local}$GREEN Re/Install Lux Wine and lwrun @@ -922,112 +662,41 @@ print_help() { " } -RUNSRCRPTH="$(readrealpath "$RUNSRC")" - case "$1" in - --lwrap-help) print_help - exit ;; - --uninstall) uninstall_lw "$2" - exit $? ;; - --install) try_install_lwrun - is_lwrun||try_dl_lwrun - install_lw "$2" - exit $? ;; - --update) FORCE_UPDATE=1 - update_lw - update_lwrun - exit $? ;; + --lwrap-help) print_help ; exit ;; + --uninstall ) uninstall_lw "$2" ; exit $? ;; esac -if [[ -n "$RUNSRC" && -d "$RUNROOTFS" ]] +if [ "$INSIDE_RUNIMAGE" == 1 ] then + case "$1" in + --install ) try_install_lwrun + install_lw "$2" + try_update_old_lwrun + exit $? ;; + --update ) FORCE_UPDATE=1 + update_lwrun + exit $? ;; + esac try_install_lwrun - is_lw||install_lw + (! is_lw || is_old_lw) && install_lw if [[ "$CHK_UPDATE" != 0 || "$FORCE_UPDATE" == 1 ]] && \ is_net_conn then - if [[ ! -x "$(find "$LWSRC" -mtime -$CHK_UPDATE \ - -print 2>/dev/null)" || "$FORCE_UPDATE" == 1 ]] - then update_lw - fi - if is_not_pts_home && \ - [[ ! -x "$(find "$LWRUN" -mtime -$CHK_UPDATE \ + if [[ ! -f "$(find "$PKGUPDFL" -mtime -$CHK_UPDATE \ -print 2>/dev/null)" || "$FORCE_UPDATE" == 1 ]] then update_lwrun && exit $? fi fi - if [ "$LWRUN_INSTALLED" == 1 ] - then "$LWSRC" -init - else - try_set_lwrpid - if ! [[ -n "$lwrpid" && -f "/tmp/.bwinf.$lwrpid" && -d "/proc/$lwrpid" ]] - then - LWEXECFLDIR="/tmp/.lwexec.$RUNPID" - mkdir -p "$LW_DEF_TMP" - echo "$RUNPID" > "$LWRPIDFL" 2>/dev/null - (JOBNUMFL="$LWEXECFLDIR/job" - mkdir -p "$LWEXECFLDIR" 2>/dev/null - mkfifo "$JOBNUMFL" 2>/dev/null - unset jobnum - while [[ -d "/proc/$RUNPID" && -d "$LWEXECFLDIR" ]] - do - jobnum=$(( $jobnum + 1 )) - execjobdir="$LWEXECFLDIR/$jobnum" - execenvfl="$execjobdir/env" - execjobfl="$execjobdir/exec" - execjoboutfl="$execjobdir/out" - execjobstatfl="$execjobdir/stat" - mkdir "$execjobdir" 2>/dev/null - mkfifo "$execenvfl" 2>/dev/null - mkfifo "$execjobfl" 2>/dev/null - mkfifo "$execjoboutfl" 2>/dev/null - mkfifo "$execjobstatfl" 2>/dev/null - tee <<<"$jobnum" "$JOBNUMFL" &>/dev/null - if [ -e "$execjobfl" ] - then - (OLD_PATH="$PATH" - OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" - source "$execenvfl" && cd "$PWD" - export PATH="$PATH:$OLD_PATH" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$OLD_LD_LIBRARY_PATH" - cat "$execjobfl" 2>/dev/null|"$RUNSTATIC/bash" &>"$execjoboutfl" & - execjobpid=$! - tee <<<"$execjobpid" "$execjobstatfl" &>/dev/null - wait $execjobpid 2>/dev/null - execstat=$? - tee <<<"$execstat" "$execjobstatfl" &>/dev/null) & - fi - done) & - fi - "$LWSRC" "$@" - [ -d "$LWEXECFLDIR" ] && \ - rm -rf "$LWEXECFLDIR" - [ -f "$LWRPIDFL" ] && \ - rm -f "$LWRPIDFL" - fi + exec "$LWSRC" "$@" else - try_set_lwrpid - if [[ "$FORCE_UPDATE" != 1 && -x "$LWEXEC" && -x "$LWSRC" ]] && \ - [[ -n "$lwrpid" && -f "/tmp/.bwinf.$lwrpid" && -d "/proc/$lwrpid" ]] - then - LWEXECFLDIR="/tmp/.lwexec.$lwrpid" \ - NOT_TERM="$NOT_TERM" "$LWEXEC" "$LWSRC" "$@" - elif [ -x "$LWRUN_LN" ] - then "$LWRUN_LN" "$@" - elif is_lwrun - then "$LWRUN" "$@" - elif [ -x "$(which_exe lwrun)" ] - then "$(which_exe lwrun)" "$@" + if [ -x "$LWRUN" ] + then exec "$LWRUN" "$@" + elif is_net_conn + then try_dl_lwrun else - if is_net_conn - then - update_lwrap - try_dl_lwrun && \ - "$LWRUN" - else - error_msg "lwrun not found, download and install it first!" - exit 1 - fi + error_msg "lwrun not found, download and install it first!" + exit 1 fi fi exit $? diff --git a/lwrap/lwrap.install b/lwrap/lwrap.install index 74eeb48..85a1625 100644 --- a/lwrap/lwrap.install +++ b/lwrap/lwrap.install @@ -1,4 +1,5 @@ pkg_tool() { + local ret=1 unset pacdblck_exist pacdblck='/var/lib/pacman/db.lck' if [ -f "$pacdblck" ] @@ -7,8 +8,11 @@ pkg_tool() { rm -f "$pacdblck" fi LANG= sh -c "$@" - [ "$pacdblck_exist" == 1 ] && \ - touch "$pacdblck" + ret="$?" + if [ "$pacdblck_exist" == 1 ] + then touch "$pacdblck" + fi + return $ret } export -f pkg_tool @@ -31,12 +35,21 @@ export -f pkg_tool ## arg 1: the new package version ## arg 2: the old package version post_upgrade() { - pac -Q zenity 2>/dev/null|grep -q '4.0.0' && \ + pac -Q zenity 2>/dev/null|grep -q '4\.[0-9]\.[0-9]' && \ pkg_tool 'yes|sudo downgrade zenity=3.44.2' pac -Q chromium &>/dev/null && \ pkg_tool 'yes|pac -Rsndd chromium' + pac -Q amdvlk &>/dev/null && \ + pkg_tool 'yes|pac -Rsndd amdvlk' + + pac -Q lib32-amdvlk &>/dev/null && \ + pkg_tool 'yes|pac -Rsndd lib32-amdvlk' + + pac -Q glibc-eac lib32-glibc-eac &>/dev/null||\ + pkg_tool 'yes|pac -Sy glibc-eac lib32-glibc-eac' + return 0 }