From b3ffd632a53614b65e09df796e2e95ebfcba03fd Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 1 May 2025 10:23:42 -0400 Subject: [PATCH] Add proxmox ve example scripts to debian profile --- .../debian/profiles/default/initprofile.sh | 1 + .../default/scripts/firstboot.d/.gitignore | 0 .../profiles/default/scripts/post.d/.gitignore | 0 .../scripts/proxmox/proxmoxve.firstboot | 4 ++++ .../default/scripts/proxmox/proxmoxve.post | 18 ++++++++++++++++++ confluent_server/confluent/osimage.py | 11 ++++++++++- 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 confluent_osdeploy/debian/profiles/default/scripts/firstboot.d/.gitignore create mode 100644 confluent_osdeploy/debian/profiles/default/scripts/post.d/.gitignore create mode 100644 confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.firstboot create mode 100644 confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.post diff --git a/confluent_osdeploy/debian/profiles/default/initprofile.sh b/confluent_osdeploy/debian/profiles/default/initprofile.sh index 9a2705f2..09f95806 100644 --- a/confluent_osdeploy/debian/profiles/default/initprofile.sh +++ b/confluent_osdeploy/debian/profiles/default/initprofile.sh @@ -3,5 +3,6 @@ sed -i 's/label: debian/label: Debian/' $2/profile.yaml && \ ln -s $1/linux $2/boot/kernel && \ ln -s $1/initrd.gz $2/boot/initramfs/distribution && \ mkdir -p $2/boot/efi/boot && \ +rm $2/distribution && \ mcopy -i $1/boot/grub/efi.img ::/efi/boot/* $2/boot/efi/boot diff --git a/confluent_osdeploy/debian/profiles/default/scripts/firstboot.d/.gitignore b/confluent_osdeploy/debian/profiles/default/scripts/firstboot.d/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/confluent_osdeploy/debian/profiles/default/scripts/post.d/.gitignore b/confluent_osdeploy/debian/profiles/default/scripts/post.d/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.firstboot b/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.firstboot new file mode 100644 index 00000000..a6dcac35 --- /dev/null +++ b/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.firstboot @@ -0,0 +1,4 @@ +#!/bin/bash +# Add this to firstboot.d +apt-get install proxmox-ve postfix open-iscsi chrony + diff --git a/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.post b/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.post new file mode 100644 index 00000000..f4ba3fa2 --- /dev/null +++ b/confluent_osdeploy/debian/profiles/default/scripts/proxmox/proxmoxve.post @@ -0,0 +1,18 @@ +#!/bin/bash +# This script would run in post.d +# +echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list +wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg +sum=$(sha512sum /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg) +if [ "$sum" -ne "7da6fe34168adc6e479327ba517796d4702fa2f8b4f0a9833f5ea6e6b48f6507a6da403a274fe201595edc86a84463d50383d07f64bdde2e3658108db7d6dc87" ]; then + echo "Mismatch in fingerprint!" + exit 1 +fi +apt-get update && apt-get full-upgrade + +apt-get install proxmox-default-kernel +apt-get remove linux-image-amd64 'linux-image-6.1*' +update-grub +apt-get remove os-probec + + diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index c4401c34..ed2a3a41 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -441,8 +441,17 @@ def check_debian(isoinfo): if diskbits[0] == b'Debian': if b'mini.iso' not in diskbits: raise Exception("Debian only supports the 'netboot mini.iso' type images") - version = diskbits[2].decode() + major = diskbits[2].decode() arch = diskbits[4].decode() + buildtag = diskbits[-1].decode().strip() # 20230607+deb12u10 + minor = '0' + if '+' in buildtag: + _, variant = buildtag.split('+') + variant = variant.replace('deb', '') + if 'u' in variant: + minor = variant.split('u')[1] + version = '{0}.{1}'.format(major, minor) + if arch != 'amd64': raise Exception("Unsupported debian architecture {}".format(arch)) arch = 'x86_64'