AutoCAD 2016 Installation for Network License

461 views
Skip to first unread message

Ray Kerce

unread,
Jan 5, 2016, 10:23:26 AM1/5/16
to munki-dev
Just wanted to let everyone know that its very similar to the way it works in 2015.
As a preflight script or something similar create a file in /tmp/ called acodeAutoCAD2016 that appears as below:

Serial_Number
777H1
Single_License_Server
license.server.hostname
US


Then just have it install the installer package and remove the file as a post flight script. It will install correctly and update as expected. Which I have had problems with in the past. Let me know if I can be of any assistance.

Ray

blimvisible

unread,
Nov 23, 2016, 1:31:46 PM11/23/16
to munki-dev
Just imported this into our repo for distribution. The temp file info partially worked for me, I also had to add the following postinstall action, modified from Matt Hansen's AutoCAD 2015 install script:

<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" &gt; "${LICFILE}"

exit 0
       
</string>

The key to getting it working here was adding the "27020" (port number, I think?) at the end of the server URL, after the string of zeros (timeout interval, I think?). Otherwise, it would generate a "Valid license could not be obtained by the network license manager" error.

Getting AutoCAD 2016 Update 4 to install at the login window required a complete repackage. The native installer is payload-free package with a postinstall script that deletes the app container's Contents directory and performs a 'ditto -x' to extract and copy in a new Contents directory -- kinda ham-handed when that simply could have been the package payload. There's also a lot of fluff in the script about detecting product versions and hardware model identifiers and current logged in user and stuff that generally doesn't matter (or just plain doesn't work) when installing in a managed environment with Munki. In the end I extracted the 'payload.delta' file from the installer, wrapped it in a DMG, used Munki's copy_from_dmg installer_type to copy to the temp directory, and trimmed down the original installer's postinstall script to perform the 'rm' and 'ditto' commands. Here's the full pkginfo, for reference:

<?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/sh
ACDPATH="/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>

Of particular importance is that AutoCAD be in the blocking_applications array since the update does just unceremoniously yank the guts out of the app container.

For reference, here's the original installer's postinstall script. Don't use this as your postinstall and expect it to work.

#!/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



Reply all
Reply to author
Forward
0 new messages