nagbot.postinst 644 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. set -e
  3. if [ "$1" = "configure" ]; then
  4. USER="nagbot"
  5. # Create the "nagbot" user
  6. if ! getent passwd ${USER} > /dev/null 2>&1
  7. then
  8. adduser --quiet --system --group --home /var/lib/${USER} \
  9. --no-create-home \
  10. --shell /bin/false \
  11. --gecos "${USER} daemon" ${USER}
  12. fi
  13. # Create the "nagbot" group if it is missing and set the primary group
  14. # of the "nagbot" user to this group.
  15. if ! getent group ${USER} > /dev/null 2>&1
  16. then
  17. addgroup --quiet --system ${USER}
  18. usermod -g ${USER} ${USER}
  19. fi
  20. chown -R ${USER}. /etc/${USER} /var/lib/${USER}
  21. chmod 0750 /etc/${USER}
  22. fi
  23. #DEBHELPER#