<key>postinstall_script</key>
<string>#!/bin/sh
LICFILE="/Library/Application Support/Autodesk/AutoCAD 2016/R20.1/LicenseConfig/licpath.lic"
/bin/echo "SERVER your.license.server.fqdn 000000000000 27020
USE_SERVER" > "${LICFILE}"
exit 0
</string>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>autoremove</key> <false/> <key>blocking_applications</key> <array> <string>AutoCAD</string> </array> <key>catalogs</key> <array> <string>testing</string> </array> <key>category</key> <string>Productivity</string> <key>developer</key> <string>Autodesk Inc.</string> <key>description</key> <string>Update for AutoCAD 2016.</string> <key>display_name</key> <string>AutoCAD 2016 Update</string> <key>icon_name</key> <string>AutoCAD_2016.png</string> <key>installer_item_hash</key> <string>e2fc99e4103e8c85a335e7db8a7ce41c5adc6a8e3ea94678ad363f03adacf6b0</string> <key>installer_item_location</key> <string>common/productivity/update_for/AutoCAD_2016_Update4_Delta-20.1.48.622.dmg</string> <key>installer_item_size</key> <integer>863809</integer> <key>installer_type</key> <string>copy_from_dmg</string> <key>installs</key> <array> <dict> <key>CFBundleIdentifier</key> <string>com.autodesk.AutoCAD2016</string> <key>CFBundleName</key> <string>AutoCAD 2016</string> <key>CFBundleShortVersionString</key> <string>20.1.48.622 Copyright © 2009-2015 Autodesk, Inc</string> <key>CFBundleVersion</key> <string>20.1.48.622</string> <key>path</key> <string>/Applications/Autodesk/AutoCAD 2016/AutoCAD 2016.app</string> <key>type</key> <string>application</string> <key>version_comparison_key</key> <string>CFBundleShortVersionString</string> </dict> </array> <key>items_to_copy</key> <array> <dict> <key>destination_path</key> <string>/private/tmp</string> <key>group</key> <string>staff</string> <key>mode</key> <string>g+rwx</string> <key>source_item</key> <string>product.delta</string> <key>user</key> <string>root</string> </dict> </array> <key>minimum_os_version</key> <string>10.9</string> <key>name</key> <string>AutoCAD_2016_Update</string> <key>postinstall_script</key> <string>#!/bin/shACDPATH="/Applications/Autodesk/AutoCAD 2016/AutoCAD 2016.app"
# out with the old/bin/rm -rf "${ACDPATH}/Contents"
# in with the new/usr/bin/ditto -x "/private/tmp/product.delta" "${ACDPATH}/"
# this is how the native installer package sets permissions in its postinstall script... executable everything? Whatever, man./usr/sbin/chown -R root:wheel "${ACDPATH}"/bin/chmod -R 755 "${ACDPATH}"
# get rid of the update file/bin/rm -f "/tmp/product.delta"
exit 0 </string> <key>update_for</key> <array> <string>AutoCAD</string> </array> <key>uninstall_method</key> <string>remove_copied_items</string> <key>uninstallable</key> <true/> <key>version</key> <string>20.1.48.622</string></dict></plist>
#!/bin/bash## The Following variables are available in this script as per Apple Documentation## $1: Full path to the installation package the Installer application is processing.# $2: Full path to the installation destination# $3: Installation volume (or mountpoint) to receive the payload# $4: The root directory for the system:# $SCRIPT_NAME: Filename of the operation executable# $PACKAGE_PATH: Full path to the installation package# $INSTALLER_TEMP: Scratch directory used by Installer to place its temporary work files# $RECEIPT_PATH: Full path to a temporary directory containing the operation executable
function getDirAbsolute(){ pushd . > /dev/null if [ -d "${1}" ]; then cd "${1}" fi pwd popd > /dev/null}
thisScriptDir="`getDirAbsolute \`dirname \"${0}\"\``"thisScriptDir=${thisScriptDir:="."}
export UnixDefaultsCmd="/usr/bin/defaults"
export VERSION_PLIST="${thisScriptDir}/VerTarget"
export UPDATE_VERSION=`${UnixDefaultsCmd} read "${VERSION_PLIST}" UpdateVersion`
export RUNAS="/usr/bin/sudo -u $USER"
function setResetOption() { if [ "1" == "0" ]; then echo "set the reset option" ${RUNAS} ${UnixDefaultsCmd} delete "${1}" ${RUNAS} ${UnixDefaultsCmd} write "${2}" "CopyRegInitialized" -bool no ${RUNAS} ${UnixDefaultsCmd} write "${2}" "AcadResetOption" -string ALL fi}
function applyPatch(){ local PRODUCT_MAPPING="/tmp/_adsk_${UPDATE_VERSION}/acupdt_rone" if [ ! -L "${PRODUCT_MAPPING}" ]; then echo "The product mapping link does not exist!!" exit 1 fi
local ACAD_RealPath=`readlink - n ${PRODUCT_MAPPING}` local oldBundleIdentifier=`${UnixDefaultsCmd} read "${ACAD_RealPath}/Contents/Info.plist" CFBundleIdentifier` echo "starting ......" local tempFullDataDir="`mktemp -d -t tempfulldata`" /usr/bin/ditto -x "${thisScriptDir}/product.delta" "${tempFullDataDir}" if [ $? -ne '0' ]; then echo "Can't get the full data!" rm -rf "/tmp/_adsk_${UPDATE_VERSION}" rm -rf "${tempFullDataDir}" exit 1 fi
local tempOldDataDir="`mktemp -d -t tempolddata`" echo "moving the old data to ${tempOldDataDir}" mv -f "${ACAD_RealPath}/Contents" "${tempOldDataDir}" if [ $? -ne 0 ]; then echo "Can't move the old data!" rm -rf "${tempOldDataDir}" rm -rf "${tempFullDataDir}" rm -rf "/tmp/_adsk_${UPDATE_VERSION}" exit 1 fi
echo "moving the new data to ${ACAD_RealPath}" mv -f "${tempFullDataDir}/Contents" "${ACAD_RealPath}" if [ $? -ne 0 ]; then echo "Can't move the new data!" rm -rf "${ACAD_RealPath}/*" echo "Restore the old data!" mv -f "${tempOldDataDir}/Contents" "${ACAD_RealPath}"
rm -rf "${tempOldDataDir}" rm -rf "${tempFullDataDir}" rm -rf "/tmp/_adsk_${UPDATE_VERSION}" exit 1 fi
sudo chown -R root:wheel "${ACAD_RealPath}" sudo chmod -R 755 "${ACAD_RealPath}"
rm -rf "${tempOldDataDir}" rm -rf "${tempFullDataDir}" rm -rf "/tmp/_adsk_${UPDATE_VERSION}" echo "Apply the patch successfully!" local newBundleIdentifier=`${UnixDefaultsCmd} read "${ACAD_RealPath}/Contents/Info.plist" CFBundleIdentifier` setResetOption "${oldBundleIdentifier}" "${newBundleIdentifier}" exit 0}
applyPatch