Improve preseeding config

This commit is contained in:
Joshua Boniface 2021-12-06 02:49:13 -05:00
parent cafcfca9d0
commit 24758a765b
3 changed files with 10 additions and 28 deletions

View File

@ -63,7 +63,7 @@ while [ $# -gt 0 ]; do
esac esac
done 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" PACKAGE_LIST_NONFREE="firmware-bnx2 firmware-bnx2x"
mkdir -p artifacts/lb mkdir -p artifacts/lb

View File

@ -116,16 +116,14 @@ build_pxe() {
set root-url tftp://\${next-server} set root-url tftp://\${next-server}
set host-url tftp://\${next-server}/host 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 menu-default pvc-installer
set submenu-default pvc-installer set submenu-default pvc-installer
:pvc-installer :pvc-installer
kernel \${root-url}/vmlinuz kernel \${root-url}/vmlinuz
initrd \${root-url}/initrd.img 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 boot
EOF EOF
echo "done." echo "done."

View File

@ -35,13 +35,6 @@ install_option="$( awk '{
seed_config() { seed_config() {
echo "Hello ${1}" 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 '{ seed_host="$( awk '{
for(i=1; i<=NF; i++) { for(i=1; i<=NF; i++) {
if($i ~ /pvcinstall.seed_host=/) { if($i ~ /pvcinstall.seed_host=/) {
@ -57,29 +50,20 @@ seed_config() {
} }
}' <<<"${kernel_cmdline}" | awk -F'=' '{ print $NF }' )" }' <<<"${kernel_cmdline}" | awk -F'=' '{ print $NF }' )"
if [[ -n ${seed_vlan} ]]; then
modprobe 8021q
fi
# Perform DHCP on all interfaces to come online # 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 for interface in $( ip address | grep '^[0-9]' | grep 'eno\|enp\|ens\|wlp' | awk '{ print $2 }' | tr -d ':' ); do
ip link set ${interface} up ip link set ${interface} up
if [[ -n ${seed_vlan} ]]; then
vconfig add ${interface} ${seed_vlan}
dhclient ${interface}.${seed_vlan}
else
dhclient ${interface} dhclient ${interface}
fi
done done
# Fetch the seed config # Fetch the seed config
tftp -m binary "${seed_host}" -c get "${seed_file}" /tmp/install.seed tftp -m binary "${seed_host}" -c get "${seed_file}" /tmp/install.seed
. /tmp/install.seed . /tmp/install.seed || exit 1
# Handle the target disk # Handle the target disk
if [[ -n ${target_disk_path} ]]; then if [[ -n ${target_disk_path} ]]; then
target_disk="$( readlink ${target_disk_path} )" target_disk="$( realpath ${target_disk_path} )"
if [[ ! -b ${target_disk} ]]; then if [[ ! -b ${target_disk} ]]; then
echo "Invalid disk!" echo "Invalid disk!"
exit 1 exit 1
@ -99,9 +83,9 @@ seed_config() {
interactive_config() { interactive_config() {
clear clear
echo "-----------------------------------------------------" echo "--------------------------------------------------------"
echo "| PVC Node installer (${iso_name}) |" echo "| PVC Node installer (${iso_name}) |"
echo "-----------------------------------------------------" echo "--------------------------------------------------------"
echo echo
echo "This LiveCD will install a PVC node base system ready for bootstrapping with 'pvc-ansible'." echo "This LiveCD will install a PVC node base system ready for bootstrapping with 'pvc-ansible'."
echo echo
@ -383,7 +367,7 @@ EOF
} }
case ${install_option} in case ${install_option} in
seed) on)
seed_config seed_config
;; ;;
*) *)
@ -542,7 +526,7 @@ echo "done."
# Determine the bypath name of the specified system disk # Determine the bypath name of the specified system disk
for disk in /dev/disk/by-path/*; do 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}" )" enteredname="$( awk -F'/' '{ print $NF }' <<<"${target_disk}" )"
if [[ ${bypathlink} == ${enteredname} ]]; then if [[ ${bypathlink} == ${enteredname} ]]; then
bypath_disk="${disk}" bypath_disk="${disk}"