From 5e35aa105e7a2e85db2a89fee4114090b1ac55be Mon Sep 17 00:00:00 2001
From: Qing He <qing.he@intel.com>
Date: Fri, 18 Jun 2010 09:40:30 +0800
Subject: [PATCH] sysvinit: upgrade to version 2.88dsf

Upstream-Status: Submitted [https://github.com/slicer69/sysvinit/pull/13]

---
 src/Makefile | 53 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 1b368dc..5b1a5a2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -77,7 +77,14 @@ else
   INSTALL_DATA	= install -m 644
 endif
 INSTALL_DIR	= install -m 755 -d
-MANDIR		= /usr/share/man
+
+ROOT         ?=
+base_bindir  ?= /bin
+base_sbindir ?= /sbin
+bindir       ?= /usr/bin
+sysconfdir   ?= /etc
+includedir   ?= /usr/include
+mandir       ?= /usr/share/man
 
 ifeq ($(WITH_SELINUX),yes)
   SELINUX_DEF	=  -DWITH_SELINUX
@@ -191,43 +198,43 @@ clobber:	cleanobjs
 distclean:	clobber
 
 install:	all
-		$(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
-		$(INSTALL_DIR) $(ROOT)/usr/bin/
+		$(INSTALL_DIR) $(ROOT)$(base_bindir)/ $(ROOT)$(base_sbindir)/
+		$(INSTALL_DIR) $(ROOT)$(bindir)/
 		for i in $(BIN); do \
-			$(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
+			$(INSTALL_EXEC) $$i $(ROOT)$(base_bindir)/ ; \
 		done
 		for i in $(SBIN); do \
-			$(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
+			$(INSTALL_EXEC) $$i $(ROOT)$(base_sbindir)/ ; \
 		done
 		for i in $(USRBIN); do \
-			$(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
+			$(INSTALL_EXEC) $$i $(ROOT)$(bindir)/ ; \
 		done
 		# $(INSTALL_DIR) $(ROOT)/etc/
 		$(INSTALL_DIR) $(ROOT)/etc/inittab.d
 		# $(INSTALL_EXEC) ../doc/initscript.sample $(ROOT)/etc/
-		ln -sf halt $(ROOT)/sbin/reboot
-		ln -sf halt $(ROOT)/sbin/poweroff
-		ln -sf init $(ROOT)/sbin/telinit
-		ln -sf /sbin/killall5 $(ROOT)/bin/pidof
-		if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
-			ln -sf last $(ROOT)/usr/bin/lastb; \
+		ln -sf halt $(ROOT)$(base_sbindir)/reboot
+		ln -sf halt $(ROOT)$(base_sbindir)/poweroff
+		ln -sf init $(ROOT)$(base_sbindir)/telinit
+		ln -sf $(base_sbindir)/killall5 $(ROOT)$(base_bindir)/pidof
+		if [ ! -f $(ROOT)$(bindir)/lastb ]; then \
+			ln -sf last $(ROOT)$(bindir)/lastb; \
 		fi
-		$(INSTALL_DIR) $(ROOT)/usr/include/
-		$(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
-		$(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
-		$(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
-		$(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
+		$(INSTALL_DIR) $(ROOT)$(includedir)/
+		$(INSTALL_DATA) initreq.h $(ROOT)$(includedir)/
+		$(INSTALL_DIR) $(ROOT)$(mandir)/man1/
+		$(INSTALL_DIR) $(ROOT)$(mandir)/man5/
+		$(INSTALL_DIR) $(ROOT)$(mandir)/man8/
 		for man in $(MAN1); do \
-			$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man1/; \
-			sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man1/$$man ; \
+			$(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man1/; \
+			sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man1/$$man ; \
 		done
 		for man in $(MAN5); do \
-			$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man5/; \
-			sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man5/$$man ; \
+			$(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man5/; \
+			sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man5/$$man ; \
 		done
 		for man in $(MAN8); do \
-			$(INSTALL_DATA) ../man/$$man $(ROOT)$(MANDIR)/man8/; \
-			sed -i "1{ $(MANDB); }" $(ROOT)$(MANDIR)/man8/$$man ; \
+			$(INSTALL_DATA) ../man/$$man $(ROOT)$(mandir)/man8/; \
+			sed -i "1{ $(MANDB); }" $(ROOT)$(mandir)/man8/$$man ; \
 		done
 ifeq ($(ROOT),)
 		#
