mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Use host user info derived from project directory
This commit is contained in:
parent
8da77ace98
commit
548d06774a
90
dist/platforms/ubuntu/entrypoint.sh
vendored
90
dist/platforms/ubuntu/entrypoint.sh
vendored
@ -1,47 +1,65 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#
|
# Get host user/group info so we create files with the correct ownership
|
||||||
# Create directory for license activation
|
USERNAME=stat -c '%U' "$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||||
#
|
USERID=stat -c '%u' "$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||||
|
GROUPNAME=stat -c '%G' "$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||||
|
GROUPID=stat -c '%g' "$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||||
|
|
||||||
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license~"
|
useradd -u $USERID -g $GROUPID $USERNAME
|
||||||
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
usermod -aG $GROUPNAME $USERNAME
|
||||||
|
mkdir -p "/home/$USERNAME"
|
||||||
|
chown $USERNAME:$GROUPNAME "/home/$USERNAME"
|
||||||
|
|
||||||
#
|
# Switch to the host user so we can create files with the correct ownership
|
||||||
# Run steps
|
su - $USERNAME -c '
|
||||||
#
|
#
|
||||||
source /steps/set_extra_git_configs.sh
|
# Create directory for license activation
|
||||||
source /steps/set_gitcredential.sh
|
#
|
||||||
source /steps/activate.sh
|
|
||||||
source /steps/build.sh
|
|
||||||
source /steps/return_license.sh
|
|
||||||
|
|
||||||
#
|
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license~"
|
||||||
# Remove license activation directory
|
mkdir -p "$ACTIVATE_LICENSE_PATH"
|
||||||
#
|
|
||||||
|
|
||||||
rm -r "$ACTIVATE_LICENSE_PATH"
|
#
|
||||||
chmod -R 777 "/BlankProject"
|
# Run steps
|
||||||
|
#
|
||||||
|
source /steps/set_extra_git_configs.sh
|
||||||
|
source /steps/set_gitcredential.sh
|
||||||
|
source /steps/activate.sh
|
||||||
|
source /steps/build.sh
|
||||||
|
source /steps/return_license.sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Instructions for debugging
|
# Remove license activation directory
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ $BUILD_EXIT_CODE -gt 0 ]]; then
|
rm -r "$ACTIVATE_LICENSE_PATH"
|
||||||
echo ""
|
chmod -R 777 "/BlankProject"
|
||||||
echo "###########################"
|
|
||||||
echo "# Failure #"
|
|
||||||
echo "###########################"
|
|
||||||
echo ""
|
|
||||||
echo "Please note that the exit code is not very descriptive."
|
|
||||||
echo "Most likely it will not help you solve the issue."
|
|
||||||
echo ""
|
|
||||||
echo "To find the reason for failure: please search for errors in the log above."
|
|
||||||
echo ""
|
|
||||||
fi;
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Exit with code from the build step.
|
# Instructions for debugging
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if [[ $BUILD_EXIT_CODE -gt 0 ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "###########################"
|
||||||
|
echo "# Failure #"
|
||||||
|
echo "###########################"
|
||||||
|
echo ""
|
||||||
|
echo "Please note that the exit code is not very descriptive."
|
||||||
|
echo "Most likely it will not help you solve the issue."
|
||||||
|
echo ""
|
||||||
|
echo "To find the reason for failure: please search for errors in the log above."
|
||||||
|
echo ""
|
||||||
|
fi;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Exit with code from the build step.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Exiting su
|
||||||
|
exit $BUILD_EXIT_CODE
|
||||||
|
'
|
||||||
|
|
||||||
|
# Exiting main script
|
||||||
exit $BUILD_EXIT_CODE
|
exit $BUILD_EXIT_CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user