Only add group and user if they don't exist

This commit is contained in:
phil 2023-07-16 13:03:10 +02:00
parent 5a8657d7ca
commit 5488f154e1

View file

@ -1,12 +1,20 @@
#!/usr/bin/env bash
set -eu
GROUP=tablet
if ! [ $(getent group "$GROUP") ]; then
echo "Add tablet group..."
/usr/sbin/groupadd tablet
fi
read -p "Enter your local username: " user
if ! [ $(groupmems -g "$GROUP" -l | grep "$user" ) ]; then
echo "Add user to group..."
usermod -a -G tablet "$user"
fi
echo "Copy files..."
cp -r tabletmode/ /usr/local/lib/python3.11/dist-packages