From d4134dfdc9d538ffc075d3343eaed0b40a8a0b98 Mon Sep 17 00:00:00 2001 From: Federico Ceratto Date: Wed, 13 Apr 2016 23:26:25 +0100 Subject: Add postrm and TODO, update service --- debian/TODO.Debian | 4 ++++ debian/netdata.postrm | 36 ++++++++++++++++++++++++++++++++++++ debian/netdata.service | 1 - 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 debian/TODO.Debian create mode 100644 debian/netdata.postrm diff --git a/debian/TODO.Debian b/debian/TODO.Debian new file mode 100644 index 000000000..d2bc95ecf --- /dev/null +++ b/debian/TODO.Debian @@ -0,0 +1,4 @@ +* De-vendorize JS libraries +* Restrict security permissions in netdata.service +* Do cleanup when apt-get purge is run + * delete user, /var/cache/netdata, /var/log/netdata diff --git a/debian/netdata.postrm b/debian/netdata.postrm new file mode 100644 index 000000000..c6ddc7e16 --- /dev/null +++ b/debian/netdata.postrm @@ -0,0 +1,36 @@ +#!/bin/sh + +set -e + +case "$1" in + remove) + ;; + + purge) + for dir_name in /var/cache/netdata /var/lib/netdata /var/lib/netdata/www; do + if dpkg-statoverride --list | grep -qw "$dir_name"; then + dpkg-statoverride --remove "$dir_name" + fi + done + + if getent passwd netdata >/dev/null; then + if [ -x /usr/sbin/deluser ]; then + deluser --quiet --system netdata || echo "Unable to remove netdata user" + fi + fi + + if getent group netdata >/dev/null; then + if [ -x /usr/sbin/delgroup ]; then + delgroup --quiet --system netdata || echo "Unable to remove netdata group" + fi + fi + + ;; + + *) + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/netdata.service b/debian/netdata.service index de65617dc..59ca57546 100644 --- a/debian/netdata.service +++ b/debian/netdata.service @@ -18,7 +18,6 @@ ExecStart=/usr/sbin/netdata ExecReload=/usr/sbin/netdata reload #ExecStop=/bin/kill -SIGTERM $MAINPID ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry=TERM/5/KILL/5 --pidfile /run/netdata.pid -#ExecStop=/bin/kill -SIGTERM $MAINPID TimeoutStopSec=30 KillMode=mixed -- cgit v1.2.3