From: Michal Sojka Date: Fri, 22 Oct 2021 10:57:55 +0000 (+0200) Subject: server: Allow reset_cmd to contain a shell function name X-Git-Tag: 20211022~5 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/novaboot.git/commitdiff_plain/939b83b12b95e44031e85883354cae18498c8506 server: Allow reset_cmd to contain a shell function name --- diff --git a/server/novaboot-shell b/server/novaboot-shell index bd16c44..72d6d1d 100755 --- a/server/novaboot-shell +++ b/server/novaboot-shell @@ -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: $*" diff --git a/tests/server.wv b/tests/server.wv index eddc28d..2fcbed0 100755 --- a/tests/server.wv +++ b/tests/server.wv @@ -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