A nicer Software update tool

Taboc741
New Contributor III

Since Jamf hasn't implemented a few of the feature requests out there that would make this better, I have resorted to making a script and using Jamf helper. I stole a lot of it from https://www.jamf.com/jamf-nation/discussions/5404/jamfhelper-software-update-trigger. My goal is to incorporate the new softwareupdate -i -a -R feature as defined by Der Flounder (https://derflounder.wordpress.com/2018/03/29/new-automated-restart-option-added-to-10-13-4s-softwareupdate-command-line-tool/) in a work flow that works well and is less intensive for my users.

The biggest catch I've had so far is recording the success or failure of the reboot process because the reboot is triggered by the script thus the policy never completes and the logs are never submitted to Jamf. Below is what I have written, it will be in a policy that is scoped to a smart group of folks that have updates pending, any suggestions on functionality or workflow is appreciated.

Edit 4/25/2019: A new GitHub has been made for this project. it incorporates tons of bug fixes and feature additions discussed in the below posts. It is, as of now, an active project. Folks here continue to add great suggestions and bug finds to what has been built, so please review the code and use a pinch of salt when deploying in your environments. The git can be found here: https://github.com/taboc741/MacScripts/blob/master/A-Kinder-macOS-Update

96 REPLIES 96

samuelbrown
New Contributor

cd78565d1c6947dfad36227c6c3edcd0

Hey guys,
First of all this is awesome. I'm so pleased people are looking at other ways to update machines. I'm running a fleet of 150+ macs and Jamf don't seem to have an awesome for updating them all (patch management certainly doesn't work!)

I've just jumped onto your github @Taboc741 - pulled the files down, updated the paths etc. Everything seems to be working, however the script doesn't seem to know that I don't have any updates pending. It goes ahead and tries to "update" the machine... and then restarts it! I can't see any reason why the script doesn't stop when it sees there are no updates to do. Any ideas?

Packaged up the file with composer and installed it before running the script. - everything works as expected from what I can see.
FWIW I ran the script from self service because I believe most of my users will do that.

#!/bin/sh
##  SoftwareUpdate4.sh
##  Created by Chris on 5/31/18. Last edited by Chris 2/8/2019
##### Special thanks to mm2270, cstout, nvandam from JamfNation for helping me with some testing and code suggestions to problems I couldn't solve on my own.#####

######### Create settings for logging and create log file #########
## Path to Log file. Map your Own Log Path.  Do not use /tmp as it is emptied on boot.
LogPath=/Library/Logs/SPX
##Verify LogPath exists
if [ ! -d "$LogPath" ]; then
    mkdir $LogPath
fi
## Set log file and console to recieve output of commands
Log_File="$LogPath/SoftwareUpdateScript.log"
function sendToLog ()
{

echo "$(date +"%Y-%b-%d %T") : $1" | tee -a "$Log_File"

}
## begin log file
sendToLog "Script Started"
######### Set variables for the script ############
icon=/Library/Application Support/SPX/AppleSoftwareUpdate.png
## Determine OS version
OSVersion=`sw_vers -productVersion`
## Get the currently logged in user, if any.
LoggedInUser=`who | grep console | awk '{print $1}'`
## Check for updates that require a restart and ones that do not.
updates=`softwareupdate -l`
updatesNoRestart=`echo $updates | grep recommended | grep -v restart`
[[ -z $updatesNoRestart ]] && updatesNoRestart="none"
restartRequired=`echo $updates | grep restart | grep -v '*' | cut -d , -f 1`
[[ -z $restartRequired ]] && restartRequired="none"
shutDownRequired=`echo $updates | grep shutdown | grep -v '*' | cut -d , -f 1`
[[ -z $shutDownRequired ]] && shutDownRequired="none"

################ End Variable Set ################
sendToLog "OS version is $OSVersion"
sendToLog "Logged in user is $LoggedInUser"

## If there are no system updates, quit
if [[ $updatesNoRestart = "none" && $restartRequired = "none" && $shutdownRequired = "none" ]]; then
    sendToLog "No updates at this time, updating Jamf inventory"
    jamf policy -trigger recon
    sendToLog "Inventory update complete, script exit."
    exit 0
fi
######### If we get to this point and beyond, there are updates. #########
sendToLog "Updates found."
## Download all updates before trying to install them to make a smoother user experiance.
title='Software Update Required'
heading='Software updates'
description='Downloading the required Software updates. This prompt will change when it is time to install them. It is safe to continue using the mac while this happens.'
button1="Ok"
##prompt the user
"/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" -windowType hud -title "$title" -heading "$heading" -alignHeading justified -description "$description" -alignDescription left -icon "$icon" -button1 "$button1" -lockHUD > /dev/null 2>&1 &
softwareupdate --download --all --force --no-scan
killall jamfHelper
##Map some variables to pretty up the command to prompt the user
title='Software Update Required'
heading='Required Software update'
description='The Apple Updates are ready to install. Please press start.'
button1="Start Updates"
##prompt the user
prompt=`"/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" -windowType hud -title "$title" -heading "$heading" -alignHeading justified -description "$description" -alignDescription left -icon "$icon" -button1 "$button1" -timeout 14400 -countdown -lockHUD`
sendToLog "prompt equaled $prompt. 0=start 1=failed to prompt 2=canceled 239=exited"
sendToLog `softwareupdate --install -all --force` && sendToLog "Updates Applied"
if [[ $restartRequired = "none" && $shutdownRequired = "none" ]]; then
    sendToLog "no reboot required, exiting"
    sendToLog "Script exit"
    exit 0
fi
######### If we get to this point a reboot is required #########

if [[ $restartRequired != "none" || $shutDownRequired != "none" ]]; then
    ##Map some variables to pretty up the command to prompt the user
    title='Software Update Required'
    heading='Required Software update'
    description='A reboot is required to apply the OS updates to your Mac.  Please close all open applications before restarting your mac.'
    button1="Reboot"
    prompt=`"/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" -windowType hud -title "$title" -heading "$heading" -alignHeading justified -description "$description" -alignDescription left -icon "$icon" -button1 "$button1" -timeout 21600 -countdown -lockHUD`
    sendToLog "prompt equaled $prompt."
    sendToLog "placing reboot message"
    ##Map some variables to pretty up the command to prompt the user
    title='Software Update Required'
    heading='Required Mac OS update'
    description='We are now updating your Mac System software. These updates should not take longer than 20 to 30 minutes depending on how many updates your Mac needs. If you see this screen for more than 30 minutes please call Sparx IT. Your machine may reboot or shutdown if required.  Please do not manually turn off this computer. This message will go away when updates are complete.'
    button1="Reboot"
    /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -heading "$heading" -description "$description" -icon "$icon" > /dev/null 2>&1 &
fi
if [[ $shutDownRequired != "none" ]]; then
    sendToLog "Starting softwareupdate --install --all --restart --force --no-scan"
    sendToLog `softwareupdate --install --all --restart --force --no-scan` & exit 0
else
    sendToLog "starting reboot"
    ## using the Jamf restart process because it increases the odds of Jamf receiveing the logs back from the completed policy.
    jamf reboot -minutes 1 -background -startTimerImmediately & sendToLog "Script exit"
    exit 0
fi

samuelbrown
New Contributor

9eb5603c3c0c4f2dbfb61d2d62b64f90
Forgot to add:

ImAMacGuy
Valued Contributor II

Thank you @Taboc741 !

Out of curiosity, is there a reason the LaunchAgent is running at a particular time rather than just letting Jamf call it when necessary (ie. software updates >0 type thing)?

Taboc741
New Contributor III

@samuelbrown I should probably add 'sendToLog "$updates" ' arourd line 31 or so. That would output the string to the log that the following 6 lines is trying to parse to determine if there is an update pending to install. If you add that and then post the resulting log I could figure out how my logic is broken and resulting in the script trying to install updates that aren't pending.

@jwojda The defer process was built to run independent of Jamf. That way I am not waiting on machines to submit inventory, which we run weekly to help with DB maintenance, for a machine to fall into a smart group to then be pestered about installing their updates. You could certainly swap up the process, having Jamf trigger the defer script rather than the launch agent.

ImAMacGuy
Valued Contributor II

@samuelbrown @Taboc741 The test machine I ran it on had the opposite problem, we had an update available, the only option I had was to install it. After the script claimed to download the update, install, and then reboot only to find the update never installed.

Taboc741
New Contributor III

@jwojda I have had that happen once in my testing. I tried running the script a second time from the terminal window so I can see all the stdout context...and then the update installed, and I have not been able to reproduce the issue. I added the --force to the softwwareupdates command just incase though. Someone on slack suggested using the softwareupdates restart process every time which might work for you. In my testing I had issues with some macs trying to re-install the updates a second time and taking a really long time about it in the reboot portion of the script.

lmeinecke
New Contributor III

I've been testing with the code posted on github today. In this instance I have a VM running 10.13.4 that has updates available:

softwareupdate -l

Software Update Tool

Finding available software
Software Update found the following new or updated software: macOS High Sierra 10.13.6 Update- macOS High Sierra 10.13.6 Update ( ), 2407932K [recommended] [restart] iTunesX-12.8.2 iTunes (12.8.2), 273564K [recommended]

You can see I have two updates available, one of which requires a reboot.

After the series of helper prompts the system reboots and you would expect it to finish install of the updates on reboot however it does not.

The SoftwareUpdateScript.log file contains:

2019-Feb-18 14:15:08 : Script Started
2019-Feb-18 14:15:32 : OS version is 10.13.4
2019-Feb-18 14:15:32 : Logged in user is lmeinecke
2019-Feb-18 14:15:32 : Updates found.
2019-Feb-18 14:16:13 : prompt equaled 0. 0=start 1=failed to prompt 2=canceled 239=exited
2019-Feb-18 14:16:54 : Software
2019-Feb-18 14:16:54 : Updates Applied
2019-Feb-18 14:17:08 : prompt equaled 0.
2019-Feb-18 14:17:08 : placing reboot message
2019-Feb-18 14:17:08 : starting reboot
2019-Feb-18 14:17:08 : Script exit

JamF log:

Script result: 2019-Feb-18 14:49:17 : Script Started
2019-Feb-18 14:49:57 : OS version is 10.13.4
2019-Feb-18 14:49:57 : Logged in user is lmeinecke
2019-Feb-18 14:49:57 : Updates found.
Software Update Tool

Finding available software

Downloaded iTunes
Downloaded macOS High Sierra 10.13.6 Update
Done.
/Library/Application Support/JAMF/tmp/SoftwareUpdate4.sh: line 67: 1119 Terminated: 15 "/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" -windowType hud -title "$title" -heading "$heading" -alignHeading justified -description "$description" -alignDescription left -icon "$icon" -button1 "$button1" -lockHUD > /dev/null 2>&1
2019-Feb-18 14:51:02 : prompt equaled 0. 0=start 1=failed to prompt 2=canceled 239=exited
2019-Feb-18 14:51:43 : Software
2019-Feb-18 14:51:43 : Updates Applied
2019-Feb-18 14:52:34 : prompt equaled 0.
2019-Feb-18 14:52:34 : placing reboot message
2019-Feb-18 14:52:34 : starting reboot
2019-Feb-18 14:52:34 : Script exit

Another observation was when I was playing around with the defer prompts. I've pressed that twice on this host so it is down to 3. It seems to persist but perhaps that is in design seeing the updates aren't really installing. At first I expected that to go back to 5 on the next execution. I see mentions of a Deferrals plist file in the AppleUpdateDefer1.sh script but didn't see that on the file system. Where would this be located?

lmeinecke
New Contributor III

I've been chatting with @Taboc741 on Slack. It looks like the deferral count is possibly stored in a SIP area but you can see the count with read or modify using "sudo defaults write com.YourOrg.SoftwareUpdate.Deferral remainingDeferrals" during testing.

We fixed a line today and the pull request has been approved.

lmeinecke
New Contributor III

It looks like where I'm at now with testing is the deferral script is executing on the host by the launchd. When the user clicks install updates for some reason it is not properly triggering the JamF policy that runs the softwareupdate script. I know JamF is good because if I manually run the "jamf policy -trigger AppleUpdateScript" it works. Something in the deferral script is still off. Trying to debug and get in contact with the OP.

Taboc741
New Contributor III

So, The Git is just updated with new instructions to resolve the issues with LaunchAgents not having sufficient rights from standard users to trigger Jamf policies. This is what I get for testing with friends and family that all have admin rights in my own org.

cstout
Contributor III
Contributor III

10.14.4 requires --restart in order to process an actual shut down as noted below (from softwareupdate's output).

To install these updates, your computer must shut down. Your computer will automatically start up to finish installation. Installation will not complete successfully if you choose to restart your computer instead of shutting down. Please call halt(8) or select Shut Down from the Apple menu. To automate the shutdown process with softwareupdate(8), use --restart.

With that said, the current variable (ShutDownRequired) for grep'ing "shutdown" doesn't work.

I'm trying to figure out what to change the variable to so that end logic can perform this action:

if [ "$ShutDownRequired" != "" ]; then
    echo `date`" : Shut Down Required. Executing halt."
    /sbin/halt
else

The difficult part for me is finding the right way to use the text from the softwareupdate output above and use it after the fact. The output above only appears after running softwareupdate --install --recommended and I have no idea how to use that command's output for use in another variable.

Paging @mm2270...would you be willing to help me out on this puzzle?

Cayde-6
Release Candidate Programs Tester

Hey,

Just a snippet from my and @ChewtonTown code

RestartCheck=softwareupdate -l 2>&1 | grep restart

if [[ "$RestartCheck" == "[restart]" ]]; then

restartRequired="yes"

else

restartRequired="no"

fi

So we call softwareupdate -ia to install all updates, if restartRequired is yes then it calls shutdown -h now to invoke it and works fine

jhwong81
New Contributor

I'm having issues with the AppleUpdateDefer1.sh script. I was able to follow the instructions in the Readme file and everything works beautifully except for the fact that it doesn't seem to calculate the remaining deferrals. Each time I click on Defer the next day it still continues to show 3 Days (my default). Can someone help point me in the right direction. Thanks!

AdamCraig
Contributor III

@Taboc741 @samuelbrown I too was having the issue where when running the script on my computer that has no updates it was force rebooting the computer.
the camelcase on line 44 and 70 is messed up
they reference shutdownRequired instead of shutDownRequired

that resolved the issue for me.

tnielsen
Valued Contributor

I'm to the point where I may as let Apple manage the updates and simply check boxes in the system preferences using MDM or scripts.

jameson
Contributor II

Sorry - but has any option to post the script that works with the new kind of update apple forces with reboot ?. There are many variations of the script and just wondering if we could have a working 10.14.4 added

AdamCraig
Contributor III

@jameson I'm going off of https://github.com/taboc741/MacScripts/tree/master/A-Kinder-macOS-Update but the scripts are not yet perfect. Note the changes on the softwareupdate script I posted yesterday: the camelcase on line 44 and 70 is messed up
they reference shutdownRequired instead of shutDownRequired

Taboc741
New Contributor III

@strayer your CamelCase issue was fixed in the Git a couple days ago.

Currently for 10.14.4 I am looking at just junking the whole intelligence around shutdown and forcing all to use softawareupdate -iar despite the lousy delay experience for non shutdown type reboots. Really annoying that apple didn't tell me straight on how they were going to flag these shut down type updates. more to come once I get some more testing in.

ryan_ball
Valued Contributor

As there can never be too many of these, here is what I have been working on:
https://github.com/ryangball/nice-updater

Maybe this will help somebody.

jbellez
New Contributor III

somehow a mac I was testing this on is in a constant boot loop after installing updates.

Seems to wait about a minute or so then restarts again. Only happens after logging in. High Sierra.

I've attempted to use the built-in updater through the app store, so I know it's not our netSUS server.

Anyone else seeing this behavior?

Edit:

I see at the end of the update script, there is a line

#!/bin/sh

jamf reboot -minutes 1 -background -startTimerImmediately & sendToLog "Script exit"

wonder if this is getting stuck somehow.

jbellez
New Contributor III

Also, for users who want to just use their self service icon, you can just do this:

##Path to icon used in user messaging.  
LoggedInUser=`who | grep console | awk '{print $1}'`
icon=/Users/$LoggedInUser/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png

The software update script already has this, so you can move the icon= variable down after the command to capture the icon, as I think it needs to be after to run correctly.

Taboc741
New Contributor III

@jbellez in theory the existing icon variable is there for customizing to whatever icon you want, but the script does check to make sure the icon is real (ie didn't get deleted or something) because otherwise the JamfHelper windows look really funny. That is all the validation should be doing, of course I use the system icon so if that isn't how that code block runs give me a shout or file a bug on the git and I'll see what I can figure out.

For everyone else I have some very lightly tested script labeled as SoftwareUpdate4-beta.sh on the GIT that should tackle how Apple is implementing Shutdown based updates. It is working on my VM's and I'll be taking it to my testers internally this week, but I know a few people are dead in the water with the old broken script and I have been laid up with being super sick so the patch has been slow to roll from my finger tips. @Cayde-6 Your solution is probably simpler and more resistant to Apple changes in the future. I considered giving up on letting my users work while the update installs and going your route, but I did clooge a way out so the inevitable has been delayed a little while longer.

Thanks all for helping keep me honest in my script. the github in question

Taboc741
New Contributor III

@jbellez re-your boot looping issue. I assume you can check if the jamf binary call is stuck by looking at the jamf logs. All I am using in the shell there is a canned Jamf call to the binary to give a nice but enforced reboot process. My thought process here is with the binary doing the shut down we have a shot it won't kill itself until after it's submitted it's logs back to Jamf. I obviously could be wrong here, but that was my thought process. You absolutely could trade that line for a shutdown or reboot command and achieve the same effect. Though you might want to pass a sleep in there as well to give Jamf a chance to save and submit it's logs.

jbellez
New Contributor III

unfortunately, it was rebooting so fast I couldn't do much except wipe the machine.

Luckily it was a test machine, so no harm done.

Strangely enough, it did start working later, no real changes to the system/script. Maybe there was an issue how jamf was passing the logs as you said, since that 1 minute timeout was pretty quick.

I was trying to review the script, but did not see anything to reset the number of deferrals after a successful installation. Did I miss it, or was there a line of code that says to set something like:

defaults write com.YourOrg.SoftwareUpdate.Deferral remainingDeferrals $default

Currently, I am testing the deferral part through self service and can get the count down to decrease each time it runs. However, the next time you run it after a successful patch, it immediately starts with no deferrals left.

Taboc741
New Contributor III

@jbellez That looks to be a good find there. I am not sure how I didn't find this earlier. I fixed the zero issue by adding a check for 0 in the deferral calculation. I also added your line there after the install script triggers complete (multiple places in the script). This does introduce the risk of a user somehow killing the update script after the deferral process and getting a free number of $default deferrals again. Jamf is usually pretty obnoxious about hiding scripts though so the risk is probably pretty small.

KyleEricson
Valued Contributor II

@Taboc741 Could you ever create a Github item for this script with documentation and images of the workflow.

Read My Blog: https://www.ericsontech.com

jbellez
New Contributor III

@Taboc741 I'm just thinking most users won't know how to even get that far.

The reset counter to default will only be on any successful or no updates found situations. Pretty low risk otherwise.

EDIT: Actually, I think you need to create another variable for $default, as I don't think that value is in the actual update script, only the deferral side.

Taboc741
New Contributor III

@kerickson My script does in fact live on a git now. You can find it here: https://github.com/taboc741/MacScripts/blob/master/A-Kinder-macOS-Update

Feel free to shout if I've missed something.

When I get back to a real computer I will add it to the original post. Seems like at this point it is pretty hard to read the whole post and find the occasional reference.

jbellez
New Contributor III

hmm I just looked at your updated defer script.

Wouldn't checking for 0 just make it reset to default after you hit zero?

I feel like the reset should be handled from the update script side.

##Check if $remainDeferrals is $null or 0
    if [ $remainDeferrals = "" -o $remainDeferrals -eq 0]; then
deferral=$default

kdean
New Contributor III

Thank you for this!!!

jbellez
New Contributor III

so i did make some edits to the software update script and what i mentioned about resetting the remaining deferrals does appear to work.

default= (number of deferrals) ##only need to define this during the variables
defaults write com.YourOrg.SoftwareUpdate.Deferral remainingDeferrals $default ##needs to be added to each completion step

I added this after what appeared to be the update completion steps. I had additional pending updates on a machine and it looks like the counter went back to my default of 3 deferrals.

I also figured out when the system will enter a reboot loop state. Something happens if you try to interrupt the software update script where i think it's always trying to run the last reboot command after 1 minute. I think we may need to rethink how this is being executed, as I think it's getting stuck as an else/catch all statement, then continually restarting because of it, as it never hits the exit command.

My only fix to not destroy the machine was to uninstall jamf using the removeframework command via terminal. this stopped the rebooting. None of the flush commands would clear the running task, unless someone knows how to do so otherwise. I was using sudo jamf XXXXX. where XXXXX was the various flush commands. You had to be quick, because after 1 minute, the computer would restart again.

AdamCraig
Contributor III

Rolled this out to a few hundred of our users, and somewhere between 5 and 10 % of them have an issue where they restart to an installation error that prompts them to select their startup disk.

Has anyone else seen this?

Cayde-6
Release Candidate Programs Tester

Yes, you need to modify your script to perform a shutdown rather than reboot

jhuls
Contributor III

@strayer Not to hijack the topic but that sounds suspiciously like the same issue we've seen on campus with High Sierra systems. In almost every case it's been after applying the security update. Some users who had the issue claim that they hadn't applied updates but I didn't get to personally look into the situation to confirm. Simply selecting the startup disk gets them back up and going again though.

In all of these cases there was not any script being used. When updates were applied, it was the user kicking them off. I mentioned this to our Apple SE months ago and isn't aware of anyone else having this issue. This all started last summer and we still have some High Sierra systems doing this. We had two just in the last week.

AdamCraig
Contributor III

@jhuls We've had that happen a few times randomly as well. But it's been a few one off's here and there for us. But in rolling out this update policy after 10.14.5 came out on friday we had 12 people yesterday.

@Cayde-6 I removed the jamf reboot command and the script now only shutsdown with shutdown -h now so hopefully that'll prevent those issues

BLongCP
New Contributor II

I was just about to post regarding the shutdown needed for T2 Macs. I modified the end of the script with this. (credit goes to kish.jayson from the macadmin's slack)

echo ""
    echo "User "$LoggedInUser" is logged in and restart is required."
    OUTPUT=`softwareupdate -ia --no-scan | grep -e halt`

    echo "Informing "$LoggedInUser" of pending restart."
    /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -heading "$heading" -description "$description" -icon "$icon" > /dev/null 2>&1 &
    echo ""

    if [ "$OUTPUT" != "" ]; then

        echo "Shutting down the system immediately."
        halt

    else

        echo "Restarting the system immediately."
        reboot

    fi

elif [ "$LoggedInUser" == "" ] && [ "$restartRequired" != "" ]; then

    echo ""
    echo "No user is logged in and restart is required."
    OUTPUT=`softwareupdate -ia --no-scan | grep -e halt`

    if [ "$OUTPUT" != "" ]; then

        echo "Shutting down the system immediately."
        halt

    else

        echo "Restarting the system immediately."
        reboot

    fi

else

    echo ""
    echo "Restart is not required."
    softwareupdate -ia --no-scan

fi

exit 0

kdean
New Contributor III

@jhuls and @strayer when the machine reboots hold down the option key and boot into the Macintosh HD, after the update it is still trying to load the MacOS installer, after you boot into the Mac HD go ahead and sign in and reboot again, it will load the Macintosh HD this time!!! Apple needs to fix their updates. @Cayde-6 I will force shutdown and see if that eliminates the issue, ty Cayde-6!!!

neilrooney
New Contributor II

@Taboc741 I was hoping you could throw and eye on this. I setup the script based on your instructions and was hoping this is the correct output. It seems to be throwing a weird error.

  • Stared out private info.
Checking for policies triggered by "recurring check-in" for user "neil"...
Executing Policy Computer Name
Submitting log to https://******.jamfcloud.com/
Executing Policy Software Update
Running script AppleUpdateDefer1.sh...
Script exit code: 0
Script result: 2019-Jul-01 19:44:14 : Script Started
/Library/Application Support/JAMF/tmp/AppleUpdateDefer1.sh: line 80: [: 3: unary operator expected
No new software available.
2019-Jul-01 19:44:20 : No updates pending. Setting plist remainingDeferral to 3.  It was 3.  Exiting
Retrieving inventory preferences from https://******.jamfcloud.com/...
Locating applications...
Locating accounts...
Locating package receipts...
Searching path: /Applications
Locating software updates...
Locating printers...
Locating hard drive information...
Locating hardware information (Mac OS X 10.14.5)...
Submitting data to https://******.jamfcloud.com/...
<computer_id>2</computer_id>

Checking for patches...
No patch policies were found.
Submitting log to https://******.jamfcloud.com/

Specifically, these look kind of strange.

/Library/Application Support/JAMF/tmp/AppleUpdateDefer1.sh: line 80: [: 3: unary operator expected
No new software available.
2019-Jul-01 19:44:20 : No updates pending. Setting plist remainingDeferral to 3.  It was 3.  Exiting

Taboc741
New Contributor III

@neil.rooney I'm taking a look, though looking at my source I don't see why a unary exception would occur there. Also this weird testing for null variables as an error before it complains coupled with the deprecation of BASH in Catalina has me working to rewrite the whole tool into another language that will have future support.

Is your Line 80 still

[[ -z $remainDeferrals ]] && remainDeferrals=$default

After editing in your org info?

neilrooney
New Contributor II

@Taboc741 not exactly line 80 but this line exists.

I mean the script works, it just throws this weird error.