Skip to content

Instantly share code, notes, and snippets.

@UnconventionalMindset
Last active October 25, 2022 22:27
Show Gist options
  • Save UnconventionalMindset/9c9daa66727e7f45a85bad30a7844caa to your computer and use it in GitHub Desktop.
Save UnconventionalMindset/9c9daa66727e7f45a85bad30a7844caa to your computer and use it in GitHub Desktop.
Embed Core OS installation to iPXE
#!/bin/bash
download_folder="ipxe"
install_script_url="https://gist.githubusercontent.com/UnconventionalMindset/f4ca2d66b943f916b5fecfad698b47ea/raw"
full_path="$HOME/${download_folder}"
[ -z $full_path ] && { echo "Error: download path is empty"; exit 1; } || echo "Download path set to: ${full_path}, continuing..."
apt -y install gcc binutils make perl liblzma-dev mtools genisoimage syslinux isolinux
rm -f $HOME/coreos-install.ipxe
rm -rf ${full_path}/
rm -f /var/lib/vz/template/iso/coreos-ipxe.iso
git clone https://git.ipxe.org/ipxe.git $full_path
cd ${full_path}/src
curl $install_script_url -o $HOME/coreos-install.ipxe
sed -i 's/#undef[[:space:]]*\(DOWNLOAD_PROTO_HTTPS\)/#define \1/' config/general.h
make bin/ipxe.iso EMBED=$HOME/coreos-install.ipxe
mv bin/ipxe.iso /var/lib/vz/template/iso/coreos-ipxe.iso
rm -f $HOME/coreos-install.ipxe
rm -rf ${full_path}/
@UnconventionalMindset
Copy link
Author

UnconventionalMindset commented Oct 24, 2022

Running this script (almost) automatically provision my Fedora Core OS VM in proxmox:

  1. Embeds coreos-install.ipxe script and builds an iPXE ISO.
  2. (Only Manual step, to be made automatic with Terraform) Create a VM in proxmox that boots the iPXE
  3. The iPXE gets an IP and download the core OS installer ISO
  4. iPXE starts the core OS installer ISO passing my ignition
  5. The installer installs core OS with my ignition config to be applied at first boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment