From d66c33d9e436aa96c477991f89ebd85407bae0cb Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Sat, 20 Aug 2011 10:21:59 -0500
Subject: runit & sysvinit : remove power related scripts and move them to a
 common

---
 abs/core/runit/PKGBUILD            | 18 +++++----------
 abs/core/runit/halt.script         | 16 --------------
 abs/core/runit/poweroff.script     | 11 ----------
 abs/core/runit/reboot.script       | 11 ----------
 abs/core/runit/shutdown.script     | 45 --------------------------------------
 abs/core/sysvinit/PKGBUILD         | 16 ++++++++++----
 abs/core/sysvinit/__changelog      |  4 ++++
 abs/core/sysvinit/sysvinit.install |  3 ---
 8 files changed, 21 insertions(+), 103 deletions(-)
 delete mode 100755 abs/core/runit/halt.script
 delete mode 100755 abs/core/runit/poweroff.script
 delete mode 100755 abs/core/runit/reboot.script
 delete mode 100755 abs/core/runit/shutdown.script
 delete mode 100644 abs/core/sysvinit/sysvinit.install

diff --git a/abs/core/runit/PKGBUILD b/abs/core/runit/PKGBUILD
index f1b1bb2..7bfd9f5 100644
--- a/abs/core/runit/PKGBUILD
+++ b/abs/core/runit/PKGBUILD
@@ -1,16 +1,16 @@
 pkgname=runit
 pkgver=2.1.1
-pkgrel=4
+pkgrel=6
 pkgdesc="A replacement for sysvinit, and other init schemes, with service supervision"
 url="http://smarden.org/runit/"
 license=('BSD')
-depends=('glibc' 'util-linux' 'initscripts')
+depends=('glibc' 'util-linux' 'initscripts' 'poweroff-scripts>= 1.1')
 makedepends=()
 conflicts=()
 replaces=()
 backup=()
-install=runit.install
-source=(http://smarden.org/runit/$pkgname-$pkgver.tar.gz add_service.sh remove_service.sh halt.script reboot.script poweroff.script shutdown.script)
+#install=runit.install
+source=(http://smarden.org/runit/$pkgname-$pkgver.tar.gz add_service.sh remove_service.sh)
 arch=('i686')
 
 build() {
@@ -31,10 +31,6 @@ package() {
   install -d $pkgdir/usr/man/man8
   install -m0755 $srcdir/add_service.sh $pkgdir/sbin
   install -m0755 $srcdir/remove_service.sh $pkgdir/sbin
-  install -m0755 $srcdir/reboot.script $pkgdir/sbin
-  install -m0755 $srcdir/halt.script  $pkgdir/sbin
-  install -m0755 $srcdir/poweroff.script  $pkgdir/sbin
-  install -m0755 $srcdir/shutdown.script  $pkgdir/sbin
 
   cd $srcdir/admin/$pkgname-$pkgver/src
   for i in `cat ../package/commands`; do
@@ -55,8 +51,4 @@ package() {
 }
 md5sums=('8fa53ea8f71d88da9503f62793336bc3'
          '8ee2bffb82e18ab6a10f01dc2cada38a'
-         'e7845f7609459542e6c5fc024a9ef922'
-         'e347ea8cf2981f2cd4105111ea1ce1d4'
-         '263198ec006b87891ea0f3ab1d103086'
-         '3ec5f3013dcbd60b6b957d17ba220585'
-         'febe6821f4bea3bfa93f4b6d3df4d801')
+         'e7845f7609459542e6c5fc024a9ef922')
diff --git a/abs/core/runit/halt.script b/abs/core/runit/halt.script
deleted file mode 100755
index b49ed7c..0000000
--- a/abs/core/runit/halt.script
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-. /etc/profile
-INIT=`ps -p 1 -o comm=`
-if [ x$1 = x-w ]
-then
-	/sbin/halt-init -w
-	exit 0
-fi
-chvt 1
-if [ x$INIT = xrunit ]
-then
- 	 /sbin/halt-runit $@
-else
-     	/sbin/halt-init $@
-fi
-
diff --git a/abs/core/runit/poweroff.script b/abs/core/runit/poweroff.script
deleted file mode 100755
index 99779eb..0000000
--- a/abs/core/runit/poweroff.script
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-. /etc/profile
-INIT=`ps -p 1 -o comm=`
-chvt 1
-if [ x$INIT = xrunit ]
-then
- 	 /sbin/halt-runit $@
-else
-     	/sbin/poweroff.init $@
-fi
-
diff --git a/abs/core/runit/reboot.script b/abs/core/runit/reboot.script
deleted file mode 100755
index fcce679..0000000
--- a/abs/core/runit/reboot.script
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-. /etc/profile
-INIT=`ps -p 1 -o comm=`
-chvt 1
-if [ x$INIT = xrunit ]
-then
- 	 /sbin/reboot-runit $@
-else
-     	/sbin/reboot.init $@
-fi
-
diff --git a/abs/core/runit/shutdown.script b/abs/core/runit/shutdown.script
deleted file mode 100755
index 229996b..0000000
--- a/abs/core/runit/shutdown.script
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-. /etc/profile
-INIT=`ps -p 1 -o comm=`
-if [ x$INIT = xrunit ]
-then
-	reboot=""
-	halt=""
-	delay=""
- 	while getopts rht:  name
-	do
-        	case $name in
-                  r)    reboot=1 ;;
-                  h)    halt=1 ;;
-                  t) delay="$OPTARG"
-                        if [ x$delay = "xnow" ]
-                        then
-                                delay=0
-                        fi
-                        ;;
-                *)
-                      exit 2;;
-                        esac
-	done
-	if [ x$delay = x ]
-	then
-	    delay=0
-    fi
-
-	if [ x$reboot = x1 ]
-	then
-         wall "System will reboot in $delay seconds"
-                sleep $delay
-               /sbin/runit-init 6
-	fi
-
-	if [ x$halt = x1 ]
-	then
-                wall "System will poweroff  in $delay seconds"
-                sleep $delay
-               /sbin/runit-init 0
-	fi
-
-else
-     	/sbin/shutdown-init $@
-fi
diff --git a/abs/core/sysvinit/PKGBUILD b/abs/core/sysvinit/PKGBUILD
index 3be24b0..e2c87ab 100644
--- a/abs/core/sysvinit/PKGBUILD
+++ b/abs/core/sysvinit/PKGBUILD
@@ -4,13 +4,13 @@
 
 pkgname=sysvinit
 pkgver=2.88
-pkgrel=4
+pkgrel=5
 pkgdesc="Linux System V Init"
 arch=('i686' 'x86_64')
 url="http://savannah.nongnu.org/projects/sysvinit"
 license=('GPL')
 groups=('base')
-depends=('shadow' 'util-linux' 'coreutils' 'glibc' 'awk')
+depends=('shadow' 'util-linux' 'coreutils' 'glibc' 'awk' 'poweroff-scripts')
 source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2 halt-init.patch)
 
 build() {
@@ -26,8 +26,16 @@ package() {
   # Rename some stuff so it does not bigfoot changes needed for runit
   cd "${pkgdir}/sbin"
   rm -f reboot poweroff
-  mv halt halt-init
-  mv shutdown shutdown-init
+  #These will be created in the poweroff-scripts post-install section
+  #This should be removed when moving to 64 and we have no legacy to worry about
+  #ln -s halt.init reboot.init
+  #ln -s halt.init poweroff.init 
+
+
+
+  mv halt halt.init
+  mv shutdown shutdown.init
+
 
 }
 md5sums=('6eda8a97b86e0a6f59dabbf25202aa6f'
diff --git a/abs/core/sysvinit/__changelog b/abs/core/sysvinit/__changelog
index 2a93469..f249199 100644
--- a/abs/core/sysvinit/__changelog
+++ b/abs/core/sysvinit/__changelog
@@ -24,3 +24,7 @@ patch halt to work with runit
 * mv shutdown shutdown-init
 * rm -f reboot poweroff
 * remove sysvinit.install
+
+#add -jm
+'poweroff-scripts' as a depend
+
diff --git a/abs/core/sysvinit/sysvinit.install b/abs/core/sysvinit/sysvinit.install
deleted file mode 100644
index 2f0e62e..0000000
--- a/abs/core/sysvinit/sysvinit.install
+++ /dev/null
@@ -1,3 +0,0 @@
-post_upgrade() {
-  [ -x sbin/init ] && sbin/init u
-}
-- 
cgit v0.12