-
Notifications
You must be signed in to change notification settings - Fork 47
/
Browser_Safari_HomePage.xml
26 lines (26 loc) · 1.36 KB
/
Browser_Safari_HomePage.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Browser Safari HomePage</displayName>
<description>Find the Last User's HomePage address set in the Safari Browser</description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh
#####################################################################
# Find the HomePage in Safari for the last logged in user
# Cobbled together from other's hard work
# By: Christopher T. Miller, Dated: 2014-11-14
# For ITSD-ISS of JHU-APL
#####################################################################
# use the 'last' command to find the last real user.
# It will skip over the following users: reboot, shutdown, root, wtmp, adobeinstall, and any user you specify.
LastUser=`/usr/bin/last console | /usr/bin/awk '{print $1}' | /usr/bin/sed -e '/^$/d' -e '/^root$/d' -e '/^wtmp$/d' -e '/^adobeinstall$/d' | /usr/bin/awk 'NR>1{exit};1'`
# Scour the Last User's Sarafi plist file for the HomePage Address
HomePage=$(/usr/bin/defaults read /Users/$LastUser/Library/Preferences/com.apple.Safari.plist | grep HomePage | awk '{print $3}')
# Output the results and clip off extra characters
echo "<result>$HomePage</result>" | sed -e 's/[",;)]//g'
exit 0</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>