提交 73046608 编写于 作者: D Daniel P. Berrange

virt-login-shell: allow shell to be a simple string argument

Currently the shell config file parameter must be a list
giving the shell path and args. Allow it to be a plain
string argument as well.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 8a95d3df
...@@ -121,6 +121,8 @@ static int virLoginShellGetShellArgv(virConfPtr conf, ...@@ -121,6 +121,8 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
goto error; goto error;
} }
} }
} else if (p->type == VIR_CONF_STRING) {
len = 1; /* /path/to/shell */
} else { } else {
virReportSystemError(EINVAL, "%s", virReportSystemError(EINVAL, "%s",
_("shell must be a list of strings")); _("shell must be a list of strings"));
...@@ -141,6 +143,9 @@ static int virLoginShellGetShellArgv(virConfPtr conf, ...@@ -141,6 +143,9 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
if (VIR_STRDUP(shargv[i++], pp->str) < 0) if (VIR_STRDUP(shargv[i++], pp->str) < 0)
goto error; goto error;
} }
} else if (p->type == VIR_CONF_STRING) {
if (VIR_STRDUP(shargv[i++], p->str) < 0)
goto error;
} }
shargv[i] = NULL; shargv[i] = NULL;
......
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
# By default, virt-login-shell will connect you to a container running # By default, virt-login-shell will connect you to a container running
# with the /bin/sh program. Modify the shell variable if you want your # with the /bin/sh program. Modify the shell variable if you want your
# users to run a different shell or a setup container when joining a # users to run a different shell or a setup container when joining a
# container. Shell commands must be a list of commands/options separated by # container.
# comma and delimited by square brackets. Defaults to: /bin/sh -l.
# Modify and uncomment the following to modify the login shell.
# #
# shell = [ "/bin/bash" ] # This can either be just the path to a shell binary:
#
# shell = "/bin/bash"
#
# Or can be the path and extra arguments
#
# shell = [ "/bin/bash", "--posix" ]
# #
# Note there is no need to pass a '--login' / '-l' argument since # Note there is no need to pass a '--login' / '-l' argument since
# virt-login-shell will always request a login shell # virt-login-shell will always request a login shell
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册