Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# iPXE build depends
apt-get install -y liblzma-dev git build-essential
# clone iPXE
[ ! -d ./ipxe ] && git clone http://git.ipxe.org/ipxe.git
cd ipxe/src
make clean
sed -i 's/#undef\tDOWNLOAD_PROTO_HTTPS/#define\tDOWNLOAD_PROTO_HTTPS/' config/general.h
for m in 10ec8139 8086100e virtio-net; do
make -j bin/${m}.rom
make -j bin-x86_64-efi/${m}.efirom
done
# Backup old roms first
[ -f /usr/share/kvm/pxe-e1000.rom.bak ] || cp -v /usr/share/kvm/pxe-e1000.rom /usr/share/kvm/pxe-e1000.rom.bak
[ -f /usr/share/kvm/pxe-virtio.rom.bak ] || cp -v /usr/share/kvm/pxe-virtio.rom /usr/share/kvm/pxe-virtio.rom.bak
[ -f /usr/share/kvm/pxe-rtl8139.rom.bak ] || cp -v /usr/share/kvm/pxe-rtl8139.rom /usr/share/kvm/pxe-rtl8139.rom.bak
[ -f /usr/share/kvm/efi-e1000e.rom.bak ] || cp -v /usr/share/kvm/efi-e1000e.rom /usr/share/kvm/efi-e1000e.rom.bak
[ -f /usr/share/kvm/efi-virtio.rom.bak ] || cp -v /usr/share/kvm/efi-virtio.rom /usr/share/kvm/efi-virtio.rom.bak
[ -f /usr/share/kvm/efi-10ec8139.rom ] || cp -v /usr/share/kvm/efi-10ec8139.rom /usr/share/kvm/efi-10ec8139.rom.bak
# e1000e
cp -v bin/8086100e.rom /usr/share/kvm/pxe-e1000.rom
cp -v bin-x86_64-efi/8086100e.efirom /usr/share/kvm/efi-e1000e.rom
# virtio
cp -v bin/virtio-net.rom /usr/share/kvm/pxe-virtio.rom
cp -v bin-x86_64-efi/virtio-net.efirom /usr/share/kvm/efi-virtio.rom
# rtl8139
cp -v bin/10ec8139.rom /usr/share/kvm/pxe-rtl8139.rom
cp -v bin-x86_64-efi/10ec8139.efirom /usr/share/kvm/efi-10ec8139.rom
@papamoose

This comment has been minimized.

Copy link
Owner Author

@papamoose papamoose commented Oct 28, 2019

@fclerg

This comment has been minimized.

Copy link

@fclerg fclerg commented Apr 17, 2020

I'm afraid this doesn't backup anything!
Use ||instead of &&. Or ! [ -f ... ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.