From 2387fd18be84b863db34add70989d0d2d8757860 Mon Sep 17 00:00:00 2001 From: Simen Sandvaer Date: Sun, 16 Oct 2022 14:03:02 +0200 Subject: [PATCH] Parse and save acquired floating license for use for returning after build --- dist/platforms/ubuntu/steps/activate.sh | 15 ++++++--------- dist/platforms/ubuntu/steps/return_license.sh | 11 ++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/dist/platforms/ubuntu/steps/activate.sh b/dist/platforms/ubuntu/steps/activate.sh index 59031b36..2773205f 100755 --- a/dist/platforms/ubuntu/steps/activate.sh +++ b/dist/platforms/ubuntu/steps/activate.sh @@ -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 diff --git a/dist/platforms/ubuntu/steps/return_license.sh b/dist/platforms/ubuntu/steps/return_license.sh index 971b3878..f0f68b58 100755 --- a/dist/platforms/ubuntu/steps/return_license.sh +++ b/dist/platforms/ubuntu/steps/return_license.sh @@ -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