woodpecker/packaging/scripts/postrm.deb
2014-10-14 13:19:32 +04:00

50 lines
No EOL
819 B
Bash

#!/bin/sh
set -e
dist() {
lsb_release -i | awk '{print tolower($3)}' | sed -e 's/^ *//' -e 's/ *$//'
}
version() {
lsb_release -r | awk '{print $2}' | sed -e 's/^ *//' -e 's/ *$//' | awk -F. '{ print $1 }'
}
upstart() {
rm -f /etc/init/drone.conf
}
systemd() {
rm -f /lib/systemd/system/drone.service
}
validate_ver() {
echo "$(version) < $1" | bc
}
case "$(dist)" in
debian)
if [ "$(version)" -lt "8" ]; then
upstart
else
systemd
fi
;;
ubuntu)
if [ "$(version)" -lt "15" ]; then
upstart
else
systemd
fi
;;
*)
echo "\033[33m Please remove service manually \033[0m"
;;
esac
# https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html
if [ "$1" = "purge" ] ; then
echo "Purging drone configuration"
rm -rf /etc/drone
fi