-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use host user info derived from project directory
- Loading branch information
1 parent
8da77ac
commit 548d067
Showing
1 changed file
with
61 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,65 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Create directory for license activation | ||
# | ||
|
||
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license~" | ||
mkdir -p "$ACTIVATE_LICENSE_PATH" | ||
|
||
# | ||
# 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 | ||
|
||
# | ||
# Remove license activation directory | ||
# | ||
|
||
rm -r "$ACTIVATE_LICENSE_PATH" | ||
chmod -R 777 "/BlankProject" | ||
|
||
# | ||
# 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. | ||
# | ||
# Get host user/group info so we create files with the correct ownership | ||
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" | ||
|
||
useradd -u $USERID -g $GROUPID $USERNAME | ||
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 | ||
su - $USERNAME -c ' | ||
# | ||
# Create directory for license activation | ||
# | ||
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license~" | ||
mkdir -p "$ACTIVATE_LICENSE_PATH" | ||
# | ||
# 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 | ||
# | ||
# Remove license activation directory | ||
# | ||
rm -r "$ACTIVATE_LICENSE_PATH" | ||
chmod -R 777 "/BlankProject" | ||
# | ||
# 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 |