FEU and FUT vis PKG postinstall script

ericbenfer
Contributor III

I need a postinstall PKG script that handles what FEU and FUT do in a Jamf Pro DMG.
This is going to be a standalone PKG that may be used on unmanaged systems. Else, I would just use FEU and FUT with a DMG.
Before I re-invent the wheel I thought I would ask Jamf Nation.

1 ACCEPTED SOLUTION

donmontalvo
Esteemed Contributor III

Here's a template I created a while back, using input from folks here.

It is set up to do a defaults write, but can be tweaked to do other stuff.

Sets up System Template, as well as any user accounts on the computer that have user ID over 500:

#!/bin/sh

# Get list of users with UID over 500

over500=$( /usr/bin/dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }' )

# Path to application

APPLICATION=""

# Remove Quarantine flag if not owned by root:wheel

/usr/bin/xattr -r -d com.apple.quarantine "$APPLICATION"

# Set pref User Template

/usr/bin/defaults write /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX 2>/dev/null
/bin/chmod -R 700 /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX.plist 2>/dev/null
/usr/sbin/chown root:wheel /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX.plist 2>/dev/null

# Set prefs Users

for u in $over500 ;
do
    /usr/bin/defaults write /Users/"$u"/Library/Preferences/XXXXXXXX 2>/dev/null
    /bin/chmod -R 700 /Users/"$u"/Library/Preferences/XXXXXXXX.plist 2>/dev/null
    /usr/sbin/chown "$u" /Users/"$u"/Library/Preferences/XXXXXXXX.plist 2>/dev/null
done

exit 0

I try to avoid proprietary formats, like DMG "packages" since their use is locked in to the product.

HTH,
Don

--
https://donmontalvo.com

View solution in original post

2 REPLIES 2

donmontalvo
Esteemed Contributor III

Here's a template I created a while back, using input from folks here.

It is set up to do a defaults write, but can be tweaked to do other stuff.

Sets up System Template, as well as any user accounts on the computer that have user ID over 500:

#!/bin/sh

# Get list of users with UID over 500

over500=$( /usr/bin/dscl . list /Users UniqueID | awk '$2 > 500 { print $1 }' )

# Path to application

APPLICATION=""

# Remove Quarantine flag if not owned by root:wheel

/usr/bin/xattr -r -d com.apple.quarantine "$APPLICATION"

# Set pref User Template

/usr/bin/defaults write /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX 2>/dev/null
/bin/chmod -R 700 /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX.plist 2>/dev/null
/usr/sbin/chown root:wheel /System/Library/User Template/English.lproj/Library/Preferences/XXXXXXXXXXXXXXXX.plist 2>/dev/null

# Set prefs Users

for u in $over500 ;
do
    /usr/bin/defaults write /Users/"$u"/Library/Preferences/XXXXXXXX 2>/dev/null
    /bin/chmod -R 700 /Users/"$u"/Library/Preferences/XXXXXXXX.plist 2>/dev/null
    /usr/sbin/chown "$u" /Users/"$u"/Library/Preferences/XXXXXXXX.plist 2>/dev/null
done

exit 0

I try to avoid proprietary formats, like DMG "packages" since their use is locked in to the product.

HTH,
Don

--
https://donmontalvo.com

ericbenfer
Contributor III

Thanks @donmontalvo. This is exactly what I was looking for.