]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
server: Allow reset_cmd to contain a shell function name
authorMichal Sojka <michal.sojka@cvut.cz>
Fri, 22 Oct 2021 10:57:55 +0000 (12:57 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Fri, 22 Oct 2021 10:58:50 +0000 (12:58 +0200)
server/novaboot-shell
tests/server.wv

index bd16c4401a4a4d8625d74f549d8395c75c8fabc2..72d6d1ddd7273bdbe39dd8968febef2f5db14c56 100755 (executable)
@@ -122,7 +122,7 @@ run_subcommand() {
        "console")
            run_console "${console_cmd:?}";;
        "reset")
-           eval exec "${reset_cmd:?}";;
+           eval "${reset_cmd:?}";;
        "rsync --server "*" . .")
            if ! [ $# -eq 5 -o \( $# -eq 6 -a "$4" = '--log-format=X' \) ]; then
                die "Unexpected rsync invocation: $*"
index eddc28d1012f3ba16db1ac5bdfe4513c1f034d5e..2fcbed01e2941f07e398967c8ab67e9a9e07f347 100755 (executable)
@@ -137,6 +137,14 @@ console_cmd=console_cmd'
     WVPASS run_server console | tee /dev/stderr | WVPASS grep -F "Hello user"
 )
 
+WVSTART "reset_cmd may contain a shell function name"
+(
+    export NOVABOOT_SHELL_CONFIG="./.novaboot-shell"
+    WVPASS tee "$NOVABOOT_SHELL_CONFIG" <<<'reset_cmd () { echo Hello user; }
+reset_cmd=reset_cmd'
+    WVPASS run_server reset | tee /dev/stderr | WVPASS grep -F "Hello user"
+)
+
 if [ -n "$DEB_HOST_ARCH" ]; then
     echo >&2 "Skipping server tests in Debian package build, because these cannot pass."
     exit 0