kc9wwh / macOSUpgrade

Workflow for doing in-place upgrades.
Other
418 stars 103 forks source link

OS update is frozen if there are multiple startosinstall processes #102

Closed kenchan0130 closed 4 years ago

kenchan0130 commented 5 years ago

If there are multiple startosinstall processes for any reason, OS update is frozen. If we select utility size of jamfHelper window and set policy as ongoing in JSS, this case can happen.

The workaround is recoverable by the end user rebooting.

adammartin253 commented 5 years ago

I have witnessed the same thing a few times. I changed my policy from ongoing to reoccurring once a day and added a wait for user login script before triggering a popup jamfhelper I made that gives the user the option to kick off the policy via button that is tied to a custom trigger (i.e. install-mojave)

kenchan0130 commented 5 years ago

@adammartin253 Sounds good. If you can, could you tell us more about the specific code in this comment?

adammartin253 commented 5 years ago

@kenchan0130 The following is the script for waiting for user login:

dockStatus=$(pgrep -x Dock)

echo "Waiting for Desktop..."

while [[ "$dockStatus" == "" ]]
do
  echo "Desktop is not loaded. Waiting."
  sleep 5
  dockStatus=$(pgrep -x Dock)
done

sleep 5
loggedinuser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
echo "$loggedinuser has successfully logged on! The Dock appears to be loaded with PID $dockStatus."

And then this is the JamfHelper prompt I created for my environment (I created a custom icon for my company):

#!/bin/bash

# Created by Adam Martin: March 23, 2019
# Modified on April 12th, 2019

## Set the variables
JamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

icon_folder="/private/tmp/MojaveTempFiles/hbo-logo-mojave-darker.icns"
icon_size=300
## PREP MESSAGE

afplay --volume 4 /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/system/payment_success.aif

title="************** HBO macOS Mojave Upgrade Wizard **************"
heading="Are you ready to upgrade to macOS Mojave?"
descrip="Click 'OK' to begin the upgrade now before it is automatically pushed to your Mac on May 31st, 2019 for security compliance.

If you'd prefer to delay the start, click on the selection box below where you can choose 30 minutes from now, 1 hour, 2 hours or 3 hours. Then click 'OK'

Mac laptops require power to be connected before starting this upgrade.

This will require a reboot of your Mac and will take around 45 minutes to 1 hour to complete (during which time, you won't be able to use your Mac)

Click the 'Not Now' button below if you don't want to upgrade your Mac to Mojave today.

Please make a selection below:"

Displaying Notification Window (JAMFHelper)

RESULT=$("$JamfHelper" -startlaunchd -windowType hud -title "$title" -heading "$heading" -description "$descrip" -button1 "OK" -button2 "Not Now" -defaultButton 2 -lockHUD -showDelayOptions "0, 1800, 3600, 7200, 10800" -icon "$icon_folder" -iconSize "$icon_size")

if [ $RESULT == 1 ]; then
    afplay --volume 2 /private/tmp/MojaveTempFiles/MagicWand.mp3
    jamf policy -event install-mojave
    echo "OK was pressed"
elif [ $RESULT == 2 ]; then
    exit 0
    echo "Not Now was pressed"
fi

if [ $RESULT == 18001 ]; then
sleep 1800
    afplay --volume 2 /private/tmp/MojaveTempFiles/MagicWand.mp3
    jamf policy -event install-mojave
    echo "OK was pressed"
elif [ $RESULT == 18002 ]; then
    exit 0
    echo "Not Now was pressed"
fi

if [ $RESULT == 36001 ]; then
sleep 3600
    afplay --volume 2 /private/tmp/MojaveTempFiles/MagicWand.mp3
    jamf policy -event install-mojave
    echo "OK was pressed"
elif [ $RESULT == 36002 ]; then
    exit 0
    echo "Not Now was pressed"
fi

if [ $RESULT == 72001 ]; then
sleep 7200
    afplay --volume 2 /private/tmp/MojaveTempFiles/MagicWand.mp3
    jamf policy -event install-mojave
    echo "OK was pressed"
elif [ $RESULT == 72002 ]; then
    exit 0
    echo "Not Now was pressed"
fi

if [ $RESULT == 108001 ]; then
sleep 10800
    afplay --volume 2 /private/tmp/MojaveTempFiles/MagicWand.mp3
    jamf policy -event install-mojave
    echo "OK was pressed"
elif [ $RESULT == 108002 ]; then
    exit 0
    echo "Not Now was pressed"
fi

image

memile123 commented 5 years ago

@kenchan0130 @adammartin253 I would love for this to be implemented into this. I could see this being used for environments where users are reluctant to updating and IT need to annoy them.

kenchan0130 commented 5 years ago

@adammartin253 Thank you for the description.

If there are multiple osinstall processes for any reason, OS update is frozen.

The original problem is this. However, it seems that your script does not appear to solve this. Which part is solving this problem?

Of course, we can run your script in front of our project script, which is beyond the scope of this project.


I'm talking about this comment, thinking that the our script (macOSUpgrade.sh) of this project will be executed by hooking the install-mojave event.

kenchan0130 commented 5 years ago

I think it is reasonable to either not start if the startosinstall process already exists or kill all existing startosinstall processes to solve this problem.

adammartin253 commented 5 years ago

Sorry @kenchan0130 I was adding this to note that it has helped to prevent this situation from occurring but you are correct that it is not quite a "solution" so much as a workaround. I like you logic better to not start if startosinstall is already running or to kill all existing first