Added background_pid
This commit is contained in:
parent
4bee332d40
commit
2f9f705dd4
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user