Skip to main content
Solved

FEU and FUT vis PKG postinstall script

  • October 9, 2017
  • 2 replies
  • 24 views

Forum|alt.badge.img+15

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.

Best answer by donmontalvo

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

2 replies

donmontalvo
Forum|alt.badge.img+36
  • Hall of Fame
  • Answer
  • October 9, 2017

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


Forum|alt.badge.img+15
  • Author
  • Valued Contributor
  • October 9, 2017

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