Scripting issue with macOS 10.13.6 update and trailing space

kozyste
New Contributor

I have a script that installs updates using policy parameters to feed the update name (for reusability purposes). The install command is pretty simple:

softwareupdate --install "$4"

I have used this script to install several updates successfully, however I've run into an issue with the High Sierra 10.13.6 update. It appears as though Apple has included a trailing space on the package name of the update.

In manual testing, the following command fails ("No such update.")

softwareupdate --install "macOS High Sierra 10.13.6 Update-"

However, if I add a trailing space, the update is able to complete:

softwareupdate --install "macOS High Sierra 10.13.6 Update- "

I tried added a trailing space to the string in policy parameter 4, but Jamf doesn't pass it. Has anyone else run into this issue? Any ideas on how I could solve it without needing a new script?

4 REPLIES 4

donmontalvo
Esteemed Contributor III

(nevermind misread the post)

--
https://donmontalvo.com

alexjdale
Valued Contributor III

I have a custom patching script that uses a list of "approved" updates to check for and install. In my function that reads in the list and builds an array of eligible updates, I had to add a custom logic branch just to deal with this trailing space, since it normally gets dropped by other operations.

I'm amazed Apple hasn't fixed this yet. It's been around for well over a year.

stutz
Contributor

I second this as it would be nice to have a fix to that space.

I just added a space after the 4 in the script as shown below. Unfortunately now this script cannot be used as an umbrella cover all macOS updates.

softwareupdate --install "$4 "

mckenney_co
New Contributor

This same issue happens with the recent 10.14.2 updates. I updated my script to look like this:

includeSpace=$4

if [ $includeSpace == "YES" ]; then
    updateName="$5 "
else
    updateName=$5
fi
...
softwareupdate --install "$updateName"

so that it's still reusable when the update doesn't include a trailing space.