Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix preparation script for macOS for shell check #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/scripts/macos/prepare-env.sh
Original file line number Diff line number Diff line change
@@ -11,8 +11,7 @@ printf '%s\n' "export UNITY_EDITOR_PATH=$unity_editor_path" >> "$BASH_ENV"
check_and_install_rosetta() {
if ! /usr/bin/pgrep oahd &> /dev/null; then
echo "Rosetta 2 is not installed. Installing it now..."
softwareupdate --install-rosetta --agree-to-license
if [ $? -eq 0 ]; then
if softwareupdate --install-rosetta --agree-to-license; then
echo "Rosetta 2 installed successfully."
else
echo "Failed to install Rosetta 2."
@@ -89,13 +88,13 @@ resolve_unity_serial() {
# License provided.
elif [ -n "$unity_encoded_license" ]; then
printf '%s\n' "No serial detected. Extracting it from the encoded license."

if ! extract_serial_from_license; then
printf '%s\n' "Failed to parse the serial from the Unity license."
printf '%s\n' "Please try again or open an issue."
printf '%s\n' "See the docs for more details: https://game.ci/docs/circleci/activation#personal-license"
return 1

else
readonly resolved_unity_serial="$decoded_unity_serial"
fi
@@ -116,7 +115,7 @@ extract_serial_from_license() {
# Fix locale setting in PERL.
# https://stackoverflow.com/a/7413863
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_ALL=en_US.UTF-8

local unity_license
local developer_data
@@ -125,7 +124,7 @@ extract_serial_from_license() {
unity_license="$(base64 --decode <<< "$unity_encoded_license")"
developer_data="$(perl -nle 'print $& while m{<DeveloperData Value\="\K.*?(?="/>)}g' <<< "$unity_license")"
encoded_serial="$(cut -c 5- <<< "$developer_data")"

decoded_unity_serial="$(base64 --decode <<< "$encoded_serial")"
readonly decoded_unity_serial

@@ -165,4 +164,4 @@ set -x
-password "$unity_password" \
-serial "$resolved_unity_serial" \
-logfile /dev/stdout
set +x
set +x