Fork me on GitHub
  ▖     
▃▀▄▄▖▄▄▖
 ▀▖     
        


#!/usr/bin/env python3
#
# usage: plash export-tar CONTAINER [ FILE | - ]
#
# Export container as tar archive. It exports the file system of a container
# to the given file as a compressed tar archive.  If no file is supplied or the
# file is '-' the tar archive wil be printed to stdout instead.
#
# Parameters may be interpreted as build instruction.

import sys
from os import execlp

from plash.utils import die_with_usage, handle_build_args, handle_help_flag

handle_help_flag()
handle_build_args()

try:
    container = sys.argv[1]
except IndexError:
    die_with_usage()

execlp('plash-with-mount', 'plash-with-mount', container, 'tar', '-cf',
       sys.argv[2] if len(sys.argv) > 2 else '-', '.')