debamp/src/amp-proxmox-utils/usr/bin/lxc-debootstrap-image-create

22 lines
505 B
Plaintext

set -e
SRC_DEBOOTSTRAP=/usr/share/debootstrap/scripts
IMAGE=$1
TARBALL=$1-$(date +%Y%m%d).tar.gz
if [ -f $SRC_DEBOOTSTRAP/$IMAGE ] ;
then
TARGET=$(tempfile)
rm $TARGET
mkdir $TARGET
echo create rootfs in temporary folder $TARGET
debootstrap $IMAGE $TARGET > /dev/null
echo create archive $TARBALL
tar -C $TARGET -zcvf $TARBALL .
echo Remove temporary folder
rm -fr $TARGET
chmod ugo+r $TARBALL
echo lxc image available in $TARBALL
else
echo $(basename $0) \<version\>
ls $SRC_DEBOOTSTRAP
fi