From 2b104d0d7f09fcf17d3f62a2b8e7fd1014b390ce Mon Sep 17 00:00:00 2001 From: Krzysztof Ksiazek Date: Wed, 31 Aug 2016 15:22:22 +0200 Subject: [PATCH] Add support for chkconfig in RHEL and CentOS --- Makefile | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f1d88a3d6..3fd5d6ebf 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ DEBUG=${ALL_DEBUG} #export OPTZ #export EXTRALINK CURVER=1.2.2 +DISTRO := $(shell gawk -F= '/^NAME/{print $$2}' /etc/os-release) .PHONY: default default: build_deps build_lib build_src @@ -312,13 +313,31 @@ install: src/proxysql install -m 0600 etc/proxysql.cnf /etc install -m 0755 etc/init.d/proxysql /etc/init.d if [ ! -d /var/lib/proxysql ]; then mkdir /var/lib/proxysql ; fi - update-rc.d proxysql defaults +ifeq ($(DISTRO),"CentOS Linux") + chkconfig --level 0123456 proxysql on +else +ifeq ($(DISTRO),"Red Hat Enterprise Linux Server") + chkconfig --level 0123456 proxysql on +else + update-rc.d proxysql defaults +endif +endif .PHONY: install uninstall: - rm /etc/init.d/proxysql rm /etc/proxysql.cnf rm /usr/local/bin/proxysql rmdir /var/lib/proxysql 2>/dev/null || true - update-rc.d proxysql remove +ifeq ($(DISTRO),"CentOS Linux") + chkconfig --level 0123456 proxysql off + rm /etc/init.d/proxysql +else +ifeq ($(DISTRO),"Red Hat Enterprise Linux Server") + chkconfig --level 0123456 proxysql off + rm /etc/init.d/proxysql +else + rm /etc/init.d/proxysql + update-rc.d proxysql remove +endif +endif .PHONY: uninstall