summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile18
1 files changed, 8 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index d7d7f9c..ec61ba7 100644
--- a/Makefile
+++ b/Makefile
@@ -2,24 +2,21 @@
prefix = /opt/Gitlab_Auto_Deploy/
-init_version := $(shell init --version 2>&1)
-test_upstart := $(shell printf $(init_version) | grep upstart | wc -l)
-test_systemd := $(shell printf $(init_version) | grep systemd | wc -l)
-test_initv := $(shell printf $(init_version) | grep invalid | wc -l)
+init_version := $(shell /sbin/init --version 2>&1)
+test_upstart := $(shell printf $(init_version) | grep -q upstart || grep -q upstart /proc/net/unix ; echo $$?)
+test_systemd := $(shell printf $(init_version) | grep -q systemd || grep -q systemd /proc/1/comm || grep -q systemd /proc/net/unix ; echo $$?)
all:
clean:
initsystem:
-ifeq ($(test_upstart),1)
+ifeq ($(test_upstart),0)
@echo "Upstart detected!"
-else ifeq ($(test_systemd),1)
+else ifeq ($(test_systemd),0)
@echo "Systemd detected!"
-else ifeq ($(test_initv),1)
- @echo "InitV detected!"
else
- @echo "Error. Can't detect init system!"
+ @echo "InitV supposed"
endif
@echo "Done!"
@@ -29,6 +26,7 @@ install: clean all
@sudo cp GitAutoDeploy.conf.json.example $(prefix)GitAutoDeploy.conf.json
@sudo cp GitAutoDeploy.py $(prefix)
@sudo chmod +x $(prefix)GitAutoDeploy.py
-
+
@echo "Installing run-on-startup scripts according to your init system ..."
@make --silent initsystem
+