-
Notifications
You must be signed in to change notification settings - Fork 12
Setup expiration
Expiration is d3's ability to automatically uninstall packages from client computers when they haven't been used in some period of time.
In order to do this, d3 uses a separate program, d3RepoMan.app, to record timestamps every time an app is brought to the foregound, which is considered 'use'.
Packages in d3 can be configured with an 'expiration' - a number of days without use before a package is removed, and an 'expiration_path' - the path the the executable that must be brought to the foreground.
When d3RepoMan is running, and you bring Transmogrifier.app to the foreground, it records a timestamp for the path /Applications/Transmogrifier.app/Contents/MacOS/Transmogrifier into a plist in the d3 support folder.
During a sync, d3 looks at the timestamp, and decides if it should expire the package.
The timestamp isn't the only condition for package removal, there are several conditions to be met at sync time:
- d3 must have a valid connection to the server
- The client must have expiration allowed in the d3.conf file.
- The receipt must have an integer expiration value > 0 (zero means 'never expire')
- The receipt must have an expiration path defined
- The receipt must be removable/uninstallable
- d3RepoMan must be running (it should always be running)
- The usage plists must exist
- The usage plists must have been updated within the last 24 hours (If nothing's come to the foreground in that much time, we assume something's awry)
- And finally, the executable at <expiration_path> must not have come to the foregound within the last <expiration> days. Being in the foreground right now counts even if there's no entry in the plist.
If all those things are true, then the package will be uninstalled. After removal, if you've defined an expiration policy in d3.conf, that policy will be triggered.
If you installed d3 with the .pkg installer, the d3RepoMan LaunchAgent plist is already in place in /Library/LaunchAgents/com.pixar.d3.RepoMan.plist
If so, and you do NOT want to use expiration, then remove the LaunchAgent plist, and don't deploy it to your managed computers.
If you installed via gem install depot3
, and you'd like to use expiration, you'll need to install LaunchAgent plist
In the d3 support folder /Libaray/Applciation Support/d3/ (which you copied into place during Installing d3 on your own machine) you'll find the launchd plist for d3RepoMan: om.pixar.d3.RepoMan.plist.
Copy that file into /Library/LaunchAgents, and set its ownership to 'root:wheel' and permissions to 0644.
Once the LaunchAgent is in place, either log out and back in, or run launchctl load /Library/LaunchAgents/com.pixar.d3.RepoMan.plist
(as yourself, not as root)
That should launch d3RepoMan, and it should start writing timestamps into a plist at /Library/Application Support/d3/Usage/<username>.plist
Aside from that, just make sure that client_expiration_allowed is set to 'true' in d3.conf, and then make a package expirable to test it out.