aboutsummaryrefslogtreecommitdiff
path: root/src/anaconda/install.sh
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2022-06-13 23:30:57 +0300
committerGitHub <noreply@github.com>2022-06-13 23:30:57 +0300
commitfa07406f4dccd482284cb9d8dbaca6533116dab8 (patch)
tree438c8fd7b17b3d69ecede41ea0bdea99fe0e4eea /src/anaconda/install.sh
parent19fd66af965b22f57fd59a0ba31136146b9542d1 (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/anaconda/install.sh')
-rw-r--r--src/anaconda/install.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/anaconda/install.sh b/src/anaconda/install.sh
index 272ba73..c9661d3 100644
--- a/src/anaconda/install.sh
+++ b/src/anaconda/install.sh
@@ -9,7 +9,6 @@
VERSION=${VERSION:-"latest"}
-
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"}
@@ -32,8 +31,8 @@ if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
USERNAME=""
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do
- if id -u ${CURRENT_USER} > /dev/null 2>&1; then
- USERNAME=${CURRENT_USER}
+ if id -u "${CURRENT_USER}" > /dev/null 2>&1; then
+ USERNAME="${CURRENT_USER}"
break
fi
done
@@ -72,11 +71,19 @@ check_packages() {
# Install Conda if it's missing
if ! conda --version &> /dev/null ; then
+ if ! cat /etc/group | grep -e "^conda:" > /dev/null 2>&1; then
+ groupadd -r conda
+ fi
+ usermod -a -G conda "${USERNAME}"
+
# Install dependencies
check_packages wget ca-certificates
mkdir -p $CONDA_DIR
- chown ${USERNAME}:root $CONDA_DIR
+ chown -R :conda "${CONDA_DIR}"
+ chmod -R g+r+w "${CONDA_DIR}"
+
+ find "${CONDA_DIR}" -type d | xargs -n 1 chmod g+s
echo "Installing Anaconda..."
CONDA_VERSION=$VERSION