Skip to content

Commit

Permalink
don't run runonce unless user is on a very old version of pi-apps
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theofficialgman committed Jul 7, 2023
1 parent 1fe915e commit 14dea4e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions updater
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14dea4e

Please sign in to comment.