]> xenbits.xensource.com Git - libvirt.git/commitdiff
virt-login-shell: allow shell to be a simple string argument
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 12 Apr 2016 14:31:54 +0000 (15:31 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 10 Jun 2016 10:03:01 +0000 (11:03 +0100)
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: Daniel P. Berrange <berrange@redhat.com>
tools/virt-login-shell.c
tools/virt-login-shell.conf

index 51175f74db1923e9bd71351fd78dc76c75f859de..527395a5d0335a1ff992bd996ad3f091b3fed1b8 100644 (file)
@@ -121,6 +121,8 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
                 goto error;
             }
         }
+    } else if (p->type == VIR_CONF_STRING) {
+        len = 1; /* /path/to/shell */
     } else {
         virReportSystemError(EINVAL, "%s",
                              _("shell must be a list of strings"));
@@ -141,6 +143,9 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
             if (VIR_STRDUP(shargv[i++], pp->str) < 0)
                 goto error;
         }
+    } else if (p->type == VIR_CONF_STRING) {
+        if (VIR_STRDUP(shargv[i++], p->str) < 0)
+            goto error;
     }
 
     shargv[i] = NULL;
index 67ca1cc8d9ef8b4c7c089c7353fb815d959a76e4..e29d22206c37b71e961f5e29268d2aa2b9679638 100644 (file)
@@ -5,11 +5,15 @@
 # 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
 # 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
-# comma and delimited by square brackets. Defaults to: /bin/sh -l.
-# Modify and uncomment the following to modify the login shell.
+# container.
 #
-# 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
 # virt-login-shell will always request a login shell