diff options
author | Juan RP <xtraeme@gmail.com> | 2014-08-05 15:34:52 +0200 |
---|---|---|
committer | Juan RP <xtraeme@gmail.com> | 2014-08-05 15:34:52 +0200 |
commit | 3498ef6500f6c645bbb173e2f09ce5b705ea6d5f (patch) | |
tree | 1f0f4a5c11bf174c231796023a6e595805db3d8a | |
parent | 3bc47c18a0c6469165cd623ce96f7fb5713db883 (diff) | |
download | runit-void-3498ef6500f6c645bbb173e2f09ce5b705ea6d5f.tar.gz runit-void-3498ef6500f6c645bbb173e2f09ce5b705ea6d5f.tar.xz runit-void-3498ef6500f6c645bbb173e2f09ce5b705ea6d5f.zip |
shutdown.sh: make it work with dash; and check if we have enough perms.
-rwxr-xr-x[-rw-r--r--] | shutdown.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/shutdown.sh b/shutdown.sh index 1c29be3..20fd707 100644..100755 --- a/shutdown.sh +++ b/shutdown.sh @@ -22,7 +22,7 @@ while getopts akrhPHfFnct: opt; do done shift $(expr $OPTIND - 1) -time=$1; shift +[ -n "$1" ] && time=$1 && shift message="${*:-system is going down}" if [ "$action" = "cancel" ]; then @@ -31,6 +31,10 @@ if [ "$action" = "cancel" ]; then exit fi +if [ ! -w /run/runit/shutdown.pid ]; then + echo "Not enough permissions to execute ${0#*/}" + exit 1 +fi echo $$ >/run/runit/shutdown.pid case "$time" in |