Use host user info derived from project directory

This commit is contained in:
Andrew Kahr 2023-11-19 22:59:39 -08:00
parent 8da77ace98
commit 548d06774a

View File

@ -1,5 +1,18 @@
#!/usr/bin/env bash
# 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
#
@ -44,4 +57,9 @@ fi;
# Exit with code from the build step.
#
# Exiting su
exit $BUILD_EXIT_CODE
'
# Exiting main script
exit $BUILD_EXIT_CODE