diff options
author | Zev Weiss <zev@bewilderbeest.net> | 2016-10-01 16:31:49 -0500 |
---|---|---|
committer | Zev Weiss <zev@bewilderbeest.net> | 2016-10-27 23:19:00 -0500 |
commit | fb07b7577a0b815be62364bc45a209c6c2aea7af (patch) | |
tree | b7766386548b706b8d0873571ec9cd09780e0f3c | |
parent | b97aef802a97957abaead178c41d3901ad85f800 (diff) | |
download | virtme-fb07b7577a0b815be62364bc45a209c6c2aea7af.tar.gz |
virtme-run: Don't use exec for --script-sh
This allows passing multiple semicolon-delimited shell commands.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
-rw-r--r-- | virtme/commands/run.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/virtme/commands/run.py b/virtme/commands/run.py index 2535d13..7987d59 100644 --- a/virtme/commands/run.py +++ b/virtme/commands/run.py @@ -291,7 +291,7 @@ def main(): has_script = False - def do_script(shellcmd): + def do_script(shellcmd, use_exec=False): if args.graphics: arg_fail('scripts and --graphics are mutually exclusive') @@ -324,8 +324,8 @@ def main(): # Ask virtme-init to run the script config.virtme_data[b'script'] = """#!/bin/sh - exec {shellcmd} - """.format(shellcmd=shellcmd).encode('ascii') + {prefix}{shellcmd} + """.format(shellcmd=shellcmd, prefix="exec " if use_exec else "").encode('ascii') # Nasty issue: QEMU will set O_NONBLOCK on fds 0, 1, and 2. # This isn't inherently bad, but it can cause a problem if @@ -348,7 +348,7 @@ def main(): do_script(args.script_sh) if args.script_exec is not None: - do_script(shlex.quote(args.script_exec)) + do_script(shlex.quote(args.script_exec), use_exec=True) if args.net: qemuargs.extend(['-net', 'nic,model=virtio']) |