30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
# install ubuntu dependenices for image building
|
|
apt update
|
|
apt install -y libvirt-daemon qemu-utils qemu wget genisoimage
|
|
|
|
stat alpine-make-vm-image || wget https://raw.githubusercontent.com/alpinelinux/alpine-make-vm-image/master/alpine-make-vm-image -O alpine-make-vm-image
|
|
chmod +x alpine-make-vm-image
|
|
echo '0d5d3e375cb676d6eb5c1a52109a3a0a8e4cd7ac alpine-make-vm-image' | sha1sum -c
|
|
if [ "$?" -gt "0" ];then
|
|
echo "alpine-make-vm-image checksum is bad, check for an update at:"
|
|
echo "https://github.com/alpinelinux/alpine-make-vm-image"
|
|
exit 1
|
|
fi
|
|
|
|
PACKAGES_FILE="os/packages"
|
|
INIT_SCRIPT="os/configure.sh"
|
|
IMAGES_FILENAME="alpine-cloud-init-frr_vm.qcow2"
|
|
ALPINE_BRANCH="3.17"
|
|
DISK_SIZE="20G"
|
|
IMAGE_FORMAT="qcow2"
|
|
|
|
bash alpine-make-vm-image -b ${ALPINE_BRANCH} -p "$( cat ${PACKAGES_FILE} | xargs) " -s ${DISK_SIZE} -f ${IMAGE_FORMAT} ${IMAGES_FILENAME} --script-chroot ${INIT_SCRIPT}
|
|
|
|
cd seed
|
|
mkisofs -output ../alpine-cloud-init-data.iso -volid cidata -joliet -rock user-data meta-data
|
|
cd -
|