summaryrefslogtreecommitdiffstats
path: root/abs/core/poweroff-scripts
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2014-04-05 19:49:18 (GMT)
committerBritney Fransen <brfransen@gmail.com>2014-04-05 19:49:18 (GMT)
commitbdefc1e81c89dbb12e7e914a9f1f220ee5ed1714 (patch)
treef8ed2037e4dab50bf0cdb4cdcb6a8b28d5f00694 /abs/core/poweroff-scripts
parentde6718e325ed5fdcb2b15cb567732321ecb14790 (diff)
downloadlinhes_pkgbuild-bdefc1e81c89dbb12e7e914a9f1f220ee5ed1714.zip
linhes_pkgbuild-bdefc1e81c89dbb12e7e914a9f1f220ee5ed1714.tar.gz
linhes_pkgbuild-bdefc1e81c89dbb12e7e914a9f1f220ee5ed1714.tar.bz2
poweroff-scripts: fix shutdown/reboot issue with /usr/bin move. refs #961
Diffstat (limited to 'abs/core/poweroff-scripts')
-rw-r--r--abs/core/poweroff-scripts/PKGBUILD24
-rwxr-xr-xabs/core/poweroff-scripts/halt.script19
-rw-r--r--abs/core/poweroff-scripts/poweroff-scripts.install10
-rw-r--r--abs/core/poweroff-scripts/poweroff.script13
-rwxr-xr-xabs/core/poweroff-scripts/reboot.script13
-rw-r--r--abs/core/poweroff-scripts/shutdown.script78
6 files changed, 81 insertions, 76 deletions
diff --git a/abs/core/poweroff-scripts/PKGBUILD b/abs/core/poweroff-scripts/PKGBUILD
index e5cab49..dfe5966 100644
--- a/abs/core/poweroff-scripts/PKGBUILD
+++ b/abs/core/poweroff-scripts/PKGBUILD
@@ -1,7 +1,7 @@
pkgname=poweroff-scripts
pkgver=1.1
-pkgrel=5
-pkgdesc="replacement scripts to work with sysvinit and runit"
+pkgrel=6
+pkgdesc="Replacement power scripts to work with systemd and runit"
license=('GPL')
depends=('systemd-sysvcompat' 'runit>=2.1.1-6')
makedepends=()
@@ -13,15 +13,13 @@ source=(halt.script reboot.script poweroff.script shutdown.script)
arch=('i686' 'x86_64')
package() {
- 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
-
+ 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=('a3538350e5c8e65a1418d9f1b5ff83c1'
- 'c9cbd22b341cf9e566eeedba7e51ecd2'
- '58c374b2cacabac6728bb09c24e512a5'
- 'c151f7a35acc0db524c290be7594f09e')
+md5sums=('b0af95f1fc03d51a8e40d86ca59749e9'
+ '23d8541b77ab539a2b66cab58f78dcff'
+ 'cd23d47abf536f3874bc24f044dea682'
+ '8898528f9da8458115480bfee0100300')
diff --git a/abs/core/poweroff-scripts/halt.script b/abs/core/poweroff-scripts/halt.script
index b2e8170..223d3e8 100755
--- a/abs/core/poweroff-scripts/halt.script
+++ b/abs/core/poweroff-scripts/halt.script
@@ -2,19 +2,16 @@
MYTH_RUN_STATUS="1"
. /etc/profile
INIT=`ps -p 1 -o comm=`
-# if [ x$1 = x-w ]
-# then
-# /sbin/halt.init -w
-# exit 0
-# fi
-if [ x$INIT = xrunit ]
+#ignore -w option
+if [ x$1 = x-w ]
then
- echo "System will shutdown NOW" |wall
- chvt 1
- runit-init 0
+ exit 0
+fi
+if [ x$INIT = xrunit ]
+then
+ shutdown -h
else
- systemctrl $@
+ systemctl poweroff $@
fi
-
diff --git a/abs/core/poweroff-scripts/poweroff-scripts.install b/abs/core/poweroff-scripts/poweroff-scripts.install
index 00b4a84..5f631ed 100644
--- a/abs/core/poweroff-scripts/poweroff-scripts.install
+++ b/abs/core/poweroff-scripts/poweroff-scripts.install
@@ -10,11 +10,11 @@ pre_upgrade () {
}
post_install () {
- rm -f /sbin/reboot.init
- rm -f /sbin/poweroff.init
-
- [ -e /usr/sbin/halt.init ] || ln -sf /usr/sbin/halt.init /usr/sbin/reboot.init
- [ -e /usr/sbin/halt.init ] || ln -sf /usr/sbin/halt.init /usr/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
}
# arg 1: the new package version
diff --git a/abs/core/poweroff-scripts/poweroff.script b/abs/core/poweroff-scripts/poweroff.script
index 2236983..dc42a14 100644
--- a/abs/core/poweroff-scripts/poweroff.script
+++ b/abs/core/poweroff-scripts/poweroff.script
@@ -2,13 +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
- echo "System will shutdown NOW" |wall
- chvt 1
- runit-init 0
+ shutdown -h
else
systemctl poweroff $@
fi
-
diff --git a/abs/core/poweroff-scripts/reboot.script b/abs/core/poweroff-scripts/reboot.script
index de2651c..f1d4c3f 100755
--- a/abs/core/poweroff-scripts/reboot.script
+++ b/abs/core/poweroff-scripts/reboot.script
@@ -2,13 +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
- echo "System will reboot NOW" |wall
- chvt 1
- runit-init 6
+ shutdown -r
else
systemctl reboot $@
fi
-
diff --git a/abs/core/poweroff-scripts/shutdown.script b/abs/core/poweroff-scripts/shutdown.script
index b87b52f..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
- echo "System will reboot in $delay seconds" | wall
- sleep $delay
- /sbin/runit-init 6
- fi
-
- if [ x$halt = x1 ]
- then
- echo "System will poweroff in $delay seconds" | wall
- 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