# arg 1:  the new package version
pre_install() {
    true
}

# arg 1:  the new package version
post_install() {
    post_upgrade
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade() {
    systemctl stop rustdesk || true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
    systemctl daemon-reload
    if systemctl -q is-active 'rustdesk.service'; then
	systemctl restart 'rustdesk.service'
    fi
    update-desktop-database
}

# arg 1:  the old package version
pre_remove() {
    systemctl stop rustdesk || true
    systemctl disable rustdesk || true
}

# arg 1:  the old package version
post_remove() {
    update-desktop-database
}

