Skip to content

Instantly share code, notes, and snippets.

@ohadlevy
Created September 9, 2020 15:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ohadlevy/5423931a0a7326a73b2680d57d1eef0f to your computer and use it in GitHub Desktop.
Save ohadlevy/5423931a0a7326a73b2680d57d1eef0f 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