Posted on 03-21-2015 11:17 AM
I have a message via jamfhelper that users will see during a policy that runs at logout (shutdown triggers it also, so looks like if a user shuts down instead of logout, its the same as logout).
I want to add an icon to the message, jamfhelper has the -icon argument that lets me do that.
Testing the script locally with the icon in the same directoy works, so now I want to add the script and image to the JSS, but where would I put the image file?
my file share distribution point is casperlocal/jssdist. where are the scripts stored? would i put the image in the same directory as these scripts?
Solved! Go to Solution.
Posted on 03-21-2015 08:51 PM
@tcandela You have it mostly right, but avoid snapshots in this instance (and most instances really)
Once you have the icon in the "/bin/" directory or wherever you decide you want it to live, open Composer and drag the icon itself into the side panel in Composer, making sure not to drag it into an existing Source, and Composer will create a new source with the file or files/folders you drag into it. Check it to make sure it looks good and, perhaps change the owner & group and permissions to something generic like root:wheel and 744 for example, then create the package.
As for the script, I would not try using a relative path for the icon. For one, I'm pretty sure the script isn't going to be running from the '/Library/Application Support/JAMF/bin/' directory, and two, even if it was, using relative paths is prone to fail, and the icon won't get used. Use a full absolute path instead in your script like "/Library/Application Support/JAMF/bin/GU.png"
You can also look at the example @emilykausalik shows above and set the icon path into a variable and then use the variable in the jamfHelper portion of the script.
Posted on 03-21-2015 12:40 PM
If you put it in /Library/Application Support/Jamf/bin will it work from there? I usually put all my stuff in there.
Posted on 03-21-2015 01:08 PM
Do you have an example of the script you're using? This one is based off of one by @rtrouton that I use which uses my custom Self Service icon as the icon for the dialogue and it works just fine.
#!/bin/bash
# pop-up dialog after a policy has run
# uses jamfHelper
# Determine OS version
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
dialog="Very important message here."
description=`echo "$dialog"`
button1="OK"
jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
icon="/Applications/Self Service.app/Contents/Resources/Self Service.icns"
if [[ ${osvers} -lt 7 ]]; then
"$jamfHelper" -windowType utility -description "$description" -button1 "$button1" -icon "$icon"
fi
if [[ ${osvers} -ge 7 ]]; then
jamf displayMessage -message "$dialog"
fi
exit 0
If that doesn't work for you, maybe throw it in /tmp/ ?
Posted on 03-21-2015 08:08 PM
If the icon you're using in the dialog is a custom one you created or found somewhere, you'll need to package it up and deploy it to your managed Macs as either part of the policy that runs the script or beforehand, then in your script use the path to where the icon file is on the client.
We also put our custom icons inside the /Library/Application Support/JAMF/bin/
directory.
Also keep in mind that when using an icon that exists already on your clients its not necessary in most cases to copy it and deploy it into another location. You can just specify the full path to the icon directly. For example, if I wanted to send up a message about something related to the user's keychain, I might use the following icon path:
/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.icns
Posted on 03-21-2015 08:29 PM
here is my script; the icon path you see is from a test machine. Test.sh script is running from ./documents/test.sh (icon is in same directory as test.sh)
@emilykausalik i am not familiar with creating or setting up a custom self service icon
@pblake I'll give it a shot with icon in that directory
@mm2270 if i wanted to put this icon of mine on every computer, would i just simply use 'composer' and perform the following 4 steps to make the package?
1- before snapshot
2- place icon in /Library/Application Support/JAMF/bin
3- take after snapshot
4- deploy the created package
title="IT DEPARTMENT"
heading="Important updates are currently being installed. Please do not turn off your computer."
description="Apple Sofware Update installation is in progress. This might take a few minutes to complete...."
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -lockHUD -title "$title" -heading "$heading" -alignHeading center -description "$description" -alignDescription center -icon ./GU.png -iconSize 150 &
Posted on 03-21-2015 08:51 PM
@tcandela You have it mostly right, but avoid snapshots in this instance (and most instances really)
Once you have the icon in the "/bin/" directory or wherever you decide you want it to live, open Composer and drag the icon itself into the side panel in Composer, making sure not to drag it into an existing Source, and Composer will create a new source with the file or files/folders you drag into it. Check it to make sure it looks good and, perhaps change the owner & group and permissions to something generic like root:wheel and 744 for example, then create the package.
As for the script, I would not try using a relative path for the icon. For one, I'm pretty sure the script isn't going to be running from the '/Library/Application Support/JAMF/bin/' directory, and two, even if it was, using relative paths is prone to fail, and the icon won't get used. Use a full absolute path instead in your script like "/Library/Application Support/JAMF/bin/GU.png"
You can also look at the example @emilykausalik shows above and set the icon path into a variable and then use the variable in the jamfHelper portion of the script.
Posted on 03-23-2015 07:19 AM
@mm2270 - sounds simple to do, i'm new to this, so I just want to make sure i am doing this correctly, (did this correctly)
I moved the file into /Library/Apli...../JAMF/bin , changed the owner to root:wheel, chmod 744
launched Composer, then from Finder i dragged the image file from /Library/Appl..../JAMF/bin into Composer.
not sure what to exactly look for in the files/folders that were created, (gave a description in Description.plist) clicked 'Build as PKG'
I attached a couple images pre 'build as pkg'
Posted on 03-23-2015 08:05 AM
@tcandela So if you turn down all the directories in your Composer source above, like "Library" then "Application Support" and finally, "bin" is the icon file shown? If so, then it looks good from where I am. The "Files for Package" line shows its there, but always a good idea to double check if you haven't already.
If all looks good, build it out as PKG or DMG and upload to your Casper Admin share. Start deploying to your Macs in a policy.
You may want to create a Smart Group for the Macs in your Site that do not have the specific package receipt on them as the scope for the policy so it will know which ones to deploy it to.
Posted on 03-23-2015 09:09 AM
@mm2270 - I am running the package just as is, nothing has been removed.
I checked my test computers and the *.png is in the /Library/Application Support/JAMF/bin directory.
I changed the script to icon="/Library/Application Support/JAMF/bin/*.png" and it displays alongside the jamfhelper message.
regarding you 'Smart Group' input, which criteria would equal the specific package receipt? would it be the criteria of 'Packages Installed by Casper' 'Has' 'Install GUpng Image'
Posted on 03-23-2015 09:13 AM
regarding you 'Smart Group' input, which criteria would equal the specific package receipt? would it be the criteria of 'Packages Installed by Casper' 'Has' 'Install GUpng Image'
If that's the name of the package and its being installed by Casper (which it is in this case) then yes, except change the 'Has' to 'does not have' That should see any Macs that don't have that package receipt on them, once recons are run and would be the scope for the deployment. We do similar things with Extension Attributes, looking for specific apps or tools we deploy and use that as the criteria for machines that the deployment policy would run against.
Posted on 03-23-2015 10:32 AM
alright @mm2270 @pblake @emilykausalik - thanks for all the help/info. Learning more concepts/techniques every week from this JAMF Nation
Policy is running and icon being placed in appropriate location.