forked from CastroFidel/PortWINE
		
	Added background_pid
This commit is contained in:
		| @@ -675,6 +675,31 @@ check_flatpak () { | ||||
| } | ||||
| export -f check_flatpak | ||||
|  | ||||
| background_pid () { | ||||
|     local arg1=$1 # --start или --end | ||||
|     local arg2=$2 # Название команды | ||||
|     local arg3=$3 # Номер процесса (1,2,3..) | ||||
|     get_bg_pid () { | ||||
|         eval "echo \${$1}" | ||||
|     } | ||||
|  | ||||
|     if [[ "$arg1" == --start ]] ; then | ||||
|         eval "$arg2 &" | ||||
|         PID=$! | ||||
|         export bg_pid"${arg3}"="$PID" | ||||
|     elif [[ "$arg1" == --end ]] ; then | ||||
|         PID=$(get_bg_pid bg_pid"${arg3}") | ||||
|         [[ $PID == "" ]] && return 1 | ||||
|         while true ; do | ||||
|             if [[ ! $(jobs -p) =~ $PID ]] ; then | ||||
|                 return 0 | ||||
|             fi | ||||
|             sleep 0.005 | ||||
|         done | ||||
|     fi | ||||
| } | ||||
| export -f background_pid | ||||
|  | ||||
| unpack () { | ||||
|     case $1 in | ||||
|          *.tar.xz) local command="tar -Jxhf";; | ||||
| @@ -1952,11 +1977,7 @@ pw_skip_update () { | ||||
|  | ||||
| pw_skip_update_new () { | ||||
|     if [[ "${SKIP_CHECK_UPDATES_NEW}" != "1" ]] ; then | ||||
|         while true ; do | ||||
|             if [[ ! $(jobs -p) =~ $PID_SKIP_UPDATE ]] ; then | ||||
|                 break | ||||
|             fi | ||||
|         done | ||||
|         background_pid --end "pw_skip_update" "1" | ||||
|  | ||||
|         if [[ -f "${PW_TMPFS_PATH}/gamescope.tmp" ]] ; then | ||||
|             export GAMESCOPE_INSTALLED="1" | ||||
| @@ -5563,9 +5584,9 @@ portwine_start_debug () { | ||||
|     kill_portwine | ||||
|     export PW_LOG=1 | ||||
|     if [[ -z "$VULKAN_DRIVER_NAME" ]] || [[ "$VULKAN_DRIVER_NAME" == "llvmpipe" ]] ; then | ||||
|     pw_notify_send -i warning \ | ||||
|     "${translations[Attention working version of vulkan not detected!]}" \ | ||||
|     "${translations[It is recommended to run games in OpenGL (low performance possible)!]}" | ||||
|         pw_notify_send -i warning \ | ||||
|         "${translations[Attention working version of vulkan not detected!]}" \ | ||||
|         "${translations[It is recommended to run games in OpenGL (low performance possible)!]}" | ||||
|     fi | ||||
|     echo "${translations[PortProton was launched in creation mode PortProton.log and it is successfully stored in the root directory of the port]}" > "${PORT_WINE_PATH}/PortProton.log" | ||||
|     echo "${translations[To diagnose the problem, copy ALL of the log to discord server: https://discord.gg/FTaheP99wE]}" >> "${PORT_WINE_PATH}/PortProton.log" | ||||
|   | ||||
| @@ -267,9 +267,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then | ||||
|     PW_FILESYSTEM=$(stat -f -c %T "${PORT_WINE_PATH}") | ||||
|     export PW_FILESYSTEM | ||||
|  | ||||
|     pw_skip_update & | ||||
|     PID_SKIP_UPDATE=$(jobs -p) | ||||
|     export PID_SKIP_UPDATE="${PID_SKIP_UPDATE//*[[:space:]]/}" | ||||
|     background_pid --start "pw_skip_update" "1" | ||||
| fi | ||||
|  | ||||
| # create lock file | ||||
|   | ||||
		Reference in New Issue
	
	Block a user