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
set -eEuo pipefail
trap 'echo "Error detected: aborting installation."' ERR
trap 'echo "Error detected: aborting installation"' ERR
echo "Attempting to autodetect distro ..."
distro=$(lsb_release -is)
@ -47,10 +47,20 @@ else
fi
sudo chmod +x /etc/containers/startup.sh
if id -u containers; then
echo "Configuring user 'containers' ..."
echo 'Creating "containers" user ...'
# configure containers user
name=containers
uid=5000
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."

Loading…
Cancel
Save