-
Notifications
You must be signed in to change notification settings - Fork 47
/
Browser_Firefox_HomePage.xml
31 lines (31 loc) · 1.62 KB
/
Browser_Firefox_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
29
30
31
<?xml version="1.0" encoding="UTF-8"?>
<extensionAttribute>
<displayName>Browser Firefox 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 Firefox 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'`
# Find the default Firefox profile folder of the Last User
ProfileDir=$(ls /Users/$LastUser/Library/Application\ Support/Firefox/Profiles/ | grep .default)
# Scour the Last User's Firefox prefs.js file for the HomePage Address
HomePage=$(cat /Users/$LastUser/Library/Application\ Support/Firefox/Profiles/$ProfileDir/prefs.js | grep startup.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>