build: add new features

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-06-11 18:53:47 +02:00
parent 53caba0c78
commit 113cd2c92e
2 changed files with 110 additions and 3 deletions

View File

@ -107,17 +107,28 @@ jobs:
sudo losetup --detach ${LOOPX}
resizeImg "arc.img" "+1024M" "arc-2G.img"
echo "Image Converter"
qemu-img convert -O vmdk arc.img arc-dyn.vmdk
qemu-img convert -O vmdk arc-2G.img arc-2G-dyn.vmdk
qemu-img convert -O vmdk -o adapter_type=lsilogic arc.img -o subformat=monolithicFlat arc.vmdk
qemu-img convert -O vmdk -o adapter_type=lsilogic arc-2G.img -o subformat=monolithicFlat arc-2G.vmdk
echo "Create Arc ova"
convertova "arc.img" "arc.ova"
# Zip image and generate checksum
- name: Pack
run: |
if [ -n "${{ env.VERSION }}" ]; then
zip -9 "arc-${{ env.VERSION }}.img.zip" arc.img
zip -9 "arc-${{ env.VERSION }}-2G.img.zip" arc-2G.img
zip -9 "arc-${{ env.VERSION }}.vmdk-dyn.zip" arc-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}-2G.vmdk-dyn.zip" arc-2G-dyn.vmdk
zip -9 "arc-${{ env.VERSION }}.vmdk-flat.zip" arc.vmdk arc-flat.vmdk
zip -9 "arc-${{ env.VERSION }}-2G.vmdk-flat.zip" arc-2G.vmdk arc-2G-flat.vmdk
zip -9 "arc-${{ env.VERSION }}.ova.zip" arc.ova
else
zip -9 "arc.img.zip" arc.img
fi
@ -142,7 +153,5 @@ jobs:
prerelease: true
allowUpdates: true
artifacts: |
arc-${{ env.VERSION }}.img.zip
arc-${{ env.VERSION }}.vmdk-dyn.zip
arc-${{ env.VERSION }}.vmdk-flat.zip
arc-*.zip
update.zip

View File

@ -299,4 +299,102 @@ function resizeImg() {
sudo e2fsck -fp $(ls ${LOOPX}* | sort -n | tail -1)
sudo resize2fs $(ls ${LOOPX}* | sort -n | tail -1)
sudo losetup -d ${LOOPX}
}
# convertova
# $1 bootloader file
# $2 ova file
function convertova() {
BLIMAGE=${1}
OVAPATH=${2}
BLIMAGE="$(readlink -f "${BLIMAGE}")"
OVAPATH="$(readlink -f "${OVAPATH}")"
VMNAME="$(basename "${OVAPATH}" .ova)"
# Download and install ovftool if it doesn't exist
if [ ! -x ovftool/ovftool ]; then
rm -rf ovftool ovftool.zip
curl -skL https://github.com/rgl/ovftool-binaries/raw/main/archive/VMware-ovftool-4.6.0-21452615-lin.x86_64.zip -o ovftool.zip
if [ $? -ne 0 ]; then
echo "Failed to download ovftool"
exit 1
fi
unzip ovftool.zip -d . >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to extract ovftool"
exit 1
fi
chmod +x ovftool/ovftool
fi
if ! command -v qemu-img &>/dev/null; then
sudo apt install -y qemu-utils
fi
# Convert raw image to VMDK
rm -rf "OVA_${VMNAME}"
mkdir -p "OVA_${VMNAME}"
qemu-img convert -O vmdk -o 'adapter_type=lsilogic,subformat=streamOptimized,compat6' "${BLIMAGE}" "OVA_${VMNAME}/${VMNAME}-disk1.vmdk"
qemu-img create -f vmdk "OVA_${VMNAME}/${VMNAME}-disk2.vmdk" "32G"
# Create VM configuration
cat <<_EOF_ >"OVA_${VMNAME}/${VMNAME}.vmx"
.encoding = "GBK"
config.version = "8"
virtualHW.version = "21"
displayName = "${VMNAME}"
annotation = "https://github.com/AuxXxilium/arc"
guestOS = "ubuntu-64"
firmware = "efi"
mks.enable3d = "TRUE"
pciBridge0.present = "TRUE"
pciBridge4.present = "TRUE"
pciBridge4.virtualDev = "pcieRootPort"
pciBridge4.functions = "8"
pciBridge5.present = "TRUE"
pciBridge5.virtualDev = "pcieRootPort"
pciBridge5.functions = "8"
pciBridge6.present = "TRUE"
pciBridge6.virtualDev = "pcieRootPort"
pciBridge6.functions = "8"
pciBridge7.present = "TRUE"
pciBridge7.virtualDev = "pcieRootPort"
pciBridge7.functions = "8"
vmci0.present = "TRUE"
hpet0.present = "TRUE"
nvram = "${VMNAME}.nvram"
virtualHW.productCompatibility = "hosted"
powerType.powerOff = "soft"
powerType.powerOn = "soft"
powerType.suspend = "soft"
powerType.reset = "soft"
tools.syncTime = "FALSE"
sound.autoDetect = "TRUE"
sound.fileName = "-1"
sound.present = "TRUE"
numvcpus = "2"
cpuid.coresPerSocket = "1"
vcpu.hotadd = "TRUE"
memsize = "4096"
mem.hotadd = "TRUE"
usb.present = "TRUE"
ehci.present = "TRUE"
usb_xhci.present = "TRUE"
svga.graphicsMemoryKB = "8388608"
usb.vbluetooth.startConnected = "TRUE"
extendedConfigFile = "${VMNAME}.vmxf"
floppy0.present = "FALSE"
ethernet0.addressType = "generated"
ethernet0.virtualDev = "vmxnet3"
ethernet0.present = "TRUE"
sata0.present = "TRUE"
sata0:0.fileName = "${VMNAME}-disk1.vmdk"
sata0:0.present = "TRUE"
sata0:1.fileName = "${VMNAME}-disk2.vmdk"
sata0:1.present = "TRUE"
_EOF_
rm -f "${OVAPATH}"
ovftool/ovftool "OVA_${VMNAME}/${VMNAME}.vmx" "${OVAPATH}"
rm -rf "OVA_${VMNAME}"
}