From 3113a3f9c2b640238ed99470c183bdad163aafed Mon Sep 17 00:00:00 2001 From: pedro Date: Wed, 25 Sep 2024 09:43:11 -0300 Subject: [PATCH] pxe: fix logic on tftp live parts --- pxe/install-pxe.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pxe/install-pxe.sh b/pxe/install-pxe.sh index 117ac4e..0e5f631 100755 --- a/pxe/install-pxe.sh +++ b/pxe/install-pxe.sh @@ -44,13 +44,14 @@ END } extract_live_parts_for_tftp() { + if [ ! -f /tmp/live.iso ]; then # src https://www.debian.org/CD/faq/#newest - DEBIAN_VERSION="$(wget https://www.debian.org/CD/ -O- \ - | grep -o '[0-9.]*' \ - | grep -o '[0-9.]*')" - url="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-${DEBIAN_VERSION}-amd64-standard.iso" - wget "${url}" -O /tmp/live.iso - + DEBIAN_VERSION="$(wget https://www.debian.org/CD/ -O- \ + | grep -o '[0-9.]*' \ + | grep -o '[0-9.]*')" + url="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-${DEBIAN_VERSION}-amd64-standard.iso" + wget "${url}" -O /tmp/live.iso + fi mount -o loop live.iso /mnt/ cp /mnt/live/vmlinuz "${tftp_path}/vmlinuz-live" cp /mnt/live/initrd.img "${tftp_path}/initrd-live.img" @@ -62,9 +63,7 @@ install_netboot() { if [ ! -d "${tftp_path}" ] || [ "${FORCE:-}" ]; then mkdir -p "${tftp_path}" cd "${tftp_path}" - if [ -f /tmp/live.iso ]; then - extract_live_parts_for_tftp - fi + extract_live_parts_for_tftp cat > "${tftp_path}/pxelinux.cfg/default" <