grafana/packaging/deb/control
MichaIng 71e5024d7a
Packaging: Stop and disable service on DEB package removal (#59580)
* Stop and disable service on DEB package removal

The condition for this code to run applies on package removal only, not on upgrade or reinstall which generally invoke the prerm script as well.

Currently the service keeps running after package removal, failing at some point due to missing files. And if enabled, the attempted service start on every boot is doomed to fail.

If the invoke-rc.d command exists, it can be assumed that update-rc.d exists as well, as both are part of the same init-system-helpers package in dpkg distro repositories.

If neither systemd, nor the init system helper package is installed, the service is not tried to be disabled, since we cannot know a safe method to do so.

Compared to the postinst script, "set -e" is skipped here, since we do not run any command which is allowed to fail the whole package removal.

Signed-off-by: MichaIng <micha@dietpi.com>

* Add postrm script to package build

Signed-off-by: MichaIng <micha@dietpi.com>

* Remove redundant check

Co-authored-by: Dan Cech <dan@aussiedan.com>

---------

Signed-off-by: MichaIng <micha@dietpi.com>
Co-authored-by: Dan Cech <dan@aussiedan.com>
2023-02-21 10:40:38 -05:00
..
postinst Packaging: Stop and disable service on DEB package removal (#59580) 2023-02-21 10:40:38 -05:00
prerm Packaging: Stop and disable service on DEB package removal (#59580) 2023-02-21 10:40:38 -05:00