diff --git a/install.sh b/install.sh index f196c9e..0bf33a7 100755 --- a/install.sh +++ b/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."