# Note: changes to this section of the spec may require synchronisation with the
# install.sh source based installation methodology.
#
# Add puppetdb group
getent group puppetdb >/dev/null || groupadd --system --force puppetdb

# Add puppetdb user
if getent passwd puppetdb > /dev/null; then
  usermod --gid puppetdb --home %{_app_data} \
  --comment "puppetdb daemon" puppetdb || :
else
  useradd_options=('--system' '--gid' 'puppetdb' '--home' '%{_app_data}' '--shell' "$(which nologin)" '--comment' 'puppetdb daemon')
  useradd "${useradd_options[@]}" puppetdb || :
fi
