Skip to content

Instantly share code, notes, and snippets.

@rtrouton
rtrouton / gist:8056544
Created December 20, 2013 15:43
Adding 'should authenticate reboot="true"' to a installer's distribution file.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<installer-script authoringTool="Packages" authoringToolVersion="1.1.2" authoringToolBuild="2B89" minSpecVersion="1.0">
<options should-authenticate-reboot="true"/>
<!--+==========================+
| Presentation |
+==========================+-->
<title>DISTRIBUTION_TITLE</title>
<!--+==========================+
| Installer |
+==========================+-->
@rtrouton
rtrouton / gist:8057983
Created December 20, 2013 17:06
Expect script that uses fdesetup change recovery to generate a new individual recovery key using a institutional recovery key for authorization.
#!/usr/bin/expect
log_user 0
set password s3kr1tp4ssw0rd
spawn fdesetup changerecovery -personal -key /path/to/keychain_with_both_private_and_public_keys_inside.keychain -outputplist > /path/to/new_recovery_key.plist
expect "keychain: "
send "$password\n"
log_file -a /path/to/new_recovery_key.plist
expect EOF
@rtrouton
rtrouton / gist:8261882
Created January 4, 2014 22:54
Launch Chrome in kiosk mode, disable the first run and default browser checks, and go to http://www.google.com.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.company.chrome_kiosk</string>
<key>ProgramArguments</key>
<array>
@rtrouton
rtrouton / gist:8261908
Created January 4, 2014 22:56
LaunchAgent to launch Safari in full screen mode and connect to http://www.google.com. Note, not currently working properly; work in progress.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<false/>
<key>Label</key>
<string>com.company.safari_kiosk</string>
<key>ProgramArguments</key>
<array>
@rtrouton
rtrouton / gist:8456551
Last active January 3, 2016 11:29
This script will add two servers to the Oracle Java Exception Site List. If the servers are already in the whitelist, it will note that in the log, then exit.Since these settings are stored on a per-user basis, I recommend running this script with a launchagent. That will allow the script to run with the logged-in user’s privileges and permissions.
#!/bin/sh
# This script will add two servers to the Oracle Java Exception Site List.
# If the servers are already in the whitelist, it will note that in the log, then exit.
# More servers can be added as needed. The existing server entries can also be set to be
# empty (i.e. SERVER2='') as the script will do a check to see if either SERVER value
# is set to be null.
# Server1's address
SERVER1='http://server.name.here'
@rtrouton
rtrouton / gist:8830790
Last active August 29, 2015 13:56
Script for use with Casper's Self Service when deploying Canon printers. Script checks /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist for the CFBundleVersion key value. If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before …
#!/bin/bash
# Check /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist
# for the CFBundleVersion key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info" CFBundleVersion)
# Specify the current driver version
# by setting parameter 4 in the script
# on the JSS
@rtrouton
rtrouton / gist:8917576
Last active August 29, 2015 13:56
Script for use with Casper's Self Service when deploying Xerox printers. Script checks /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info.plist for the CFBundleShortVersionString key value. If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before the requested p…
#!/bin/bash
# Determine OS version
OSVERS=$(sw_vers -productVersion | awk -F. '{print $2}')
# Check /Library/Printers/Xerox/PDEs/XeroxFeatures.plugin for the CFBundleShortVersionString
# key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info" CFBundleShortVersionString)
installed_version=$(echo "$installed_driver" | sed 's/[\._-]//g')
@rtrouton
rtrouton / gist:9423156
Created March 8, 2014 00:29
AppleScript used as part of Payload-Free Package Creator Automator workflow
on run {input, parameters}
-- this repeat loop prevents empty strings from being submitted for the package name value
set q to 0
repeat while q is 0
set result to text returned of (display dialog "Enter a Name For Your Payload-Free Installer Package:" default answer "Payload-Free Installer Package")
if result is not "" then
set pkgname to result
set q to 1
end if
@rtrouton
rtrouton / gist:9715231
Created March 22, 2014 22:11
Expect script which automates running the fdesetup disable process. Script has been tested on both 10.8.5 and 10.9.2.
#!/usr/bin/expect
log_user 0
set password s3kr1tp4ssw0rd_or_recovery_key
spawn fdesetup disable
expect ": "
send "$password\n"
expect EOF
@rtrouton
rtrouton / gist:10310659
Last active August 29, 2015 13:58
Installer postinstall script that installs two Office 2011 installers (the Office 2011 14.3.0 full installer and the 14.4.1 update) and automatically fixes an issue with the volume license being wiped out by the 14.4.1 update
#!/bin/sh
# Determine working directory
install_dir=`dirname $0`
# Location of Microsoft Office Volume License file
office_license="$3/Library/Preferences/com.microsoft.office.licensing.plist"