diff options
Diffstat (limited to 'abs/core/poweroff-scripts')
-rw-r--r-- | abs/core/poweroff-scripts/PKGBUILD | 27 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/halt.script | 16 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/poweroff-scripts.install | 28 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/poweroff.script | 11 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/reboot.script | 11 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/shutdown.script | 45 |
6 files changed, 138 insertions, 0 deletions
diff --git a/abs/core/poweroff-scripts/PKGBUILD b/abs/core/poweroff-scripts/PKGBUILD new file mode 100644 index 0000000..af2fcd4 --- /dev/null +++ b/abs/core/poweroff-scripts/PKGBUILD @@ -0,0 +1,27 @@ +pkgname=poweroff-scripts +pkgver=1.1 +pkgrel=2 +pkgdesc="replacement scripts to work with sysvinit and runit" +license=('GPL') +depends=('sysvinit>=2.88' 'runit>=2.1.1-6') +makedepends=() +conflicts=() +replaces=() +backup=() +install=poweroff-scripts.install +source=(halt.script reboot.script poweroff.script shutdown.script) +arch=('i686') + +build() { + install -d $pkgdir/sbin/ + install -m0755 $srcdir/reboot.script $pkgdir/sbin/reboot + install -m0755 $srcdir/halt.script $pkgdir/sbin/halt + install -m0755 $srcdir/poweroff.script $pkgdir/sbin/poweroff + install -m0755 $srcdir/shutdown.script $pkgdir/sbin/shutdown + +} + +md5sums=('e84d487ebd5c3cccd3477988efad3080' + '263198ec006b87891ea0f3ab1d103086' + '3ec5f3013dcbd60b6b957d17ba220585' + '953653da83f5188d51373abf4a42ba05') diff --git a/abs/core/poweroff-scripts/halt.script b/abs/core/poweroff-scripts/halt.script new file mode 100644 index 0000000..cfc05aa --- /dev/null +++ b/abs/core/poweroff-scripts/halt.script @@ -0,0 +1,16 @@ +#!/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/poweroff-scripts/poweroff-scripts.install b/abs/core/poweroff-scripts/poweroff-scripts.install new file mode 100644 index 0000000..b066f1d --- /dev/null +++ b/abs/core/poweroff-scripts/poweroff-scripts.install @@ -0,0 +1,28 @@ +# arg 1: the new package version + +pre_install () { + echo "" +} + + +pre_upgrade () { + echo "" +} + +post_install () { + + [ -e /sbin/halt.init ] || ln -sf /sbin/halt.init /sbin/reboot.init + [ -e /sbin/halt.init ] || ln -sf /sbin/halt.init /sbin/poweroff.init +} + +# arg 1: the new package version +# arg 2: the old package version + +post_upgrade(){ + post_install +} + +op=$1 +shift + +$op $* diff --git a/abs/core/poweroff-scripts/poweroff.script b/abs/core/poweroff-scripts/poweroff.script new file mode 100644 index 0000000..99779eb --- /dev/null +++ b/abs/core/poweroff-scripts/poweroff.script @@ -0,0 +1,11 @@ +#!/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/poweroff-scripts/reboot.script b/abs/core/poweroff-scripts/reboot.script new file mode 100644 index 0000000..fcce679 --- /dev/null +++ b/abs/core/poweroff-scripts/reboot.script @@ -0,0 +1,11 @@ +#!/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/poweroff-scripts/shutdown.script b/abs/core/poweroff-scripts/shutdown.script new file mode 100644 index 0000000..09245ef --- /dev/null +++ b/abs/core/poweroff-scripts/shutdown.script @@ -0,0 +1,45 @@ +#!/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 |