post_upgrade() {
    # Create /var/lib/i2pd if it doesn't exist
    systemd-tmpfiles --create i2pd.conf
}

post_install() {
    # Create i2p user/group if it doesn't already exist
    [[ ! $(getent passwd i2p) ]] \
        && useradd -d /var/lib/i2pd -s /usr/bin/nologin i2p

    # Run the upgrade commands
    post_upgrade
}

pre_remove() {
    # Remove the i2p user/group if it already exists
    [[ $(getent passwd i2p) ]] \
        && userdel i2p
}
