Add FreeBSD build target - only with mgmt, SSH + users for now

This commit is contained in:
Pim van Pelt
2024-02-07 21:44:27 +00:00
parent f1a51505c3
commit e9a1ec6920
73 changed files with 3121 additions and 3 deletions

17
create
View File

@ -31,15 +31,26 @@ HVN="hvn${LAB}.lab.ipng.ch"
VMS=$(ls -1 build/${BUILD}/${HVN}/)
PARTITION="part1"
TARGET=LINUX
echo $BASE | grep -q freebsd && {
echo "FreeBSD build."
MOUNTFLAGS="-w -t ufs -o ufstype=ufs2"
PARTITION="part4"
TARGET=FREEBSD
}
for VM in $VMS; do
echo "[$VM] Cloning base"
ssh root@$HVN "mkdir -p $STAGING/$VM; zfs clone $BASE vol0/$VM"
echo "[$VM] Mounting in staging"
ssh root@$HVN "mount /dev/zvol/vol0/$VM-part1 $STAGING/$VM"
ssh root@$HVN "mount $MOUNTFLAGS /dev/zvol/vol0/$VM-$PARTITION $STAGING/$VM"
echo "[$VM] Rsyncing build"
rsync -aIcg build/$BUILD/$HVN/$VM/ root@${HVN}:$STAGING/$VM/
echo "[$VM] Running lab-build snippets"
ssh root@$HVN "cd $STAGING/$VM; for s in root/lab-build/*; do chroot $STAGING/$VM /bin/bash /\$s; done"
if [ "$TARGET" = "LINUX" ]; then
echo "[$VM] Running lab-build snippets"
ssh root@$HVN "cd $STAGING/$VM; for s in root/lab-build/*; do chroot $STAGING/$VM /bin/sh /\$s; done"
fi
echo "[$VM] Unmounting and snapshotting pristine state"
ssh root@$HVN "umount $STAGING/$VM; zfs snapshot vol0/${VM}@pristine"
echo "[$VM] Copying libvirt config"