Created
July 14, 2016 00:26
-
-
Save stevewood-tx/72833a5c1b521be80fb98c81a85adda4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Block the user from being able to see our trickery | |
## Define the name and path to the LaunchAgent plist | |
PLIST="/Library/LaunchAgents/com.LockLoginScreen.plist" | |
## set the icon | |
swuIcon="<set to your ICON for use on lock screen if you want>" | |
## Define the text for the xml plist file | |
LAgentCore="<?xml version=\"1.0\" encoding=\"UTF-8\"?> | |
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"> | |
<plist version=\"1.0\"> | |
<dict> | |
<key>Label</key> | |
<string>com.LockLoginScreen</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>LimitLoadToSessionType</key> | |
<string>LoginWindow</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/MacOS/LockScreen</string> | |
<string>-session</string> | |
<string>256</string> | |
</array> | |
</dict> | |
</plist>" | |
## Create the LaunchAgent file | |
echo "Creating the LockLoginScreen LaunchAgent..." | |
echo "$LAgentCore" > "$PLIST" | |
## Set the owner, group and permissions on the LaunchAgent plist | |
echo "Setting proper ownership and permissions on the LaunchAgent..." | |
chown root:wheel "$PLIST" | |
chmod 644 "$PLIST" | |
## Use SIPS to copy and convert the SWU icon to use as the LockScreen icon | |
## First, back up the original Lock.jpg image | |
echo "Backing up Lock.jpg image..." | |
mv /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/Resources/Lock.jpg \ | |
/System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/Resources/Lock.jpg.bak | |
## Now, copy and convert the SWU icns file into a new Lock.jpg file | |
## Note: We are converting it to a png to preserve transparency, but saving it with the .jpg extension so LockScreen.app will recognize it. | |
## Also resize the image to 400 x 400 pixels so its not so honkin' huge! | |
##echo "Creating SoftwareUpdate icon as png and converting to Lock.jpg..." | |
##sips -s format png "$swuIcon" --out /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/Resources/Lock.jpg \ | |
##--resampleWidth 400 --resampleHeight 400 | |
cp $swuIcon /System/Library/CoreServices/RemoteManagement/AppleVNCServer.bundle/Contents/Support/LockScreen.app/Contents/Resources/Lock.jpg | |
## Now, kill/restart the loginwindow process to load the LaunchAgent | |
echo "Ready to lock screen. Restarting loginwindow process..." | |
kill -9 $(ps axc | awk '/loginwindow/{print $1}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment