manila-image-elements/tools/add_to_rootfs_tar
Igor Malinovskiy 796f168c5c Add tox job for building LXD image
Add additional tox job 'buildimage-lxd' which produces
lxd metadata package and rootfs with installs
nfs-ganesha, unfs3 and cifs.

Co-Authored-By: Alexey Ovchinnikov <aovchinnikov@mirantis.com>

Change-Id: Ia5a4701a828aeef93840f9c0a0e1d0bc0f4a5a2e
2016-03-09 11:37:27 +04:00

21 lines
523 B
Python
Executable File

#!/usr/bin/env python
from __future__ import print_function
import tarfile
import sys
def main(tar_path, folder_path, target_name):
try:
tar = tarfile.open(tar_path, mode="a")
tar.add(folder_path, arcname=target_name)
tar.close()
except Exception as e:
print("Error: ", e)
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: "
"add_to_rootfs_tar <path_to_tar> <path_to_folder> <target_name>")
main(sys.argv[1], sys.argv[2], sys.argv[3])