#!/bin/bash set -e usage="lxc-unpack TGZ" if [ -z "$1" ]; then echo $usage exit 5 fi tgz=$1 if [ "${tgz:0:1}" != "/" ]; then tgz="$(pwd)/$1" fi container=${tgz%.tgz} cd /var/lib/lxc if [ -e $container ]; then echo "container $container already existing" exit 10 fi tar --numeric-owner -xf $tgz