prep-release.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 EFI iPXE disks
  45. #for ipxe_config in `ls ../../ipxe/disks/`
  46. #do
  47. # # Remove general.h options for testing, doesn't like COMBOOT
  48. # rm config/local/general.h
  49. # make bin-x86_64-efi/ipxe.efi EMBED=../../ipxe/disks/$ipxe_config
  50. # error_check
  51. # mv bin-x86_64-efi/ipxe.efi ../../build/ipxe/$ipxe_config.efi
  52. #done
  53. # return to root
  54. cd ../..
  55. # generate header for sha256-checksums file
  56. cd build/
  57. CURRENT_TIME=`date`
  58. cat > netboot.xyz-sha256-checksums.txt <<EOF
  59. # netboot.xyz bootloaders generated at $CURRENT_TIME
  60. # iPXE Commit: https://github.com/ipxe/ipxe/commit/$IPXE_HASH
  61. # Travis-CI Job: https://travis-ci.org/antonym/netboot.xyz/builds/$TRAVIS_BUILD_ID
  62. EOF
  63. # generate sha256sums for iPXE disks
  64. cd ipxe/
  65. for ipxe_disk in `ls .`
  66. do
  67. sha256sum $ipxe_disk >> ../netboot.xyz-sha256-checksums.txt
  68. done
  69. cat ../netboot.xyz-sha256-checksums.txt
  70. mv ../netboot.xyz-sha256-checksums.txt .
  71. cd ../..
  72. # generate signatures for netboot.xyz source files
  73. mkdir sigs
  74. for src_file in `ls src`
  75. do
  76. openssl cms -sign -binary -noattr -in src/$src_file \
  77. -signer script/codesign.crt -inkey script/codesign.key -certfile script/ca-netboot-xyz.crt -outform DER \
  78. -out sigs/$src_file.sig
  79. echo Generated signature for $src_file...
  80. done
  81. mv sigs src/
  82. # delete index.html so that we don't overwrite existing content type
  83. rm src/index.html
  84. # copy iPXE src code into build directory
  85. cp -R src/* build/