From cc366fa65559d8d208c17a6d2fa6f4429300a6ff Mon Sep 17 00:00:00 2001 From: VHSgunzo Date: Mon, 26 Feb 2024 09:56:08 +0300 Subject: [PATCH] Fix exit error on install init --- CHANGELOG.md | 2 ++ lux-wine | 54 +++++++++++++++++++++++++++------------------------- lwrap/lwrap | 4 +++- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5e0fd0..412c3f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # v0.78.3.2 +* HotFix wait for `lwrun` container processes exit * Add DB script for `Lineage 2 Warland` +* Minor fixes # v0.78.3.1 diff --git a/lux-wine b/lux-wine index fbda6f4..8cdf399 100755 --- a/lux-wine +++ b/lux-wine @@ -2189,17 +2189,17 @@ shrt_loop() { find_wpfxlnk() { find "$@" -type f -iname "*.lnk" 2>/dev/null|sort -u ; } find_wpfxurl() { find "$@" -type f -iname "*.url" 2>/dev/null|sort -u ; } local pfxshrtname="$(basename "$WINEPREFIX")" - local lwshrt="$LW_DEF_TMP/lwshrt.$pfxshrtname" - [ -f "$lwshrt" ] && \ + local lwshrt_fl="$LW_DEF_TMP/lwshrt.$pfxshrtname" + [ -f "$lwshrt_fl" ] && \ ! pidof wineserver &>/dev/null && \ - rm -f "$lwshrt" - if [ ! -f "$lwshrt" ] + rm -f "$lwshrt_fl" + if [ ! -f "$lwshrt_fl" ] then (IFS=$'\n' mkdir -p "$LW_DEF_TMP" - touch "$lwshrt" + touch "$lwshrt_fl" wait_wpids=100 - while [ "$wait_wpids" -gt 0 ] && \ + while [[ "$wait_wpids" -gt 0 && -d "/proc/$LWPID" ]] && \ ! pidof wineserver &>/dev/null && \ ! pgrep winetricks &>/dev/null do @@ -2209,8 +2209,9 @@ shrt_loop() { NO_YAD=1 CSHRT_WITH_RM=1 NO_ADD_APP_NAME=1 - while pidof wineserver &>/dev/null || \ - pgrep winetricks &>/dev/null + while [[ -d "/proc/$LWPID" ]] && \ + (pidof wineserver &>/dev/null||\ + pgrep winetricks &>/dev/null) do sleep 1 2>/dev/null WPREFIXLNK=($(find_wpfxlnk "${WPFXDESKDIRS[@]}")) @@ -2224,7 +2225,7 @@ shrt_loop() { check_tray [ "$FORCE_TRAY" != 1 ] && \ check_shrt - done; rm -f "$lwshrt") + done; rm -f "$lwshrt_fl") fi } @@ -3465,8 +3466,9 @@ lu_exit() { kill $(pgrep -fa 'aria2c'|grep 'LuxWine'|awk '{print$1}') 2>/dev/null print_info notify "Lux Wine successfully killed!" sleep 2 - rm -rf /tmp/FORCE_EXIT /tmp/syssett* /tmp/winesett* \ - /tmp/ressett* /tmp/settbtn* rm -f /tmp/.lwshrt* + rm -f /tmp/FORCE_EXIT /tmp/syssett* /tmp/winesett* \ + /tmp/ressett* /tmp/settbtn* rm -f /tmp/.lwshrt* \ + /tmp/.lwait* kill $(pgrep -fa "$LW_NAME"|awk '{print$1}') lu_killtray else @@ -6620,17 +6622,17 @@ if [[ "$EUID" == 0 && "$ALLOW_ROOT" != 1 ]] else (if [[ "$RUNSRC" =~ "lwrun" ]] then - find_processes() { - processes="$(ls -l /proc/*/exe 2>/dev/null|grep ' ->')" - for ps in "${IGNPS[@]}" - do processes="$(grep -wv "$ps"<<<"$processes")" - done - } - [ -f "/tmp/.lwait.$RUNPID" ] && \ - ! kill -0 $RUNPID &>/dev/null && \ - rm -f "/tmp/.lwait.$RUNPID" - if [ ! -f "/tmp/.lwait.$RUNPID" ] + 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' 'shellsrv' 'cat' 'sleep' 'gamemoded' 'bash' 'grep' @@ -6638,20 +6640,20 @@ if [[ "$EUID" == 0 && "$ALLOW_ROOT" != 1 ]] find_processes wait_lwpids=100 while [[ "$wait_lwpids" -gt 0 && \ - ! -n "$processes" ]] + ! -n "$processes" && -d "/proc/$LWPID" ]] do wait_lwpids="$(( $wait_lwpids - 1 ))" sleep 0.01 2>/dev/null find_processes done - touch "/tmp/.lwait.$RUNPID" - while [[ -n "$processes" && \ - -f "/tmp/.lwait.$RUNPID" ]] + touch "$lwait_fl" + while [[ -f "$lwait_fl" && \ + -n "$processes" && -d "/proc/$LWPID" ]] do sleep 1 find_processes done - rm -f "/tmp/.lwait.$RUNPID" + rm -f "$lwait_fl" sleep 0.5 fi fi) & diff --git a/lwrap/lwrap b/lwrap/lwrap index adcf558..a3e02fa 100755 --- a/lwrap/lwrap +++ b/lwrap/lwrap @@ -52,7 +52,8 @@ LWRAP_DIR='/opt/lwrap' LWRUNTIME="$LWRAP_DIR/runtime.tar.zst" HLWDIRLN="$HOME/LuxWine" OLD_HLWDIRLN="$HOME/LutrisWine" -LWRPIDFL="$XDG_RUNTIME_DIR/lwrpid" +LW_DEF_TMP="$LW_DIR/tmp" +LWRPIDFL="$LW_DEF_TMP/lwrpid" LWEXEC="$LWBIN_DIR/lwexec" HICOLOR_SIZES=( "512x512" "256x256" "192x192" "128x128" @@ -918,6 +919,7 @@ if [[ -n "$RUNSRC" && -d "$RUNROOTFS" ]] 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