forked from jamf/Jamf-Nation-Extension-Attributes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Browser_Chrome_HomePage.xml
28 lines (28 loc) · 1.44 KB
/
Browser_Chrome_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
27
28
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Browser Chrome HomePage</displayName>
<description>This will determine the HomePage Address set in the Firefox Browser for the last logged in user. </description>
<dataType>string</dataType>
<scriptContentsMac>#!/bin/sh
#####################################################################
# Find the HomePage for Chrome Browser 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 Chrome Preferences file for the HomePage Address
HomePage=$(cat /Users/$LastUser/Library/Application\ Support/Google/Chrome/Default/Preferences | grep homepage | head -n 1 | awk '{print $2}')
# Output the results and clip off extra characters
echo "<result>$HomePage</result>" | sed -e 's/[",;)]//g'
exit 0</scriptContentsMac>
<scriptContentsWindows/>
</extensionAttribute>