From b0043b3d2e43f154d7a4d48db95ef59f2d504fdd Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 2 Dec 2010 18:13:52 +0000
Subject: sysvinit: patched to allow reboot/shutdown using binary names of
 poweroff.init and reboot.init

---
 abs/core/sysvinit/PKGBUILD        |  9 +++++----
 abs/core/sysvinit/__changelog     | 20 ++++++++++++++++++++
 abs/core/sysvinit/halt-init.patch | 12 ++++++++++++
 3 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 abs/core/sysvinit/__changelog
 create mode 100644 abs/core/sysvinit/halt-init.patch

diff --git a/abs/core/sysvinit/PKGBUILD b/abs/core/sysvinit/PKGBUILD
index 56d779f..110d93c 100644
--- a/abs/core/sysvinit/PKGBUILD
+++ b/abs/core/sysvinit/PKGBUILD
@@ -4,7 +4,7 @@
 
 pkgname=sysvinit
 pkgver=2.88
-pkgrel=2
+pkgrel=3
 pkgdesc="Linux System V Init"
 arch=('i686' 'x86_64')
 url="http://savannah.nongnu.org/projects/sysvinit"
@@ -12,12 +12,11 @@ license=('GPL')
 groups=('base')
 depends=('shadow' 'util-linux' 'coreutils' 'glibc' 'awk')
 install=sysvinit.install
-source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2)
-md5sums=('6eda8a97b86e0a6f59dabbf25202aa6f')
-sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26')
+source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2 halt-init.patch)
 
 build() {
   cd "${srcdir}/${pkgname}-${pkgver}dsf"
+  patch -p0 < ${srcdir}/halt-init.patch
   make || return 1
 }
 
@@ -25,3 +24,5 @@ package() {
   cd "${srcdir}/${pkgname}-${pkgver}dsf"
   make ROOT="${pkgdir}" install
 }
+md5sums=('6eda8a97b86e0a6f59dabbf25202aa6f'
+         'cd4c5767f63ca5881e3e1f1c4f10f896')
diff --git a/abs/core/sysvinit/__changelog b/abs/core/sysvinit/__changelog
new file mode 100644
index 0000000..9dc0b73
--- /dev/null
+++ b/abs/core/sysvinit/__changelog
@@ -0,0 +1,20 @@
+patch halt to work with runit
+
+--- src/halt.c.orig     2008-08-30 17:25:02.000000000 +0000
++++ src/halt.c  2008-08-30 18:10:29.000000000 +0000
+@@ -186,6 +186,14 @@
+        if (!strcmp(progname, "reboot")) do_reboot = 1;
+        if (!strcmp(progname, "poweroff")) do_poweroff = 1;
+ 
++       if (!strcmp(progname, "reboot.init")) do_reboot = 1;
++       if (!strcmp(progname, "poweroff.init")) do_poweroff = 1;
++
++       //fprintf(stderr, "%d: do_reboot \n ", do_reboot);
++       //fprintf(stderr, "%d: do_poweroff \n ", do_poweroff);
++       //fprintf(stderr, "%s: \n", progname);
++       //do_nothing = 1;
++
+        /*
+         *      Get flags
+         */
+
diff --git a/abs/core/sysvinit/halt-init.patch b/abs/core/sysvinit/halt-init.patch
new file mode 100644
index 0000000..0885252
--- /dev/null
+++ b/abs/core/sysvinit/halt-init.patch
@@ -0,0 +1,12 @@
+--- src/halt.c.orig	2010-02-26 13:45:49.000000000 +0000
++++ src/halt.c	2010-12-02 17:42:51.000000000 +0000
+@@ -198,6 +198,9 @@
+ 	if (!strcmp(progname, "reboot")) do_reboot = 1;
+ 	if (!strcmp(progname, "poweroff")) do_poweroff = 1;
+ 
++	if (!strcmp(progname, "reboot.init")) do_reboot = 1;
++	if (!strcmp(progname, "poweroff.init")) do_poweroff = 1;
++
+ 	/*
+ 	 *	Get flags
+ 	 */
-- 
cgit v0.12