aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2019-09-21 08:26:31 -0300
committerMarcos Paulo de Souza <marcos.souza.org@gmail.com>2019-09-21 08:47:34 -0300
commit7692a4e60c37815333de091c832143ef14023ead (patch)
tree985cb41a94fb7db22460936bfac21d6bea87c0e7
parentb6a84b3a4986185480b8cee3982b12d34c261c53 (diff)
downloadvirtme-7692a4e60c37815333de091c832143ef14023ead.tar.gz
commands/initramfs.py: Add outfile argument
This new argument waits for a string where the new initrd file will be placed. If not informed, the file is printed in the stdout, which is the current behavior. Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
-rwxr-xr-xvirtme/commands/mkinitramfs.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/virtme/commands/mkinitramfs.py b/virtme/commands/mkinitramfs.py
index d2874ab..563c98b 100755
--- a/virtme/commands/mkinitramfs.py
+++ b/virtme/commands/mkinitramfs.py
@@ -21,6 +21,9 @@ def make_parser():
parser.add_argument('--rw', action='store_true', default=False,
help='Mount initramfs as rw. Default is ro')
+ parser.add_argument('--outfile', action='store', default=None,
+ help='Filename of the resulting initramfs file. Default: send initramfs to stdout')
+
return parser
def main():
@@ -40,7 +43,12 @@ def main():
if args.rw:
config.access = 'rw'
- mkinitramfs.mkinitramfs(sys.stdout.buffer, config)
+ if args.outfile is None:
+ buf = sys.stdout.buffer
+ else:
+ buf = open(args.outfile, 'w+b')
+
+ mkinitramfs.mkinitramfs(buf, config)
return 0