Skip to content

Commit

Permalink
update package scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Nov 8, 2017
1 parent 56fc957 commit ca93875
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 29 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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]

Expand Down Expand Up @@ -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]

Expand Down
1 change: 0 additions & 1 deletion scripts/kapacitor.service
Expand Up @@ -16,4 +16,3 @@ Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=kapacitor.service
31 changes: 13 additions & 18 deletions scripts/post-install.sh
Expand Up @@ -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
}

Expand All @@ -40,40 +43,32 @@ 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
source /etc/os-release
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
44 changes: 35 additions & 9 deletions 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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit ca93875

Please sign in to comment.