prep-release.sh 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. # prep release for upload to production container
  3. function error_check()
  4. {
  5. if [ $? -eq 1 ]
  6. then
  7. echo "Error encountered... failing..."
  8. exit 1
  9. fi
  10. }
  11. # make ipxe directory to store ipxe disks
  12. mkdir -p build/ipxe
  13. # pull down upstream iPXE
  14. git clone --depth 1 https://github.com/ipxe/ipxe.git ipxe_build
  15. # copy iPXE config overrides into source tree
  16. cp ipxe/local/* ipxe_build/src/config/local/
  17. # copy certs into source tree
  18. cp script/*.crt ipxe_build/src/
  19. # build iPXE disks
  20. cd ipxe_build/src
  21. # get current iPXE hash
  22. IPXE_HASH=`git log -n 1 --pretty=format:"%H"`
  23. # generate generic iPXE disks
  24. make bin/ipxe.dsk bin/ipxe.iso bin/ipxe.lkrn bin/ipxe.usb bin/ipxe.kpxe bin/undionly.kpxe
  25. mv bin/ipxe.dsk ../../build/ipxe/generic-ipxe.dsk
  26. mv bin/ipxe.iso ../../build/ipxe/generic-ipxe.iso
  27. mv bin/ipxe.lkrn ../../build/ipxe/generic-ipxe.lkrn
  28. mv bin/ipxe.usb ../../build/ipxe/generic-ipxe.usb
  29. mv bin/ipxe.kpxe ../../build/ipxe/generic-ipxe.kpxe
  30. mv bin/undionly.kpxe ../../build/ipxe/generic-undionly.kpxe
  31. # generate netboot.xyz iPXE disks
  32. for ipxe_config in `ls ../../ipxe/disks/`
  33. do
  34. make bin/ipxe.dsk bin/ipxe.iso bin/ipxe.lkrn bin/ipxe.usb bin/ipxe.kpxe bin/undionly.kpxe \
  35. EMBED=../../ipxe/disks/$ipxe_config TRUST=ca-ipxe-org.crt,ca-netboot-xyz.crt
  36. error_check
  37. mv bin/ipxe.dsk ../../build/ipxe/$ipxe_config.dsk
  38. mv bin/ipxe.iso ../../build/ipxe/$ipxe_config.iso
  39. mv bin/ipxe.lkrn ../../build/ipxe/$ipxe_config.lkrn
  40. mv bin/ipxe.usb ../../build/ipxe/$ipxe_config.usb
  41. mv bin/ipxe.kpxe ../../build/ipxe/$ipxe_config.kpxe
  42. mv bin/undionly.kpxe ../../build/ipxe/$ipxe_config-undionly.kpxe
  43. done
  44. # generate netboot.xyz iPXE disk for Google Compute Engine
  45. for ipxe_config in `ls ../../ipxe/disks/`
  46. do
  47. make bin/ipxe.usb CONFIG=cloud EMBED=../../ipxe/disks/$ipxe_config \
  48. TRUST=ca-ipxe-org.crt,ca-netboot-xyz.crt
  49. error_check
  50. cp -f bin/ipxe.usb disk.raw
  51. tar Sczvf $ipxe_config-GCE.tar.gz disk.raw
  52. mv $ipxe_config-GCE.tar.gz ../../build/ipxe/$ipxe_config-GCE.tar.gz
  53. done
  54. # generate EFI iPXE disks
  55. for ipxe_config in `ls ../../ipxe/disks/`
  56. do
  57. cp config/local/general.h.efi config/local/general.h
  58. make bin-x86_64-efi/ipxe.efi EMBED=../../ipxe/disks/$ipxe_config
  59. error_check
  60. mv bin-x86_64-efi/ipxe.efi ../../build/ipxe/$ipxe_config.efi
  61. done
  62. # return to root
  63. cd ../..
  64. # generate header for sha256-checksums file
  65. cd build/
  66. CURRENT_TIME=`date`
  67. cat > netboot.xyz-sha256-checksums.txt <<EOF
  68. # netboot.xyz bootloaders generated at $CURRENT_TIME
  69. # iPXE Commit: https://github.com/ipxe/ipxe/commit/$IPXE_HASH
  70. # Travis-CI Job: https://travis-ci.org/antonym/netboot.xyz/builds/$TRAVIS_BUILD_ID
  71. EOF
  72. # generate sha256sums for iPXE disks
  73. cd ipxe/
  74. for ipxe_disk in `ls .`
  75. do
  76. sha256sum $ipxe_disk >> ../netboot.xyz-sha256-checksums.txt
  77. done
  78. cat ../netboot.xyz-sha256-checksums.txt
  79. mv ../netboot.xyz-sha256-checksums.txt .
  80. cd ../..
  81. # generate signatures for netboot.xyz source files
  82. mkdir sigs
  83. for src_file in `ls src`
  84. do
  85. openssl cms -sign -binary -noattr -in src/$src_file \
  86. -signer script/codesign.crt -inkey script/codesign.key -certfile script/ca-netboot-xyz.crt -outform DER \
  87. -out sigs/$src_file.sig
  88. echo Generated signature for $src_file...
  89. done
  90. mv sigs src/
  91. # delete index.html so that we don't overwrite existing content type
  92. rm src/index.html
  93. # copy iPXE src code into build directory
  94. cp -R src/* build/
  95. # generate mkdocs
  96. mkdocs build