2022-02-02 09:15:37 +00:00
#!/usr/bin/env bash
# Run in ACTIVATE_LICENSE_PATH directory
echo " Changing to \" $ACTIVATE_LICENSE_PATH \" directory. "
pushd " $ACTIVATE_LICENSE_PATH "
echo "Requesting activation"
2023-09-17 20:02:43 +00:00
if [ [ -n " $UNITY_LICENSING_SERVER " ] ] ; then
#
# Custom Unity License Server
#
echo "Adding licensing server config"
2023-09-18 10:06:54 +00:00
pushd " $ACTION_FOLDER "
ls
popd
cat " $ACTION_FOLDER /unity-config/services-config.json "
cp " $ACTION_FOLDER //unity-config/services-config.json " "/Library/Application Support/Unity/config/services-config.json"
2023-09-17 20:02:43 +00:00
/Applications/Unity/Hub/Editor/$UNITY_VERSION /Unity.app/Contents/Frameworks/UnityLicensingClient.app/Contents/MacOS/Unity.Licensing.Client --acquire-floating > license.txt #is this accessible in a env variable?
2023-09-18 08:56:20 +00:00
cat license.txt
2023-09-18 08:40:36 +00:00
PARSEDFILE = $( grep -oE '\".*?\"' < license.txt | tr -d '"' )
2023-09-18 08:56:20 +00:00
grep -oE '\".*?\"' < license.txt
2023-09-17 20:02:43 +00:00
export FLOATING_LICENSE
FLOATING_LICENSE = $( sed -n 2p <<< " $PARSEDFILE " )
FLOATING_LICENSE_TIMEOUT = $( sed -n 4p <<< " $PARSEDFILE " )
2022-02-02 09:15:37 +00:00
2023-09-17 20:02:43 +00:00
echo " Acquired floating license: \" $FLOATING_LICENSE \" with timeout $FLOATING_LICENSE_TIMEOUT "
# Store the exit code from the verify command
UNITY_EXIT_CODE = $?
else
# Activate license
/Applications/Unity/Hub/Editor/$UNITY_VERSION /Unity.app/Contents/MacOS/Unity \
-logFile - \
-batchmode \
-nographics \
-quit \
-serial " $UNITY_SERIAL " \
-username " $UNITY_EMAIL " \
-password " $UNITY_PASSWORD " \
-projectPath " $ACTIVATE_LICENSE_PATH "
# Store the exit code from the verify command
UNITY_EXIT_CODE = $?
fi
2022-02-02 09:15:37 +00:00
#
# Display information about the result
#
if [ $UNITY_EXIT_CODE -eq 0 ] ; then
# Activation was a success
echo "Activation complete."
else
# Activation failed so exit with the code from the license verification step
echo "Unclassified error occured while trying to activate license."
echo " Exit code was: $UNITY_EXIT_CODE "
exit $UNITY_EXIT_CODE
fi
# Return to previous working directory
popd