Skip to content

Instantly share code, notes, and snippets.

@hexfusion
Forked from ohadlevy/AI-ipxe_generator.sh
Created December 4, 2020 16:50
Show Gist options
  • Save hexfusion/1323bbc2ada554cab08bdf33b415cc4d to your computer and use it in GitHub Desktop.
Save hexfusion/1323bbc2ada554cab08bdf33b415cc4d to your computer and use it in GitHub Desktop.
#! /bin/sh -ex
IMG_URL=$1
IMAGE='/tmp/image.iso'
BASE_URL='http://192.168.2.160:8080'
IPXE_DIR='/tmp/ipxe'
KERNEL_OPTS='random.trust_cpu=on rd.luks.options=discard ignition.firstboot ignition.platform.id=metal console=tty0 console=ttyS0,115200n8'
ISO_MNT=`mktemp -d`
mkdir -p $IPXE_DIR
#curl -O $ISO_URL
sudo mount -o loop,ro $IMAGE $ISO_MNT
cat > $IPXE_DIR/ipxe << EOF
#!ipxe
set live_url ${BASE_URL}
kernel \${live_url}/vmlinuz ignition.config.url=\${live_url}/config.ign coreos.live.rootfs_url=\${live_url}/rootfs.img ${KERNEL_OPTS}
initrd \${live_url}/initrd.img
boot
EOF
cp $ISO_MNT/images/pxeboot/* $IPXE_DIR
echo '{' > $IPXE_DIR/config.ign
xz -dc $ISO_MNT/images/ignition.img | sed '1d; $d' >> $IPXE_DIR/config.ign
echo '}' >> $IPXE_DIR/config.ign
sudo umount $ISO_MNT
rm -rf $ISO_MNT
podman run -v $IPXE_DIR:/app:ro -p 8080:8080 -d --rm bitnami/nginx:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment