diff --git a/CHANGELOG.md b/CHANGELOG.md index a603e79ed..711eecf70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,9 @@ - [#1641](https://github.com/influxdata/kapacitor/issues/1641): Logs API writes multiple http headers. - [#1657](https://github.com/influxdata/kapacitor/issues/1657): Fix missing dependency in rpm package. - [#1660](https://github.com/influxdata/kapacitor/pull/1660): Force tar owner/group to be root. +- [#1663](https://github.com/influxdata/kapacitor/pull/1663): Fixed install/remove of kapacitor on non-systemd Debian/Ubuntu systems. + Fixes packaging to not enable services on RHEL systems. + Fixes issues with recusive symlinks on systemd systems. ## v1.3.3 [2017-08-11] @@ -272,7 +275,6 @@ For more details on the alerting system see the full documentation [here](https: ### Bugfixes - [#1323](https://github.com/influxdata/kapacitor/pull/1323): Fix issue where credentials to InfluxDB could not be updated dynamically. -- [#1161](https://github.com/influxdata/kapacitor/pull/1161): Fixed install/remove of kapacitor on non-systemd Debian/Ubuntu systems ## v1.2.0 [2017-01-23] diff --git a/scripts/kapacitor.service b/scripts/kapacitor.service index 95d58bf49..47ac33b20 100644 --- a/scripts/kapacitor.service +++ b/scripts/kapacitor.service @@ -16,4 +16,3 @@ Restart=on-failure [Install] WantedBy=multi-user.target -Alias=kapacitor.service diff --git a/scripts/post-install.sh b/scripts/post-install.sh index e3ad4ec43..91118ce7e 100644 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -12,14 +12,17 @@ function install_init { function install_systemd { cp -f $SCRIPT_DIR/kapacitor.service /lib/systemd/system/kapacitor.service +} + +function enable_systemd { systemctl enable kapacitor } -function install_update_rcd { +function enable_update_rcd { update-rc.d kapacitor defaults } -function install_chkconfig { +function enable_chkconfig { chkconfig --add kapacitor } @@ -40,28 +43,25 @@ if [[ -f /etc/redhat-release ]]; then # RHEL-variant logic if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then install_systemd + # Do not enable service else - # Assuming SysVinit + # Assuming SysV install_init - # Run update-rc.d or fallback to chkconfig if not available - if which update-rc.d &>/dev/null; then - install_update_rcd - else - install_chkconfig - fi + # Do not enable service fi elif [[ -f /etc/debian_version ]]; then # Debian/Ubuntu logic if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then install_systemd + enable_systemd else - # Assuming SysVinit + # Assuming SysV install_init # Run update-rc.d or fallback to chkconfig if not available if which update-rc.d &>/dev/null; then - install_update_rcd + enable_update_rcd else - install_chkconfig + enable_chkconfig fi fi elif [[ -f /etc/os-release ]]; then @@ -69,11 +69,6 @@ elif [[ -f /etc/os-release ]]; then if [[ $ID = "amzn" ]]; then # Amazon Linux logic install_init - # Run update-rc.d or fallback to chkconfig if not available - if which update-rc.d &>/dev/null; then - install_update_rcd - else - install_chkconfig - fi + # Do not enable service fi fi diff --git a/scripts/post-uninstall.sh b/scripts/post-uninstall.sh index 22ac82bc7..9a6f15611 100644 --- a/scripts/post-uninstall.sh +++ b/scripts/post-uninstall.sh @@ -1,18 +1,23 @@ #!/bin/bash +function uninstall_init { + rm -f /etc/init.d/kapacitor +} + +function uninstall_systemd { + rm -f /lib/systemd/system/kapacitor.service +} + function disable_systemd { systemctl disable kapacitor - rm -f /lib/systemd/system/kapacitor.service } function disable_update_rcd { - update-rc.d kapacitor remove - rm -f /etc/init.d/kapacitor + update-rc.d -f kapacitor remove } function disable_chkconfig { chkconfig --del kapacitor - rm -f /etc/init.d/kapacitor } if [[ -f /etc/redhat-release ]]; then @@ -23,9 +28,16 @@ if [[ -f /etc/redhat-release ]]; then if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then disable_systemd + uninstall_systemd else - # Assuming sysv - disable_chkconfig + # Assuming SysV + # Run update-rc.d or fallback to chkconfig if not available + if which update-rc.d &>/dev/null; then + disable_update_rcd + else + disable_chkconfig + fi + uninstall_init fi fi elif [[ -f /etc/debian_version ]]; then @@ -36,9 +48,16 @@ elif [[ -f /etc/debian_version ]]; then if [[ "$(readlink /proc/1/exe)" == */systemd ]]; then disable_systemd + uninstall_systemd else - # Assuming sysv - disable_update_rcd + # Assuming SysV + # Run update-rc.d or fallback to chkconfig if not available + if which update-rc.d &>/dev/null; then + disable_update_rcd + else + disable_chkconfig + fi + uninstall_init fi fi elif [[ -f /etc/os-release ]]; then @@ -48,7 +67,14 @@ elif [[ -f /etc/os-release ]]; then if [[ "$1" = "0" ]]; then # Kapacitor is no longer installed, remove from init system rm -f /etc/default/kapacitor - disable_chkconfig + + # Run update-rc.d or fallback to chkconfig if not available + if which update-rc.d &>/dev/null; then + disable_update_rcd + else + disable_chkconfig + fi + uninstall_init fi fi fi