Create SG based on "more than" 1 cached packages?

ImAMacGuy
Valued Contributor II

I have had a policy that's cached our 10.9.x upgrade packages onto machines. however some of them now have a 10.9.2 and a 10.9.3 (and/or 10.9.0/10.9.1) packages on them because teh user never installed them.

Now when they go to isntall, they have multiple cached packages for the OS adnd the machine kind of flakes out and wont install anything. I found that if I manually removed all the pkgs and then re-pushed the current one then it's fine.

So my question is to get a SG setup that has cached packages has more than 1 on it.
any way to do that? I COuld only find cached packages "Has" <pkg name>.

2 REPLIES 2

mm2270
Legendary Contributor III

One way to do this could be to add criteria along the lines of

Cached packages | does not have | "OS X 10.9.pkg" and Cached packages | does not have | "OS X 10.9.1.pkg" and Cached packages | does not have | "OS X 10.9.2.pkg"

etc, etc.
In addition to the criteria of Has "your package name"

But that seems like a lot of work to me and may to you as well. Its also not guaranteed to catch every case.

The other way would be with an Extension Attribute that counts up the pkg's or dmg's located in the Waiting Room directory. Something like this maybe?

#!/bin/sh

WaitingRoomCount=$( find /Library/Application Support/JAMF/Waiting Room -maxdepth 1 | egrep "pkg$|dmg$" | wc -l )

echo "<result>$WaitingRoomCount</result>"

Only problem with the above EA is that its not going to differentiate from OS X update packages and any other packages or disk images that you may be caching that are NOT OS X updates. Its just counts them all up into a total.

charliwest
Contributor II

I thought someone might like a slight tweak (and very slight at that) to this

#!/bin/sh

WaitingRoomCount=$( find /Library/Application Support/JAMF/Waiting Room -maxdepth 1 | egrep "pkg$|dmg$" | wc -l | tr -d ' ' )

echo "<result>$WaitingRoomCount</result>"

This gets rid of the extra spaces the original left and makes is cleaner to scope a smart group to not 0 instead of not like 0 (or 1)