openldap.install 671 B

1234567891011121314151617181920212223242526272829
  1. post_install(){
  2. if ! getent group ldap &>/dev/null; then
  3. groupadd -g 439 ldap >/dev/null
  4. fi
  5. if ! getent passwd ldap &>/dev/null; then
  6. useradd -u 439 -g ldap -G adm -d /var/lib/openldap -s /bin/nologin ldap >/dev/null
  7. fi
  8. if ! groups ldap | grep adm &>/dev/null; then
  9. gpasswd -a ldap adm >/dev/null
  10. fi
  11. ldap_shell=$(getent passwd ldap | cut -d: -f7)
  12. if [ "$ldap_shell" != '/bin/nologin' ]; then
  13. chsh -s /bin/nologin ldap &>/dev/null
  14. fi
  15. }
  16. post_upgrade(){
  17. post_install
  18. }
  19. post_remove(){
  20. if getent passwd ldap &>/dev/null; then
  21. userdel ldap >/dev/null
  22. fi
  23. if getent group ldap &>/dev/null; then
  24. groupdel ldap >/dev/null
  25. fi
  26. }