From fa07406f4dccd482284cb9d8dbaca6533116dab8 Mon Sep 17 00:00:00 2001 From: Samruddhi Khandale Date: Mon, 13 Jun 2022 13:30:57 -0700 Subject: add missing user groups to fix permission issues for non root user (#45) * add missing user groups * fix username * move chmod: anaconda --- src/oryx/install.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/oryx/install.sh') 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!" -- cgit v1.2.3