diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-09-23 19:51:44 -0700 |
---|---|---|
committer | Andy Lutomirski <luto@amacapital.net> | 2014-09-23 19:51:44 -0700 |
commit | b3303011d2de91e862042d3630fa9de152752107 (patch) | |
tree | 952478d47f14b03b6c35f173f0c16c63b1fad848 | |
parent | ecc9c2d41bb4a5b419831ab0f32f3b9513b4ccc8 (diff) | |
download | virtme-b3303011d2de91e862042d3630fa9de152752107.tar.gz |
virtme-run: Add --pwd option
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
-rw-r--r-- | virtme/commands/run.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/virtme/commands/run.py b/virtme/commands/run.py index f9ae45c..b0c5cd8 100644 --- a/virtme/commands/run.py +++ b/virtme/commands/run.py @@ -88,6 +88,10 @@ def make_parser(): g.add_argument('--show-command', action='store_true', help='Show the VM command line') + g = parser.add_argument_group(title='Guest userspace configuration') + g.add_argument('--pwd', action='store_true', + help='Propagate current working directory to the guest') + return parser _ARGPARSER = make_parser() @@ -309,6 +313,13 @@ def main(): qemuargs.extend(['-net', 'user']) kernelargs.extend(['virtme.dhcp']) + if args.pwd: + rel_pwd = os.path.relpath(os.getcwd(), args.root) + if rel_pwd.startswith('..'): + print('current working directory is not contained in the root') + return 1 + kernelargs.append('virtme_chdir=%s' % rel_pwd) + if need_initramfs: if args.busybox is not None: config.busybox = args.busybox |