summaryrefslogtreecommitdiffstats
path: root/abs/core-testing
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2009-02-17 04:54:11 (GMT)
committerJames Meyer <james.meyer@operamail.com>2009-02-17 04:54:11 (GMT)
commit52e7c7e6d99e3d515936d9c51f9fbe65179e5153 (patch)
tree54f63137199aa3b3db7b22b84e820fe29842fc82 /abs/core-testing
parent7c4c17e34fbf3da4024656a99643b4062719513b (diff)
downloadlinhes_pkgbuild-52e7c7e6d99e3d515936d9c51f9fbe65179e5153.zip
linhes_pkgbuild-52e7c7e6d99e3d515936d9c51f9fbe65179e5153.tar.gz
linhes_pkgbuild-52e7c7e6d99e3d515936d9c51f9fbe65179e5153.tar.bz2
Quick replacment shutdown command for runit.
it accepts the -t -r -h commands like init shutdown and errors out for all others.
Diffstat (limited to 'abs/core-testing')
-rwxr-xr-xabs/core-testing/runit/PKGBUILD5
-rwxr-xr-xabs/core-testing/runit/runit.install12
-rwxr-xr-xabs/core-testing/runit/shutdown.script46
3 files changed, 59 insertions, 4 deletions
diff --git a/abs/core-testing/runit/PKGBUILD b/abs/core-testing/runit/PKGBUILD
index c0863bb..1303167 100755
--- a/abs/core-testing/runit/PKGBUILD
+++ b/abs/core-testing/runit/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=runit
pkgver=1.8.0
-pkgrel=57
+pkgrel=61
pkgdesc="A replacement for sysvinit, and other init schemes, with service supervision"
url="http://smarden.org/runit/"
license="BSD"
@@ -10,7 +10,7 @@ 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)
+source=(http://smarden.org/runit/$pkgname-$pkgver.tar.gz add_service.sh remove_service.sh halt.script reboot.script poweroff.script shutdown.script)
arch=('i686')
build() {
@@ -35,6 +35,7 @@ build() {
install -m0755 $startdir/src/reboot.script $startdir/pkg/sbin
install -m0755 $startdir/src/halt.script $startdir/pkg/sbin
install -m0755 $startdir/src/poweroff.script $startdir/pkg/sbin
+ install -m0755 $startdir/src/shutdown.script $startdir/pkg/sbin
for i in `cat ../package/commands`; do
install -m0755 $i $startdir/pkg/sbin/
diff --git a/abs/core-testing/runit/runit.install b/abs/core-testing/runit/runit.install
index 977841b..b6fcb07 100755
--- a/abs/core-testing/runit/runit.install
+++ b/abs/core-testing/runit/runit.install
@@ -4,9 +4,10 @@ pre_install () {
if [ ! -f /sbin/halt-init ]
then
mv /sbin/halt /sbin/halt-init
+ mv /sbin/shutdown /sbin/shutdown-init
+fi
rm -f /sbin/reboot
rm -f /sbin/poweroff
-fi
}
@@ -14,9 +15,14 @@ pre_upgrade () {
if [ ! -f /sbin/halt-init ]
then
mv /sbin/halt /sbin/halt-init
+fi
+
+if [ ! -f /sbin/shutdown-init ]
+then
+ mv /sbin/shutdown /sbin/shutdown-init
+fi
rm -f /sbin/reboot
rm -f /sbin/poweroff
-fi
}
@@ -28,6 +34,7 @@ post_install () {
ln -s /sbin/poweroff.script /sbin/poweroff
ln -s /sbin/halt-init /sbin/reboot.init
ln -s /sbin/halt-init /sbin/poweroff.init
+ ln -s /sbin/shutdown.script /sbin/shutdown
}
@@ -41,6 +48,7 @@ post_upgrade(){
ln -s /sbin/poweroff.script /sbin/poweroff
ln -s /sbin/halt-init /sbin/reboot.init
ln -s /sbin/halt-init /sbin/poweroff.init
+ ln -s /sbin/shutdown.script /sbin/shutdown
}
diff --git a/abs/core-testing/runit/shutdown.script b/abs/core-testing/runit/shutdown.script
new file mode 100755
index 0000000..3bcc5d3
--- /dev/null
+++ b/abs/core-testing/runit/shutdown.script
@@ -0,0 +1,46 @@
+#!/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
+ echo "-t is mandatory"
+ exit 4
+ 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