From 0e5516ff54ea0a707cf9393c2bcb55ae785a8ca2 Mon Sep 17 00:00:00 2001 From: lagertonne Date: Sun, 7 Mar 2021 21:07:15 +0100 Subject: [PATCH] Add script to build live-cd locally --- build-live-cd.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 build-live-cd.sh diff --git a/build-live-cd.sh b/build-live-cd.sh new file mode 100755 index 0000000..71aacf2 --- /dev/null +++ b/build-live-cd.sh @@ -0,0 +1,30 @@ +BASEDIR=/var/lib/machines +ID=$(uuidgen | tr -d -) +NAME=debian-live-cd-$ID +DIR=$BASEDIR/$NAME + +echo "Generating container under $DIR" +zfs snapshot ztstor/ROOT/archie/var/lib/machines/buster-template@${ID} +zfs clone \ + -o mountpoint=$DIR \ + ztstor/ROOT/archie/var/lib/machines/buster-template@${ID} \ + ztstor/ROOT/archie/var/lib/machines/$NAME + +mkdir $DIR/var/live-build/ +rsync -av . $DIR/var/live-build/ + +# Execute stuff inside container +systemd-nspawn -q --pipe -D $DIR /bin/bash << EOF +apt update +apt install -y live-build binutils +cd /var/live-build/ +lb clean --purge +lb config +lb build +EOF + +echo "" +echo "---" +echo "Image lying under /var/lib/machines/$NAME" +#echo "Removing container..." +#zfs destroy ztstor/ROOT/archie/var/lib/machines/$NAME