#!/bin/sh

# Note: Changes to this section may require synchronisation with the install.sh
# source based installation method.

if [ "$1" = install ] || [ "$1" = upgrade ]; then
    # Create the "puppet" user
    if ! getent passwd puppet  > /dev/null; then
        adduser --quiet --system --group --home /usr/share/puppetserver  \
            --no-create-home                                 \
            --gecos "puppetserver" \
            puppet
    fi

    # Create the "puppet" group, if it is missing, and set the
    # primary group of the "puppet" user to this group.
    if ! getent group puppet > /dev/null; then
         addgroup --quiet --system puppet
         usermod -g puppet puppet
    fi


fi
