From 14dea4e88c3a1ea5a61ca206a5a2fa58bb4a3259 Mon Sep 17 00:00:00 2001 From: theofficialgman <28281419+theofficialgman@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:43:41 -0400 Subject: [PATCH] don't run runonce unless user is on a very old version of pi-apps if the user is running GUI_FORMAT_VERSION unset or 1, then they have the old updater that was not part of the manage daemon. so spawning a new GUI will not be part of the manage daemon and will succeed. if the user is on GUI_FORMAT_VERSION 2 then the likelyhood that they have the new manage daemon updater is high so we can not simply respawn the GUI since it would be a child process of the manage daemon (and would be killed after the 30 second timeout). So we are forced to detect this and kill the GUI process and yad window and tell the user to restart pi-apps themselves. --- updater | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/updater b/updater index 6f9fe71bde..c5313b9e96 100755 --- a/updater +++ b/updater @@ -762,11 +762,22 @@ elif [ "$runmode" == 'set-status' ];then #check for updates and write updatable # this is the only part of any script that is called after running an update using the new files # since the new gui merge requires the gui script to be restarted, use this opportunity to kill the old GUI and start a new one - # only done once with a runonce if current gui format version is not 2 + # only done once with a runonce if current gui format version is less than 2 runonce <<"EOF" - if [[ "$GUI_FORMAT_VERSION" != 3 ]]; then + if [[ "$GUI_FORMAT_VERSION" -lt 2 ]]; then pkill gui && ( "${DIRECTORY}/gui" & ) echo "stopped the GUI" + elif [[ "$GUI_FORMAT_VERSION" == 2 ]]; then + pkill gui && kill $(ps -fC yad | grep "yad --class Pi-Apps --name Pi Apps --center --title=Pi-Apps --image" | awk '{print $2}') && echo "Pi-Apps is always working to improve. +As part of that we need you to restart the Pi-Apps GUI. +We went ahead and closed it for you. +Open it again to get back to installing, uninstalling, and updating software! + +Sorry for the inconvenience :)" | yad --class Pi-Apps --name "Pi Apps" --text-info --width=500 --height=400 --title='Please Restart Pi-Apps' \ + --image="${DIRECTORY}/icons/error.png" --image-on-top \ + --wrap --fontname=16 --center \ + --button=OK!"${DIRECTORY}/icons/check.png":0 & + echo "stopped the GUI" else echo "skipped stopping the gui" fi