Updated background_pid, added returns for clear prefix, reinstall and delete PP

This commit is contained in:
Htylol 2024-09-28 23:37:01 +05:00
parent 27d18124c8
commit 27a3962ecc
2 changed files with 38 additions and 37 deletions

@ -679,23 +679,27 @@ background_pid () {
local arg1=$1 # --start или --end local arg1=$1 # --start или --end
local arg2=$2 # Название команды local arg2=$2 # Название команды
local arg3=$3 # Номер процесса (1,2,3..) local arg3=$3 # Номер процесса (1,2,3..)
if [[ "$START_FROM_STEAM" == 1 ]] \
|| [[ -n "$PW_DEBUG" ]] ; then
case $arg1 in
--start) eval "$arg2" ;;
--end) : ;;
esac
else
get_bg_pid () { get_bg_pid () {
eval "echo \${$1}" eval "echo \${$1}"
} }
case $arg1 in
if [[ "$arg1" == --start ]] ; then --start)
eval "$arg2 &" eval "$arg2 &"
PID=$! PID=$!
export bg_pid"${arg3}"="$PID" export bg_pid"${arg3}"="$PID" ;;
elif [[ "$arg1" == --end ]] ; then --end)
PID=$(get_bg_pid bg_pid"${arg3}") PID=$(get_bg_pid bg_pid"${arg3}")
[[ $PID == "" ]] && return 1 [[ $PID == "" ]] && return 1
while true ; do wait "$PID" && return 0 ;;
if [[ ! $(jobs -p) =~ $PID ]] ; then esac
return 0
fi
sleep 0.005
done
fi fi
} }
export -f background_pid export -f background_pid
@ -849,9 +853,7 @@ pw_reinstall_pp () {
echo "" echo ""
exit 1 exit 1
fi fi
elif ! yad_question "${translations[Do you really want to reinstall PortProton?\\nFor this, an internet connection will be required.]}" elif yad_question "${translations[Do you really want to reinstall PortProton?\\nFor this, an internet connection will be required.]}" ; then
then exit 1
fi
pw_clear_pfx pw_clear_pfx
try_remove_dir "${PORT_WINE_PATH}/data/dist" try_remove_dir "${PORT_WINE_PATH}/data/dist"
create_new_dir "${PORT_WINE_PATH}/data/dist" create_new_dir "${PORT_WINE_PATH}/data/dist"
@ -862,6 +864,7 @@ pw_reinstall_pp () {
echo "" echo ""
unset SKIP_CHECK_UPDATES unset SKIP_CHECK_UPDATES
print_info "Restarting PP for reinstall files..." print_info "Restarting PP for reinstall files..."
fi
restart_pp restart_pp
} }
@ -5874,8 +5877,8 @@ gui_clear_pfx () {
if yad_question "${translations[Do you want to clear prefix in PortProton?]}" ; then if yad_question "${translations[Do you want to clear prefix in PortProton?]}" ; then
pw_clear_pfx pw_clear_pfx
print_info "Restarting PP after clearing prefix..." print_info "Restarting PP after clearing prefix..."
restart_pp
fi fi
restart_pp
} }
export -f gui_clear_pfx export -f gui_clear_pfx
@ -5886,8 +5889,9 @@ gui_rm_portproton () {
rm -fr "${HOME}/PortWINE" rm -fr "${HOME}/PortWINE"
rm -f "$(grep -il PortProton "${HOME}/.local/share/applications"/*.desktop)" rm -f "$(grep -il PortProton "${HOME}/.local/share/applications"/*.desktop)"
update-desktop-database -q "${HOME}/.local/share/applications" update-desktop-database -q "${HOME}/.local/share/applications"
fi
exit 0 exit 0
fi
restart_pp
} }
export -f gui_rm_portproton export -f gui_rm_portproton
@ -5988,6 +5992,7 @@ export -f change_gui_start
gui_wine_uninstaller () { gui_wine_uninstaller () {
start_portwine start_portwine
pw_run uninstaller pw_run uninstaller
stop_portwine --restart
} }
export -f gui_wine_uninstaller export -f gui_wine_uninstaller

@ -257,11 +257,7 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
PW_FILESYSTEM=$(stat -f -c %T "${PORT_WINE_PATH}") PW_FILESYSTEM=$(stat -f -c %T "${PORT_WINE_PATH}")
export PW_FILESYSTEM export PW_FILESYSTEM
if [[ "$START_FROM_STEAM" == 1 ]] ; then
pw_get_tmp_files
else
background_pid --start "pw_get_tmp_files" "1" background_pid --start "pw_get_tmp_files" "1"
fi
fi fi
# create lock file # create lock file
@ -802,7 +798,7 @@ fi
[[ -n "$PW_YAD_SET" ]] && case "$PW_YAD_SET" in [[ -n "$PW_YAD_SET" ]] && case "$PW_YAD_SET" in
gui_pw_reinstall_pp|open_changelog|\ gui_pw_reinstall_pp|open_changelog|\
128|gui_pw_update|\ 128|gui_pw_update|gui_rm_portproton|\
change_loc|gui_open_scripts_from_backup|\ change_loc|gui_open_scripts_from_backup|\
gui_credits|pw_start_cont_xterm) gui_credits|pw_start_cont_xterm)
if [[ -z "${PW_ALL_DF}" ]] ; then if [[ -z "${PW_ALL_DF}" ]] ; then
@ -814,7 +810,7 @@ fi
gui_proton_downloader|WINETRICKS|\ gui_proton_downloader|WINETRICKS|\
116|pw_create_prefix_backup|\ 116|pw_create_prefix_backup|\
gui_clear_pfx|WINEREG|WINECMD|\ gui_clear_pfx|WINEREG|WINECMD|\
WINEFILE|WINECFG) WINEFILE|WINECFG|gui_wine_uninstaller)
if [[ -z "${PW_ALL_DF}" ]] ; then if [[ -z "${PW_ALL_DF}" ]] ; then
export TAB_MAIN_MENU="3" export TAB_MAIN_MENU="3"
else else