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 # Custom Unity License Server
# #
echo "Adding licensing server config" echo "Adding licensing server config"
pwd
pushd /resources 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.template | tr -d '\r' | awk "{sub(/%URL%/,\"$UNITY_LICENSING_SERVER\")}1" > services-config.json
cat services-config.json
mkdir -p /usr/share/unity3d/config/ mkdir -p /usr/share/unity3d/config/
mv services-config.json /usr/share/unity3d/config/ mv services-config.json /usr/share/unity3d/config/
cat /usr/share/unity3d/config/services-config.json
# Activate license # Activate license
unity-editor \ /opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --acquire-floating > license.txt
-logFile /dev/stdout \ # shellcheck disable=SC2002
-quit 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 # Store the exit code from the verify command
UNITY_EXIT_CODE=$? UNITY_EXIT_CODE=$?
popd popd

View File

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