base-image-build/scripts/setupBuilder/setupBuilder.sh

30 lines
953 B
Bash
Raw Normal View History

2024-08-11 09:09:04 +00:00
#!/bin/bash
set -e
source $utilsLocation/initSSHclient.sh
customDiskPath=$1
$scriptLocation/downloadGenericCloudDisk.sh
imagePath=$BASE_DISK_FILEPATH
echo "--- COPYING BASE IMAGE ---"
cp $imagePath $OUTPUT_FILE_PATH
imagePath=$OUTPUT_FILE_PATH
echo "--- Using image: $imagePath ---"
echo "--- Virtal disk resizing ---"
tempDiskName="${imagePath}a"
qemu-img create -f qcow2 $tempDiskName 50G
virt-resize --expand /dev/vda4 $imagePath $tempDiskName
rm $imagePath
mv $tempDiskName $imagePath
echo "--- Finished virtual disk resizing ---"
echo "--- Setting up Rocky Cloud image for ssh access and docker/buildah/podman ---"
echo "--- Creating rocky user; addng it to the wheel gorup; installing docker/buildah/podman; adding SSH access key to the rocky user ---"
virt-customize -a $imagePath --commands-from-file $scriptLocation/customizeBuilder.sh
echo "--- Finished setting up Rocky Rocky Cloud image for ssh access and docker/buildah/podman ---"