diff --git a/carafe b/carafe index 64b4567..6413f3e 100755 --- a/carafe +++ b/carafe @@ -18,27 +18,13 @@ if [ "$1" == "new" ]; then if [ ! -d "images/$BASE" ]; then mkdir "images/$BASE" fi - - if [ ! -d "$BASEPATH" ]; then - - debootstrap $FLAVOR "$BASEPATH" - - fi - - if [ ! -d "$BASEPATH" ]; then - echo "base path not found: $BASEPATH" - exit 2 - fi - - echo "deb http://archive.ubuntu.com/ubuntu noble main universe -deb http://archive.ubuntu.com/ubuntu noble-updates main universe -deb http://archive.ubuntu.com/ubuntu noble-backports main universe -deb http://archive.ubuntu.com/ubuntu noble-security main universe" > $BASEPATH/etc/apt/sources.list - + + container-provisioner/provision.sh $FLAVOR $BASEPATH + if [ ! -d "$BASEPATH/usr/lib/mocha/carafe" ]; then mkdir -p "$BASEPATH/usr/lib/mocha/carafe" fi - + if [ ! -d "$BASEPATH/usr/share/mocha/system" ]; then mkdir -p "$BASEPATH/usr/share/mocha/system" fi @@ -87,6 +73,8 @@ deb http://archive.ubuntu.com/ubuntu noble-security main universe" > $BASEPATH/e fi cp libexec/mocha/mocha-* $BASEPATH/usr/lib/mocha cp libexec/mocha/mocha $BASEPATH/usr/bin + cp libexec/mocha/spot_register_for_shutdown $BASEPATH/usr/lib/mocha + chmod a+x $BASEPATH/usr/lib/mocha/* chmod a+x $BASEPATH/usr/bin/mocha @@ -96,37 +84,8 @@ deb http://archive.ubuntu.com/ubuntu noble-security main universe" > $BASEPATH/e # ! FIXME: we don't want to run this in chroot, we need to run it in lxc! chroot $BASEPATH /usr/lib/mocha/carafe/postinstall.sh - - echo "architecture: \"x86_64\" -creation_date: $(date +%s) # To get current date in Unix time, use \`date +%s\` command -properties: -architecture: \"x86_64\" -description: \"Ubuntu Noble with Apache2 and PHP (20171227)\" -os: \"ubuntu\" -release: \"noble\"" > images/$BASE/metadata.yaml - - tar -cvzf images/$BASE/metadata.tar.gz -C images/$BASE metadata.yaml - rm images/$BASE/metadata.yaml - - if [ ! -f images/$BASE/$BASE.tar.gz ]; then - - tar -cvzf images/$BASE/$BASE.tar.gz -C $BASEPATH . - # rm -rf $BASEPATH - else - - echo "$BASE.tar.gz already exists; not overwriting" - fi - - EXISTS=$(lxc image list | grep $BASE ) - if [ "$EXISTS" == "" ]; then - - lxc image import images/$BASE/metadata.tar.gz images/$BASE/$BASE.tar.gz --alias $BASE - - else - - echo "not importing image; already exists as $BASE" - - fi + + container-provisioner/build.sh "ubuntu" "noble" "x86_64" "Ubuntu Noble with Apache2 and PHP" $BASE $BASEPATH SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom) CONTAINER_NAME=i-0$SUV_ID