From c7f5e3111ceda7c8f17724706d71a83f015dd421 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Wed, 22 Aug 2018 17:13:20 -0600 Subject: [PATCH] syslog-ng: stop service when uninstalling/updating This avoids the possibility of the service getting reloaded and a previously running instance trying to re-dynamically link to more modern plugins. Signed-off-by: Philip Prindeville --- admin/syslog-ng/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/admin/syslog-ng/Makefile b/admin/syslog-ng/Makefile index 948983416..c1990ba3a 100644 --- a/admin/syslog-ng/Makefile +++ b/admin/syslog-ng/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=syslog-ng PKG_VERSION:=3.17.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=W. Michael Petullo @@ -74,4 +74,19 @@ define Package/syslog-ng/install $(call libtool_remove_files,$(1)) endef +define Package/syslog-ng/prerm + #!/bin/sh + # check if we are on real system + if [ -z "$${IPKG_INSTROOT}" ]; then + # wish we had pidof unconditionally + pid=$(ps | grep syslog | grep -v grep | awk '{ print $$1; }') + [ -n "$$pid" ] && /etc/init.d/syslog-ng stop + [ "$${PKG_UPGRADE}" != "1" ] && { + echo "Removing rc.d symlink for syslog-ng" + /etc/init.d/syslog-ng disable + } + fi + exit 0 +endef + $(eval $(call BuildPackage,syslog-ng))