feat: system setup + groups setup
This commit is contained in:
parent
ce5f8d958a
commit
cd4b46af78
5 changed files with 56 additions and 0 deletions
25
files/usr/libexec/azure-groups
Executable file
25
files/usr/libexec/azure-groups
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# SCRIPT VERSION
|
||||
GROUP_SETUP_VER=1
|
||||
GROUP_SETUP_VER_FILE="/etc/azure/groups"
|
||||
GROUP_SETUP_VER_RAN=$(cat "$GROUP_SETUP_VER_FILE")
|
||||
|
||||
# Run script if updated
|
||||
if [[ -f $GROUP_SETUP_VER_FILE && "$GROUP_SETUP_VER" = "$GROUP_SETUP_VER_RAN" ]]; then
|
||||
echo "Group setup has already run. Exiting..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Setup Groups
|
||||
wheelarray=($(getent group wheel | cut -d ":" -f 4 | tr ',' '\n'))
|
||||
for user in $wheelarray
|
||||
do
|
||||
usermod -aG docker $user
|
||||
usermod -aG incus-admin $user
|
||||
usermod -aG libvirt $user
|
||||
done
|
||||
|
||||
# Prevent future executions
|
||||
echo "Writing state file"
|
||||
echo "$GROUP_SETUP_VER" > "$GROUP_SETUP_VER_FILE"
|
Loading…
Add table
Add a link
Reference in a new issue