Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created April 10, 2014 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/10401357 to your computer and use it in GitHub Desktop.
Save rtrouton/10401357 to your computer and use it in GitHub Desktop.
Postinstall script for Microsoft Lync 14.0.8
#!/bin/bash
# Determine working directory
install_dir=`dirname $0`
#
# Installing Microsoft Lync
#
# Specify location of the Microsoft Lync disk image
TOOLS=$install_dir/"lync_14.0.8_140321.dmg"
# Specify a /tmp/microsoftlync.XXXX mountpoint for the disk image
TMPMOUNT=`/usr/bin/mktemp -d /tmp/microsoftlync.XXXX`
# Mount the latest Microsoft Lync disk image to the /tmp/microsoftlync.XXXX mountpoint
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen
# Install Microsoft Lync
/usr/sbin/installer -dumplog -verbose -pkg "$(/usr/bin/find $TMPMOUNT -maxdepth 1 \( -iname \*\.pkg -o -iname \*\.mpkg \))" -target "$3"
#
# Fixing permissions
#
# Microsoft Lync 14.0.8 installs with the file ownership of /Applications/Microsoft Lync.app
# and /Library/Internet Plug-Ins/MeetingJoinPlugin.plugin set to be owned by UID 502 and GID 20
# This section fixes the permissions on the referenced files so that they're set to the following:
#
# Owner: system (aka root): read/write/execute permissions
#
# Group: admin: read/write/execute permissions
#
# Everyone: read/execute permissions
#
# Fixing /Applications/Microsoft Lync.app
/usr/bin/find "$3/Applications/Microsoft Lync.app" ! -group admin -exec chown root:admin {} \;
/usr/bin/find "$3/Applications/Microsoft Lync.app" ! -perm 775 -exec chmod 775 {} \;
# Fixing /Library/Internet Plug-Ins/MeetingJoinPlugin.plugin
/usr/bin/find "$3/Library/Internet Plug-Ins/MeetingJoinPlugin.plugin" ! -group admin -exec chown root:admin {} \;
/usr/bin/find "$3/Library/Internet Plug-Ins/MeetingJoinPlugin.plugin" ! -perm 775 -exec chmod 775 {} \;
#
# Clean-up
#
# Unmount the Microsoft Lync disk image
/usr/bin/hdiutil detach "$TMPMOUNT"
# Remove the /tmp/microsoftlync.XXXX mountpoint
/bin/rm -rf "$TMPMOUNT"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment