mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Move host user specific code within if statement. Test uuid solution
This commit is contained in:
parent
30b936fecb
commit
91ab33e43b
43
dist/platforms/ubuntu/entrypoint.sh
vendored
43
dist/platforms/ubuntu/entrypoint.sh
vendored
@ -1,22 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
fullProjectPath="$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||
|
||||
# Get host user/group info so we create files with the correct ownership
|
||||
USERNAME=$(stat -c '%U' "$fullProjectPath")
|
||||
USERID=$(stat -c '%u' "$fullProjectPath")
|
||||
GROUPNAME=$(stat -c '%G' "$fullProjectPath")
|
||||
GROUPID=$(stat -c '%g' "$fullProjectPath")
|
||||
|
||||
groupadd -g $GROUPID $GROUPNAME
|
||||
useradd -u $USERID -g $GROUPID $USERNAME
|
||||
usermod -aG $GROUPNAME $USERNAME
|
||||
mkdir -p "/home/$USERNAME"
|
||||
chown $USERNAME:$GROUPNAME "/home/$USERNAME"
|
||||
|
||||
# Normally need root permissions to access when using su
|
||||
chmod 777 /dev/stdout
|
||||
chmod 777 /dev/stderr
|
||||
# Ensure machine ID is randomized
|
||||
dbus-uuidgen > /etc/machine-id && mkdir -p /var/lib/dbus/ && ln -sf /etc/machine-id /var/lib/dbus/machine-id
|
||||
|
||||
#
|
||||
# Prepare Android SDK, if needed
|
||||
@ -53,6 +38,30 @@ else
|
||||
fi
|
||||
|
||||
if [[ "RUN_AS_HOST_USER" == "true" ]]; then
|
||||
# Stop on error if we can't set up the user
|
||||
set -e
|
||||
|
||||
fullProjectPath="$GITHUB_WORKSPACE/$PROJECT_PATH"
|
||||
|
||||
# Get host user/group info so we create files with the correct ownership
|
||||
USERNAME=$(stat -c '%U' "$fullProjectPath")
|
||||
USERID=$(stat -c '%u' "$fullProjectPath")
|
||||
GROUPNAME=$(stat -c '%G' "$fullProjectPath")
|
||||
GROUPID=$(stat -c '%g' "$fullProjectPath")
|
||||
|
||||
groupadd -g $GROUPID $GROUPNAME
|
||||
useradd -u $USERID -g $GROUPID $USERNAME
|
||||
usermod -aG $GROUPNAME $USERNAME
|
||||
mkdir -p "/home/$USERNAME"
|
||||
chown $USERNAME:$GROUPNAME "/home/$USERNAME"
|
||||
|
||||
# Normally need root permissions to access when using su
|
||||
chmod 777 /dev/stdout
|
||||
chmod 777 /dev/stderr
|
||||
|
||||
# Don't stop on error when running our scripts as error handling is baked in
|
||||
set +e
|
||||
|
||||
# Switch to the host user so we can create files with the correct ownership
|
||||
su $USERNAME -c "$SHELL -c 'source /steps/runsteps.sh'"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user