-
Notifications
You must be signed in to change notification settings - Fork 58
OnDemand
Copy your custom profiles and scripts to their respective working directories in the included custom-ondemand
directory, and remove the example scripts.
After you've added your custom packages, profiles, and scripts, and removed the example scripts, change directories to custom-ondemand
and use the included Makefile to package up your files:
$ cd ./custom-ondemand
$ make pkg
rm -f ./outset*.pkg
rm -f ./pkgroot/usr/local/outset/on-demand/*.pyc
pkgbuild --root pkgroot --scripts scripts --identifier com.github.outset.ondemand --version "1.0.0" --ownership recommended ./"outset-ondemand"-"1.0.0".pkg
pkgbuild: Inferring bundle components from contents of pkgroot
pkgbuild: Adding top-level postinstall script
pkgbuild: Wrote package to ./outset-ondemand-1.0.0.pkg
You will see a package called outset-ondemand-{VersionNumber}.pkg
where "VersionNumber" is what is defined in the Makefile.
You can push this package out with a management tool such as Munki or Jamf Pro.
When you install your scripts with this method, a postinstall script will trigger the on-demand
launchd jobs.
Your on-demand
profile(s) and script(s) will only run in the current user console (GUI) session. If you are using Fast User Switching, on-demand
scripts will not run in any background user sessions.
on-demand
scripts will not run if the Mac is at the login window.
At the completion of an on-demand
run, Outset will delete everything from /usr/local/outset/on-demand/
so these scripts will not be invoked during any subsequent user logins.
If the desired effect is to trigger an on-demand
script that will immediately be invoked for any currently logged-in user, and you also want it to run as a login-once
script for any subsequent logins, then you have a few options.
First, you can install the script into both /usr/local/outset/on-demand/
and /usr/local/outset/login-once/
and trigger the on-demand
run with the packaging method above. This will run the script immediately and, the next time anyone logs in, will run the script in the login-once
context.
However, this presents a certain dilemma: your script will effectively run twice for current user; once now, and once when they login again. This may not be the desired behavior.
To help with this, there is another built-in option to Outset. There are two additional arguments that can be passed:
/usr/local/outset/outset --login-once
/usr/local/outset/outset --login-every
If you create an on-demand
package using the packaging method above, include your script(s) in the respective /usr/local/outset/login-once/
or /usr/local/outset/login-every/
directory, and place a script in /usr/local/outset/on-demand/
that calls one or both of the above commands, it will loop through and process the scripts in the expected context.
This means, if your script was added to /usr/local/outset/login-once/
and you run the --login-once
argument in your on demand script, then Outset will treat it like any other login-once
item by processing it and logging it in the preference file so that subsequent logins won't run this script again.
Since on-demand
scripts run in the context of the currently logged in user, you cannot process boot-once
or boot-every
scripts in this way as those require root privileges.
One can also trigger On-Demand runs via a touch to a specific file or by using a specific flag. This may be helpful for situations like running an On-Demand script via Apple Remote Desktop. Running an On-Demand script runs as the user.
- Touch the Watch File via:
/usr/bin/touch /private/tmp/.com.github.outset.ondemand.launchd
- Run the Outset On-Demand Flag:
/usr/local/outset/outset --on-demand