Browse Source

added user creation/config to install script

feature/startup-from-labels
Mario Alegre 5 years ago
parent
commit
a9f1cc59ff
  1. 22
      install.sh

22
install.sh

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -eEuo pipefail set -eEuo pipefail
trap 'echo "Error detected: aborting installation."' ERR trap 'echo "Error detected: aborting installation"' ERR
echo "Attempting to autodetect distro ..." echo "Attempting to autodetect distro ..."
distro=$(lsb_release -is) distro=$(lsb_release -is)
@ -47,10 +47,20 @@ else
fi fi
sudo chmod +x /etc/containers/startup.sh sudo chmod +x /etc/containers/startup.sh
if id -u containers; then # configure containers user
echo "Configuring user 'containers' ..." name=containers
uid=5000
echo 'Creating "containers" user ...' subrange="1000000:1000000000"
if ! getent group $name; then
echo "Creating group '$name' ..."
groupadd -r -g $uid $name
fi
if ! getent passwd $name; then
echo "Creating user '$name' ..."
useradd -r -u $uid -p '*'-s /sbin/nologin -d /srv/vol -g $name $name
fi
echo "Configuring user '$name' ..."
groupmod -g $uid $name
usermod -u $uid -p '*' -s /sbin/nologin -d /srv/vol/ -G '' -v $subrange -w $subrange -g $name $name
echo "Install finished successfully." echo "Install finished successfully."

Loading…
Cancel
Save