post_install() {
    getent group nslcd >> /dev/null  || groupadd --gid 146 nslcd
    getent passwd nslcd >> /dev/null || useradd --gid 146 --uid 146 -M -d /var/run/nslcd -s /bin/false nslcd
}

post_upgrade() {
    post_install

    local ver
    local old_ver="$2"
    local upgrades=(0.9.5-3)

    for ver in "${upgrades[@]}"; do
        if [[ $(vercmp "$ver" "$old_ver") -eq 1 ]]; then
            "_${ver//-/_}_changes"
        fi
    done
}

_0.9.5_3_changes() {
    printf '%s\n' ':: nss-pam-ldapd will from 0.9.5-4 and on use the statically allocated GID 146.'
    printf '%s\n' '   Please switch to the new UID and GID at your convenience.'
}

_0.9.6_3_changes() {
    printf '%s\n' ':: nss-pam-ldapd will from 0.9.6-2 use the statically allocated UID 146.'
    printf '%s\n' '   A previous version was supposed to as well, but it accedentally only used that GID.'
    printf '%s\n' '   Please switch to the new UID at your convenience.'
}
