nll-live-system/build-live-cd.sh

31 lines
760 B
Bash
Raw Permalink Normal View History

2021-03-07 20:07:15 +00:00
BASEDIR=/var/lib/machines
ID=$(uuidgen | tr -d -)
NAME=debian-live-cd-$ID
DIR=$BASEDIR/$NAME
echo "Generating container under $DIR"
2021-10-14 12:41:15 +00:00
zfs snapshot ztstor/ROOT/archie/var/lib/machines/bullseye-template@${ID}
2021-03-07 20:07:15 +00:00
zfs clone \
-o mountpoint=$DIR \
2021-10-14 12:41:15 +00:00
ztstor/ROOT/archie/var/lib/machines/bullseye-template@${ID} \
2021-03-07 20:07:15 +00:00
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