Parse and save acquired floating license for use for returning after build

pull/468/head
Simen Sandvaer 2022-10-16 14:03:02 +02:00
parent b44440fa3a
commit 2387fd18be
2 changed files with 8 additions and 18 deletions

View File

@ -79,21 +79,18 @@ elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
# Custom Unity License Server
#
echo "Adding licensing server config"
pwd
pushd /resources
pwd
cat services-config.json.template
echo "s/%URL%/$UNITY_LICENSING_SERVER/"
cat services-config.json.template | tr -d '\r' | awk "{sub(/%URL%/,\"$UNITY_LICENSING_SERVER\")}1" > services-config.json
cat services-config.json
mkdir -p /usr/share/unity3d/config/
mv services-config.json /usr/share/unity3d/config/
cat /usr/share/unity3d/config/services-config.json
# Activate license
unity-editor \
-logFile /dev/stdout \
-quit
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --acquire-floating > license.txt
# shellcheck disable=SC2002
export FLOATING_LICENSE
FLOATING_LICENSE=$(grep -oP '\".*?\"' < license.txt | tr -d '"' | sed -n 2p)
FLOATING_LICENSE_TIMEOUT=$(grep -oP '\".*?\"' < license.txt | tr -d '"' | sed -n 4p)
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
# Store the exit code from the verify command
UNITY_EXIT_CODE=$?
popd

View File

@ -9,15 +9,8 @@ if [[ -n "$UNITY_LICENSING_SERVER" ]]; then #
#
# Return any floating license used.
#
echo "Returning floating licenses"
for file in ~/.config/unity3d/Unity/licenses/*.xml; do
echo "$file"
token=$(basename $file .xml)
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --return-floating $token
status=$?
echo "status $status"
echo "Returned $token"
done
echo "Returning floating license: \"$FLOATING_LICENSE\""
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --return-floating "$FLOATING_LICENSE"
elif [[ -n "$UNITY_SERIAL" ]]; then
#
# PROFESSIONAL (SERIAL) LICENSE MODE