build-cloud-init-alpine/build.sh

30 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2023-07-02 10:36:09 +03:00
#!/usr/bin/env bash
2023-07-02 10:55:09 +03:00
export DEBIAN_FRONTEND=noninteractive
2023-07-02 10:36:09 +03:00
# install ubuntu dependenices for image building
apt update
2023-07-02 10:55:09 +03:00
apt install -y libvirt-daemon qemu-utils qemu wget genisoimage
2023-07-02 10:36:09 +03:00
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_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}
2023-07-02 10:55:09 +03:00
cd seed
mkisofs -output ../alpine-cloud-init-data.iso -volid cidata -joliet -rock user-data meta-data
cd -