diff options
author | Samruddhi Khandale <skhandale@microsoft.com> | 2022-06-13 23:30:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 23:30:57 +0300 |
commit | fa07406f4dccd482284cb9d8dbaca6533116dab8 (patch) | |
tree | 438c8fd7b17b3d69ecede41ea0bdea99fe0e4eea /src/oryx | |
parent | 19fd66af965b22f57fd59a0ba31136146b9542d1 (diff) |
add missing user groups to fix permission issues for non root user (#45)
* add missing user groups
* fix username
* move chmod: anaconda
Diffstat (limited to 'src/oryx')
-rw-r--r-- | src/oryx/devcontainer-feature.json | 3 | ||||
-rwxr-xr-x | src/oryx/install.sh | 17 |
2 files changed, 15 insertions, 5 deletions
diff --git a/src/oryx/devcontainer-feature.json b/src/oryx/devcontainer-feature.json index f42e9ce..5c3be58 100644 --- a/src/oryx/devcontainer-feature.json +++ b/src/oryx/devcontainer-feature.json @@ -4,7 +4,8 @@ "containerEnv": { "ORYX_SDK_STORAGE_BASE_URL": "https://oryx-cdn.microsoft.io", "ENABLE_DYNAMIC_INSTALL": "true", - "DYNAMIC_INSTALL_ROOT_DIR": "/tmp/oryx-platforms", + "DYNAMIC_INSTALL_ROOT_DIR": "/usr/local/oryx-platforms", + "ORYX_PREFER_USER_INSTALLED_SDKS": "true", "ORYX_DIR": "/usr/local/oryx", "PATH": "${ORYX_DIR}:${PATH}" }, diff --git a/src/oryx/install.sh b/src/oryx/install.sh index c0e04d2..5eeaf18 100755 --- a/src/oryx/install.sh +++ b/src/oryx/install.sh @@ -86,6 +86,11 @@ check_packages git sudo wget ca-certificates if ! oryx --version > /dev/null ; then echo "Installing Oryx..." + if ! cat /etc/group | grep -e "^oryx:" > /dev/null 2>&1; then + groupadd -r oryx + fi + usermod -a -G oryx "${USERNAME}" + # Install dotnet unless available if ! dotnet --version > /dev/null ; then echo "'dotnet' was not detected. Attempting to install the latest version of the dotnet sdk to build oryx." @@ -104,7 +109,6 @@ if ! oryx --version > /dev/null ; then mkdir -p ${BUILD_SCRIPT_GENERATOR} mkdir -p ${ORYX} - chown -R ${USERNAME} ${BUILD_SCRIPT_GENERATOR} ${ORYX} git clone --depth=1 https://github.com/microsoft/Oryx $GIT_ORYX $GIT_ORYX/build/buildSln.sh @@ -118,11 +122,16 @@ if ! oryx --version > /dev/null ; then ln -s ${BUILD_SCRIPT_GENERATOR}/GenerateBuildScript ${ORYX}/oryx cp -f $GIT_ORYX/images/build/benv.sh ${ORYX}/benv - ORYX_INSTALL_DIR="/tmp/oryx-platforms" + ORYX_INSTALL_DIR="/usr/local/oryx-platforms" mkdir -p "${ORYX_INSTALL_DIR}" - chown -R ${USERNAME} "${ORYX_INSTALL_DIR}" - updaterc "export ORYX_SDK_STORAGE_BASE_URL=https://oryx-cdn.microsoft.io && export ENABLE_DYNAMIC_INSTALL=true && DYNAMIC_INSTALL_ROOT_DIR=$ORYX_INSTALL_DIR" + updaterc "export ORYX_SDK_STORAGE_BASE_URL=https://oryx-cdn.microsoft.io && export ENABLE_DYNAMIC_INSTALL=true && DYNAMIC_INSTALL_ROOT_DIR=$ORYX_INSTALL_DIR && ORYX_PREFER_USER_INSTALLED_SDKS=true" + + chown -R :oryx "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" + chmod -R g+r+w "${ORYX_INSTALL_DIR}" "${BUILD_SCRIPT_GENERATOR}" "${ORYX}" + find "${ORYX_INSTALL_DIR}" -type d | xargs -n 1 chmod g+s + find "${BUILD_SCRIPT_GENERATOR}" -type d | xargs -n 1 chmod g+s + find "${ORYX}" -type d | xargs -n 1 chmod g+s fi echo "Done!" |