Here is the script we use.
Create package in composer that deployes the vanliia ProE pkg to
"/private/tmp/Install Code42 CrashPlan.pkg"
Then add the script below as a post install.
Make sure you set:
address=mybackup-dns.myserver.com:4282
secondaryAddress=111.222.333.444:4282
registrationKey=AAAA-BBBB-CCCC-DDDD
#!/bin/sh
## postinstall
CPINSTALLPKG="/private/tmp/Install Code42 CrashPlan.pkg"
CPCUSTOMFOLDER="/Library/Application Support/CrashPlan/.Custom"
userName=$(/usr/bin/stat -f%Su /dev/console)
userUID=$( dscl . -read /Users/${userName} UniqueID | cut -d ' ' -f 2 )
if [ "$userName" == "root" ]; then
echo "ERROR: No User logged in.";
exit 1;
fi
if [ "$userUID" -lt "1000" ]; then
echo "ERROR: User is not an AD user";
exit 1;
fi
if [ -e "$CPINSTALLPKG" ]; then
echo "Found $CPINSTALLPKG";
else
echo "ERROR: $CPINSTALLPKG not found"
exit 1
fi
mkdir -p "$CPCUSTOMFOLDER"
## Create userInfo.sh
cat <<"EOF" > "${CPCUSTOMFOLDER}/userInfo.sh"
#!/bin/sh
#
# Optional script by which you can control the user installation.
#
# Variables to set:
# startDesktop: set to false if you don't want the desktop to start up immediately after installation
# CP_USER_HOME: Allows the app to start scanning the user's home folder immediately after installation
# user: Used to properly set file permissions
# userGroup: Also used for file permissions
# CP_USER_NAME: This will become the unique ID for the user in the PROe Server database.
# Leave CP_USER_NAME blank to require the user to enter it.
# If set this value, you'll want to set the username="" attribute of <authority ... /> tag in default.service.xml to username="${username}"
#
#
# Set to false if you don't want the desktop UI to start up.
#
startDesktop=false
#
# When installing from the root account (for example) you will need to populate
# some or all of these variables differently than is done below.
# Note: whoami *always* returns "root" for this package so we had to get creative to find the installing user.
# Also: You will want to populate CP_USER_NAME with the right email address unless you don't want your users or admins receiving reports and alerts.
#
#user=`basename $CP_USER_HOME`
#user=$(last -t console -1 | awk '{print $1}')
user=$(/usr/bin/stat -f%Su /dev/console)
userGroup=`id -gn "$user"`
CP_USER_HOME=`eval echo "~$user"`
CP_USER_NAME="$user"
#dsclEmail=`dscl /Search read /Users/$user mail`
#CP_USER_NAME=${dsclEmail##*mail: }
#
# Users have suggested alternate ways of finding the user name and email address.
# The following examples may work better for your situation.
#
#user=`last -1 | awk '{print $1}'`
# This assumes the username is the last part of the home folder name
#user=`basename "$CP_USER_HOME"`
# This parses the user from the computer hostname
# Because the APL naming convention uses the name of the owner in the computer name we will use this
# to derive the primary user name. So the primary user does not have to be logged in for this to work.
#computerName=`scutil --get ComputerName`
#user=${computerName%%-*}
# This finds the email address from AD or LDAP
#dsclEmail=`dscl /Search read /Users/$user mail`
#CP_USER_NAME=${dsclEmail##*mail: }
# Run As User
#
#touch "${TMPDIR}/.cpRunAsUser"
EOF
## Create userInfo.sh
cat <<"EOF" > "${CPCUSTOMFOLDER}/custom.properties"
###################################################################################################
##
## custom.properties
## Edit these properties to customize and/or simplify the user's experience.
## http://www.code42.com/r/support/custom.sh-3.6.1.4
##
###################################################################################################
## Authority properties
## Skip the register/login screens by providing address, registrationKey, username, and password.
##
## Authority Parameters
## ${username}
## determined from the CP_USER_NAME command-line argument, the CP_USER_NAME environment variable,
## or "user.name" Java system property from the user interface once it launches.
## ${computername} - system computer name
## ${generated} - random 8 characters, typically used for password
## ${uniqueId} - a globally unique id, a large number
## ${deferred}
## for LDAP and Auto register only! This allows them to register without password
## and requires user to login to CPD the first time.
## the primary address and port to the authority that manages the accounts and issues licenses
## Example: internalhost:4282
address=mybackup-dns.myserver.com:4282
## the secondary address and port to the authority that manages the accounts and issues licenses.
## Note: This is an advanced setting. Use only if you are familiar with its use and results.
## Example: externalhost:4282
secondaryAddress=111.222.333.444:4282
## Do not prompt or allow user to change the address (true or false)
hideAddress=false
## Lock server address setting so that user cannot change server address (true or false)
lockedAddress=true
## The organization registration key, when specified the field is hidden in the register/login screen
## Example: AAAA-BBBB-CCCC-DDDD
registrationKey=AAAA-BBBB-CCCC-DDDD
## The username to use when authorizing the computer.
## Accepts any authority parameters listed above.
username=${username}
## The password used when authorizing the computer.
## Accepts any authority parameters listed above.
password=${deferred}
##################################################################################################
## Proxy properties
## Enable the use of a proxy server when devices running the CrashPlan app must use a proxy server
## to connect to a Code 42 enterprise server instance that is external to the LAN.
## The proxy server must be accessible to all devices running the CrashPlan app.
proxy.enable=false
## The URL for the proxy server
proxy.pacUrl=test
##################################################################################################
## Sigle Sign-on properties
## SsoAuth will not be available unless this is true. Default is false.
ssoAuth.enabled=false
## Login via sso is enforced, the login with sso button is hidden. SSO must be enabled. Default is false.
ssoAuth.required=false
###################################################################################################
## END
###################################################################################################
EOF
installer -pkg "$CPINSTALLPKG" -target /
RETURN=$?
exit $RETURN