Skip to content

Commit

Permalink
Add user to clab_admins group (#2452)
Browse files Browse the repository at this point in the history
* Add user to `clab_admins` group

- Add env var `CLAB_ADMINS`. Defaults to `true`. If set to anything else it will not add the user to the `clab_admins` group.

* Add group check to create group
  • Loading branch information
kaelemc authored Feb 10, 2025
1 parent f861ff6 commit f1a3384
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions utils/quick-setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DISTRO_TYPE=""
SETUP_SSHD="${SETUP_SSHD:-true}"
CLAB_ADMINS="${CLAB_ADMINS:-true}"

# Docker version that will be installed by this install script.
DOCKER_VERSION="26.1.4"
Expand Down Expand Up @@ -259,6 +260,16 @@ function install-containerlab {
fi
}

function post-install-clab {
if [ $(getent group clab_admins) ]; then
echo "clab_admins group exists"
else
echo "Creating clab_admins group..."
groupadd -r clab_admins
fi
sudo usermod -aG clab_admins "$SUDO_USER"
}

function all {
# check OS to determine distro
check_os
Expand All @@ -275,6 +286,10 @@ function all {
add-ssh-socket-env-for-sudo

install-containerlab

if [ "${CLAB_ADMINS}" = "true" ]; then
post-install-clab
fi
}

"$@"

0 comments on commit f1a3384

Please sign in to comment.