Add script to build live-cd locally
This commit is contained in:
parent
869d578533
commit
0e5516ff54
1 changed files with 30 additions and 0 deletions
30
build-live-cd.sh
Executable file
30
build-live-cd.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue