parent
5a6c8229c6
commit
ffec21b216
@ -0,0 +1,15 @@ |
|||||||
|
#!/bin/sh |
||||||
|
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then |
||||||
|
echo "This script should be run as root. Aborting..." > /dev/stderr |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
echo "Adding user to the docker group..." |
||||||
|
# This if statement evaulates if the script is launched using sudo AND not |
||||||
|
# a `sudo su` logged user |
||||||
|
if [ -n "$SUDO_USER" ] && [ "$SUDO_COMMAND" != "/usr/bin/su" ]; then |
||||||
|
usermod -aG docker "$SUDO_USER" |
||||||
|
else |
||||||
|
usermod -aG docker "$(id -un)" |
||||||
|
fi |
Loading…
Reference in new issue