From 3707202c5ea50d6339fb7da93ddfd7a788479457 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 1 Sep 2023 15:41:56 -0400 Subject: [PATCH] Improve preseeding config --- buildiso.sh | 2 +- buildpxe.sh | 6 ++---- install.sh | 30 +++++++----------------------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/buildiso.sh b/buildiso.sh index 7812219..a93d2d7 100755 --- a/buildiso.sh +++ b/buildiso.sh @@ -63,7 +63,7 @@ while [ $# -gt 0 ]; do esac done -PACKAGE_LIST_MAIN="live-tools linux-image-amd64 mdadm lvm2 parted gdisk debootstrap grub-pc-bin grub-efi-amd64 sipcalc vim ca-certificates vlan" +PACKAGE_LIST_MAIN="live-tools linux-image-amd64 mdadm lvm2 parted gdisk debootstrap grub-pc-bin grub-efi-amd64 sipcalc vim ca-certificates vlan tftp-hpa" PACKAGE_LIST_NONFREE="firmware-bnx2 firmware-bnx2x" mkdir -p artifacts/lb diff --git a/buildpxe.sh b/buildpxe.sh index 6ae11d4..6b8d580 100755 --- a/buildpxe.sh +++ b/buildpxe.sh @@ -116,16 +116,14 @@ build_pxe() { set root-url tftp://\${next-server} set host-url tftp://\${next-server}/host -# Load host/mac-*.ipxe if present (per-host host-args configuration) -chain --autofree \${host-url}/mac-\${mac:hexraw}.ipxe || - set menu-default pvc-installer set submenu-default pvc-installer :pvc-installer kernel \${root-url}/vmlinuz initrd \${root-url}/initrd.img -imgargs vmlinuz console=tty0 console=ttyS0,115200n8 boot=live components timezone=America/Toronto fetch=\${root-url}/filesystem.squashfs username=root \${host-args} +imgargs vmlinuz console=tty0 console=ttyS0,115200n8 boot=live components timezone=America/Toronto fetch=\${root-url}/filesystem.squashfs username=root pvcinstall.preseed=on pvcinstall.seed_host=\${next-server} pvcinstall.seed_file=/host/mac-\${mac:hexraw}.preseed + boot EOF echo "done." diff --git a/install.sh b/install.sh index 83ae232..a3e00ce 100755 --- a/install.sh +++ b/install.sh @@ -35,13 +35,6 @@ install_option="$( awk '{ seed_config() { echo "Hello ${1}" - seed_vlan="$( awk '{ - for(i=1; i<=NF; i++) { - if($i ~ /pvcinstall.seed_vlan=/) { - print $i; - } - } - }' <<<"${kernel_cmdline}" | awk -F'=' '{ print $NF }' )" seed_host="$( awk '{ for(i=1; i<=NF; i++) { if($i ~ /pvcinstall.seed_host=/) { @@ -57,29 +50,20 @@ seed_config() { } }' <<<"${kernel_cmdline}" | awk -F'=' '{ print $NF }' )" - if [[ -n ${seed_vlan} ]]; then - modprobe 8021q - fi - # Perform DHCP on all interfaces to come online for interface in $( ip address | grep '^[0-9]' | grep 'eno\|enp\|ens\|wlp' | awk '{ print $2 }' | tr -d ':' ); do ip link set ${interface} up - if [[ -n ${seed_vlan} ]]; then - vconfig add ${interface} ${seed_vlan} - dhclient ${interface}.${seed_vlan} - else - dhclient ${interface} - fi + dhclient ${interface} done # Fetch the seed config tftp -m binary "${seed_host}" -c get "${seed_file}" /tmp/install.seed - . /tmp/install.seed + . /tmp/install.seed || exit 1 # Handle the target disk if [[ -n ${target_disk_path} ]]; then - target_disk="$( readlink ${target_disk_path} )" + target_disk="$( realpath ${target_disk_path} )" if [[ ! -b ${target_disk} ]]; then echo "Invalid disk!" exit 1 @@ -99,9 +83,9 @@ seed_config() { interactive_config() { clear - echo "-----------------------------------------------------" + echo "--------------------------------------------------------" echo "| PVC Node installer (${iso_name}) |" - echo "-----------------------------------------------------" + echo "--------------------------------------------------------" echo echo "This LiveCD will install a PVC node base system ready for bootstrapping with 'pvc-ansible'." echo @@ -383,7 +367,7 @@ EOF } case ${install_option} in - seed) + on) seed_config ;; *) @@ -542,7 +526,7 @@ echo "done." # Determine the bypath name of the specified system disk for disk in /dev/disk/by-path/*; do - bypathlink="$( readlink ${disk} | awk -F'/' '{ print $NF }' )" + bypathlink="$( realpath ${disk} | awk -F'/' '{ print $NF }' )" enteredname="$( awk -F'/' '{ print $NF }' <<<"${target_disk}" )" if [[ ${bypathlink} == ${enteredname} ]]; then bypath_disk="${disk}"