diff options
Diffstat (limited to 'abs/core/poweroff-scripts')
-rw-r--r-- | abs/core/poweroff-scripts/PKGBUILD | 28 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/poweroff-scripts/halt.script | 12 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/poweroff-scripts.install | 12 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/poweroff.script | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/poweroff-scripts/reboot.script | 13 | ||||
-rw-r--r-- | abs/core/poweroff-scripts/shutdown.script | 78 |
6 files changed, 88 insertions, 69 deletions
diff --git a/abs/core/poweroff-scripts/PKGBUILD b/abs/core/poweroff-scripts/PKGBUILD index 9bcfee1..3fd7fcc 100644 --- a/abs/core/poweroff-scripts/PKGBUILD +++ b/abs/core/poweroff-scripts/PKGBUILD @@ -1,9 +1,9 @@ pkgname=poweroff-scripts pkgver=1.1 -pkgrel=3 -pkgdesc="replacement scripts to work with sysvinit and runit" +pkgrel=7 +pkgdesc="Replacement power scripts to work with systemd and runit" license=('GPL') -depends=('sysvinit>=2.88' 'runit>=2.1.1-6') +depends=('systemd-sysvcompat' 'runit>=2.1.1-6') makedepends=() conflicts=() replaces=() @@ -12,16 +12,14 @@ install=poweroff-scripts.install source=(halt.script reboot.script poweroff.script shutdown.script) arch=('i686' 'x86_64') -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 - +package() { + install -d $pkgdir/usr/bin/ + install -m0755 $srcdir/reboot.script $pkgdir/usr/bin/reboot + install -m0755 $srcdir/halt.script $pkgdir/usr/bin/halt + install -m0755 $srcdir/poweroff.script $pkgdir/usr/bin/poweroff + install -m0755 $srcdir/shutdown.script $pkgdir/usr/bin/shutdown } - -md5sums=('68ac5d7d5784e9559c9752d94a4943d5' - '3e042113f8715bc5bfd365d2486d0108' - '3ec5f3013dcbd60b6b957d17ba220585' - '16bb393e9ae7b5fa744ca91970f350cc') +md5sums=('b0af95f1fc03d51a8e40d86ca59749e9' + '23d8541b77ab539a2b66cab58f78dcff' + 'cd23d47abf536f3874bc24f044dea682' + '8898528f9da8458115480bfee0100300') diff --git a/abs/core/poweroff-scripts/halt.script b/abs/core/poweroff-scripts/halt.script index dacf16a..223d3e8 100644..100755 --- a/abs/core/poweroff-scripts/halt.script +++ b/abs/core/poweroff-scripts/halt.script @@ -2,16 +2,16 @@ MYTH_RUN_STATUS="1" . /etc/profile INIT=`ps -p 1 -o comm=` + +#ignore -w option if [ x$1 = x-w ] then - /sbin/halt.init -w - exit 0 + exit 0 fi -chvt 1 + if [ x$INIT = xrunit ] then - /sbin/halt-runit $@ + shutdown -h else - /sbin/halt.init $@ + systemctl poweroff $@ fi - diff --git a/abs/core/poweroff-scripts/poweroff-scripts.install b/abs/core/poweroff-scripts/poweroff-scripts.install index b066f1d..1213e9d 100644 --- a/abs/core/poweroff-scripts/poweroff-scripts.install +++ b/abs/core/poweroff-scripts/poweroff-scripts.install @@ -10,9 +10,15 @@ pre_upgrade () { } 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 + FILES="/sbin/reboot.init + /sbin/poweroff.init + /usr/sbin/reboot.init + /usr/sbin/poweroff.init" + for i in $FILES + do + [ -h $i ] && rm -f $i + done + true } # arg 1: the new package version diff --git a/abs/core/poweroff-scripts/poweroff.script b/abs/core/poweroff-scripts/poweroff.script index 99779eb..dc42a14 100644 --- a/abs/core/poweroff-scripts/poweroff.script +++ b/abs/core/poweroff-scripts/poweroff.script @@ -1,11 +1,17 @@ #!/bin/bash +MYTH_RUN_STATUS="1" . /etc/profile INIT=`ps -p 1 -o comm=` -chvt 1 + +#ignore -d option +if [ x$1 = x-d ] +then + exit 0 +fi + if [ x$INIT = xrunit ] then - /sbin/halt-runit $@ + shutdown -h else - /sbin/poweroff.init $@ + systemctl poweroff $@ fi - diff --git a/abs/core/poweroff-scripts/reboot.script b/abs/core/poweroff-scripts/reboot.script index 47ad99e..f1d4c3f 100644..100755 --- a/abs/core/poweroff-scripts/reboot.script +++ b/abs/core/poweroff-scripts/reboot.script @@ -2,11 +2,16 @@ MYTH_RUN_STATUS="1" . /etc/profile INIT=`ps -p 1 -o comm=` -chvt 1 + +#ignore -d option +if [ x$1 = x-d ] +then + exit 0 +fi + if [ x$INIT = xrunit ] then - /sbin/reboot-runit $@ + shutdown -r else - /sbin/reboot.init $@ + systemctl reboot $@ fi - diff --git a/abs/core/poweroff-scripts/shutdown.script b/abs/core/poweroff-scripts/shutdown.script index 31881e8..ffc4056 100644 --- a/abs/core/poweroff-scripts/shutdown.script +++ b/abs/core/poweroff-scripts/shutdown.script @@ -1,46 +1,50 @@ #!/bin/bash MYTH_RUN_STATUS="1" . /etc/profile + +usage() { echo "Usage: $0 [-h | -r] [-t <delay> (opt)]" 1>&2; exit 1; } + 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 + halt="" + reboot="" + delay="" + while getopts hrt: name + do + case $name in + h) halt=1 ;; + r) reboot=1 ;; + t) delay="$OPTARG" + if [ x$delay = "xnow" ] + then + delay=0 + fi + ;; + *) usage ;; + 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 - + if [ x$halt = x1 ] + then + chvt 1 + echo "System will shutdown in $delay seconds..." | wall + sleep $delay + runit-init 0 + exit 0 + fi + if [ x$reboot = x1 ] + then + chvt 1 + echo "System will reboot in $delay seconds..." | wall + sleep $delay + runit-init 6 + exit 0 + fi + usage else - /sbin/shutdown.init $@ + systemctl poweroff $@ fi |