about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--functions4
-rw-r--r--halt.84
-rw-r--r--modules-load.84
-rw-r--r--pause.14
-rw-r--r--services/agetty-tty1/conf2
-rwxr-xr-xshutdown35
-rw-r--r--shutdown.84
7 files changed, 29 insertions, 28 deletions
diff --git a/functions b/functions
index d1cd318..7f2e38c 100644
--- a/functions
+++ b/functions
@@ -49,7 +49,9 @@ deactivate_vgs() {
 deactivate_crypt() {
    if [ -x /sbin/dmsetup -o -x /bin/dmsetup ]; then
        msg "Deactivating Crypt Volumes"
-       dmsetup ls --target crypt --exec 'cryptsetup close'
+       for v in $(dmsetup ls --target crypt --exec "dmsetup info -c --noheadings -o open,name"); do
+           [ ${v%%:*} -eq 0 ] && cryptsetup close ${v##*:}
+       done
        deactivate_vgs "Crypt"
    fi
 }
diff --git a/halt.8 b/halt.8
index f6fad42..8930ad3 100644
--- a/halt.8
+++ b/halt.8
@@ -63,5 +63,5 @@ to shut down network interfaces.
 .Xr init 8 ,
 .Xr shutdown 8
 .Sh AUTHOR
-.An Christian Neukirchen ,
-.Mt chneukirchen@gmail.com .
+.An Leah Neukirchen ,
+.Mt leah@vuxu.org .
diff --git a/modules-load.8 b/modules-load.8
index 31441ec..40e2c9c 100644
--- a/modules-load.8
+++ b/modules-load.8
@@ -45,8 +45,8 @@ This program is a replacement for the
 utility provided by
 .Nm systemd .
 .Sh AUTHOR
-.An Christian Neukirchen ,
-.Mt chneukirchen@gmail.com .
+.An Leah Neukirchen ,
+.Mt leah@vuxu.org .
 .Sh LICENSE
 .Nm
 is in the public domain.
diff --git a/pause.1 b/pause.1
index e4f9997..1e56f20 100644
--- a/pause.1
+++ b/pause.1
@@ -35,5 +35,5 @@ ip link set eth0 down
 .Xr sleep 1 ,
 .Xr pause 2
 .Sh AUTHOR
-.An Christian Neukirchen ,
-.Mt chneukirchen@gmail.com .
+.An Leah Neukirchen ,
+.Mt leah@vuxu.org .
diff --git a/services/agetty-tty1/conf b/services/agetty-tty1/conf
index fee6d06..b9b33c2 100644
--- a/services/agetty-tty1/conf
+++ b/services/agetty-tty1/conf
@@ -1,4 +1,4 @@
-if [ -x /sbin/agetty -o /bin/agetty ]; then
+if [ -x /sbin/agetty -o -x /bin/agetty ]; then
 	# util-linux specific settings
 	if [ "${tty}" = "tty1" ]; then
 		GETTY_ARGS="--noclear"
diff --git a/shutdown b/shutdown
index b456647..9b6bba4 100755
--- a/shutdown
+++ b/shutdown
@@ -6,7 +6,7 @@ single() {
 }
 
 abort() {
-  echo "$@" >&2
+  printf '%s\n' "$1" >&2
   exit 1
 }
 
@@ -37,7 +37,10 @@ time=$1; shift
 message="${*:-system is going down}"
 
 if [ "$action" = "cancel" ]; then
-  kill $(cat /run/runit/shutdown.pid)
+  kill "$(cat /run/runit/shutdown.pid)"
+  if [ -e /etc/nologin ] && ! [ -s /etc/nologin ]; then
+    rm /etc/nologin
+  fi
   echo "${*:-shutdown cancelled}" | wall
   exit
 fi
@@ -52,23 +55,19 @@ case "$time" in
   *) abort "invalid time";;
 esac
 
-if [ "$time" -gt 5 ]; then
-  echo "$message in $time minutes" | wall
-  printf "shutdown: sleeping for $time minutes... "
-  sleep $(((time - 5) * 60))
-  printf "\n"
-  time=5
-fi
+for break in 5 0; do
+  [ "$time" -gt "$break" ] || continue
+  [ "$break" = 0 ] && touch /etc/nologin
 
-if [ "$time" -gt 0 ]; then
-  echo "$message in $time minutes" | wall
-  touch /etc/nologin
-  printf "shutdown: sleeping for $time minutes... "
-  sleep $((time * 60))
-  printf "\n"
-  rm /etc/nologin
-fi
+  printf '%s in %s minutes\n' "$message" "$time" | wall
+  printf 'shutdown: sleeping for %s minutes... ' "$(( time - break ))"
+  sleep $(( (time - break) * 60 ))
+  time="$break"
+  printf '\n'
+
+  [ "$break" = 0 ] && rm /etc/nologin
+done
 
-echo "$message NOW" | wall
+printf '%s NOW\n' "$message" | wall
 
 $action
diff --git a/shutdown.8 b/shutdown.8
index 021cd62..4547e5b 100644
--- a/shutdown.8
+++ b/shutdown.8
@@ -86,5 +86,5 @@ Turn off the system:
 .Xr runit 8 ,
 .Xr runsvchdir 8
 .Sh AUTHOR
-.An Christian Neukirchen ,
-.Mt chneukirchen@gmail.com .
+.An Leah Neukirchen ,
+.Mt leah@vuxu.org .