Add simple service script for SysV init compat.

This patch adds a simple `service <script> <stop|start|reload|restart>`
script for for SysV init compatibility.  Very common with users of the
Ubuntu upstart init as well.

Also, fixed `make uninstall` for plugins.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-09-19 22:04:26 +02:00
parent 125fc661a3
commit eec166a9eb
2 changed files with 30 additions and 15 deletions
+16 -15
View File
@@ -77,17 +77,17 @@ reboot: reboot.o $(DEPLIBS)
install-exec: all
@$(INSTALL) -d $(DESTDIR)$(FINIT_RCSD)
@$(INSTALL) -d $(DESTDIR)$(sbindir)
@for file in $(EXEC); do \
@for file in $(EXEC); do \
printf " INSTALL $(DESTDIR)$(sbindir)/$$file\n"; \
$(STRIPINST) $$file $(DESTDIR)$(sbindir)/$$file; \
done
@printf " INSTALL $(DESTDIR)$(sbindir)/service\n"
@$(INSTALL) -m 0755 service $(DESTDIR)$(sbindir)/service
printf " INSTALL $(DESTDIR)$(sbindir)/telinit\n"
@ln -sf finit $(DESTDIR)$(sbindir)/telinit
ifndef LIBITE
$(MAKE) -C libite install-exec
endif
ifndef LIBUEV
$(MAKE) -C plugins install
ifndef LIBITE
$(MAKE) -C libite install-exec
endif
install-data:
@@ -118,26 +118,27 @@ uninstall-exec:
printf " REMOVE $(DESTDIR)$(sbindir)/$$file\n"; \
rm $(DESTDIR)$(sbindir)/$$file 2>/dev/null; \
done
-@rm $(DESTDIR)$(sbindir)/initctl
-@for file in service telinit; do \
printf " REMOVE $(DESTDIR)$(sbindir)/$$file\n"; \
rm $(DESTDIR)$(sbindir)/$$file 2>/dev/null; \
done
-@rmdir $(DESTDIR)$(sbindir) 2>/dev/null
-@rmdir $(DESTDIR)$(FINIT_RCSD) 2>/dev/null
$(MAKE) -C plugins uninstall
ifndef LIBITE
$(MAKE) -C libite uninstall
endif
ifndef LIBUEV
$(MAKE) -C plugins uninstall
endif
uninstall-data:
@for file in $(DISTFILES); do \
-@for file in $(DISTFILES); do \
printf " REMOVE $(DESTDIR)$(datadir)/$$file\n"; \
rm $(DESTDIR)$(datadir)/$$file 2>/dev/null; \
done
-@rmdir $(DESTDIR)$(mandir)
-@rmdir $(DESTDIR)$(datadir)
-@rmdir $(DESTDIR)$(mandir) 2>/dev/null
-@rmdir $(DESTDIR)$(datadir) 2>/dev/null
uninstall-dev:
-@$(RM) -rf $(DESTDIR)$(incdir)
-@$(RM) -rf $(DESTDIR)$(incdir) 2>/dev/null
uninstall: uninstall-exec uninstall-data uninstall-dev
@@ -145,13 +146,13 @@ clean:
+$(MAKE) -C plugins $@
+$(MAKE) -C libite $@
+$(MAKE) -C libuev $@
-@$(RM) $(OBJS) $(DEPS) $(EXEC)
-@$(RM) $(OBJS) $(DEPS) $(EXEC) 2>/dev/null
distclean: clean
+$(MAKE) -C plugins $@
+$(MAKE) -C libite $@
+$(MAKE) -C libuev $@
-@$(RM) $(JUNK) config.mk config.h unittest *.o *.html
-@$(RM) $(JUNK) config.mk config.h unittest *.o *.html 2>/dev/null
check:
$(CHECK) *.c plugins/*.c
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
if [ $# -eq 0 ]; then
initctl show
exit 0
fi
if [ $# -lt 2 -o $# -gt 2 ]; then
echo "Usage: service [job# | name] <stop | start | restart | reload>"
exit 1
fi
initctl $2 $1