Skip to content

Instantly share code, notes, and snippets.

@chiradeep
Last active October 23, 2019 19:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiradeep/11388262 to your computer and use it in GitHub Desktop.
Save chiradeep/11388262 to your computer and use it in GitHub Desktop.
LXC script to initiate build of CloudStack LXC systemvm
#!/bin/bash
# tested on Ubuntu 14.04
#set -x
sudo lxc-create --template=debian --name=systemvm -- --release=wheezy
sudo lxc-start -n systemvm -d
sleep 2
ip=$(sudo lxc-info -n systemvm -i | awk '{print $2}')
#start provisioning using ssh
ruby provision.rb $ip -u root -p root
# tar up the rootfs to create an lxc template
sudo lxc-stop -n systemvm
mkdir -p /tmp/lxc-systemvm
# Compress container's rootfs
sudo tar --numeric-owner -czf /tmp/lxc-systemvm/systemvm-rootfs.tar.gz /var/lib/lxc/systemvm/rootfs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment