]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - server/novaboot-shell
server: Unify installation target to PREFIX
[novaboot.git] / server / novaboot-shell
index 72d6d1ddd7273bdbe39dd8968febef2f5db14c56..5e8621adf3b37689b4cdd375c188fa304f7e9134 100755 (executable)
@@ -98,7 +98,10 @@ power() {
     esac
 
     if [ "$PPID" -ne 1 ] && systemctl --user is-enabled --quiet novaboot-delayed-power-off.service; then
-       sudo novaboot-power "$1"
+        case "$1" in
+            "on") systemctl --user start novaboot-delayed-power-off.service;;
+            "off") sudo novaboot-power off;;
+        esac
     else
        eval "$cmd"
     fi
@@ -113,6 +116,20 @@ run_console() {
     eval "$1"
 }
 
+# Run novaboot with the same configuration as specified in
+# ~/.novaboot-shell, but allow the caller to extend of override them
+# via parameters of this function.
+run_novaboot() {
+    nbscript=$1
+    shift
+    OLD_IFS=$IFS
+    # Split $target_config below by newlines, not by words
+    IFS="
+"
+    novaboot "$nbscript" $target_config --server="$HOME/tftproot" --reset-cmd="${reset_cmd:?}" --remote-cmd="${console_cmd:?}" "$@"
+    IFS=$OLD_IFS
+}
+
 # run_subcommand should be called only after permission checks and/or locking
 run_subcommand() {
     read_config