Guest User

Untitled

a guest
Jul 9th, 2025
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. #!/bin/bash
  2. if [[ -r $1 ]]; then
  3. cert=$1
  4. elif [[ -r /opt/fog/snapins/ssl/CA/.fogCA.pem ]]; then
  5. cert="/opt/fog/snapins/ssl/CA/.fogCA.pem"
  6. fi
  7.  
  8. BUILDOPTS="CERT=${cert} TRUST=${cert}"
  9. IPXEGIT="https://github.com/ipxe/ipxe"
  10.  
  11. # Change directory to base ipxe files
  12. SCRIPT=$(readlink -f "$BASH_SOURCE")
  13. FOGDIR=$(dirname $(dirname $(dirname "$SCRIPT") ) )
  14. BASE=$(dirname "$FOGDIR")
  15.  
  16. if [[ -d ${BASE}/ipxe ]]; then
  17. cd ${BASE}/ipxe
  18. git clean -fd
  19. git reset --hard
  20. git pull
  21. cd src/
  22. # make sure this is being re-compiled in case the CA has changed!
  23. touch crypto/rootcert.c
  24. else
  25. git clone ${IPXEGIT} ${BASE}/ipxe
  26. cd ${BASE}/ipxe/src/
  27. fi
  28.  
  29.  
  30. # Get current header and script from fogproject repo
  31. echo "Copy (overwrite) iPXE headers and scripts..."
  32. cp ${FOGDIR}/src/ipxe/src/Makefile.housekeeping .
  33. cp ${FOGDIR}/src/ipxe/src/ipxescript .
  34. cp ${FOGDIR}/src/ipxe/src/ipxescript10sec .
  35. cp ${FOGDIR}/src/ipxe/src/config/general.h config/
  36. cp ${FOGDIR}/src/ipxe/src/config/settings.h config/
  37. cp ${FOGDIR}/src/ipxe/src/config/console.h config/
  38. sed -i 's+//#define+#define+g' config/usb.h
  39.  
  40. # Build the files
  41. make -j EMBED=ipxescript bin/ipxe.iso bin/{undionly,ipxe,intel,realtek}.{,k,kk}pxe bin/ipxe.lkrn bin/ipxe.usb ${BUILDOPTS}
  42. [[ $? -eq 0 ]] || exit 40
  43.  
  44. # Copy files to repo location as required
  45. cp bin/ipxe.iso bin/{undionly,ipxe,intel,realtek}.{,k,kk}pxe bin/ipxe.lkrn bin/ipxe.usb ${FOGDIR}/packages/tftp/
  46. cp bin/ipxe.lkrn ${FOGDIR}/packages/tftp/ipxe.krn
  47.  
  48. # Build with 10 second delay
  49. make -j EMBED=ipxescript10sec bin/ipxe.iso bin/{undionly,ipxe,intel,realtek}.{,k,kk}pxe bin/ipxe.lkrn bin/ipxe.usb ${BUILDOPTS}
  50. [[ $? -eq 0 ]] || exit 48
  51.  
  52. # Copy files to repo location as required
  53. cp bin/ipxe.iso bin/{undionly,ipxe,intel,realtek}.{,k,kk}pxe bin/ipxe.lkrn bin/ipxe.usb ${FOGDIR}/packages/tftp/10secdelay/
  54. cp bin/ipxe.lkrn ${FOGDIR}/packages/tftp/10secdelay/ipxe.krn
  55.  
  56. # Change to the efi layout
  57. if [[ -d ${BASE}/ipxe-efi ]]; then
  58. cd ${BASE}/ipxe-efi/
  59. git clean -fd
  60. git reset --hard
  61. git pull
  62. cd src/
  63. # make sure this is being re-compiled in case the CA has changed!
  64. touch crypto/rootcert.c
  65. else
  66. git clone ${IPXEGIT} ${BASE}/ipxe-efi
  67. cd ${BASE}/ipxe-efi/src/
  68. fi
  69.  
  70. # Get current header and script from fogproject repo
  71. echo "Copy (overwrite) iPXE headers and scripts..."
  72. cp ${FOGDIR}/src/ipxe/src-efi/Makefile.housekeeping .
  73. cp ${FOGDIR}/src/ipxe/src-efi/ipxescript .
  74. cp ${FOGDIR}/src/ipxe/src-efi/ipxescript10sec .
  75. cp ${FOGDIR}/src/ipxe/src-efi/config/general.h config/
  76. cp ${FOGDIR}/src/ipxe/src-efi/config/settings.h config/
  77. cp ${FOGDIR}/src/ipxe/src-efi/config/console.h config/
  78. sed -i 's+//#define+#define+g' config/usb.h
  79.  
  80. # Build the files
  81. make -j EMBED=ipxescript bin-{i386,x86_64}-efi/{snp{,only},ipxe,intel,realtek}.efi ${BUILDOPTS}
  82. [[ $? -eq 0 ]] || exit 80
  83.  
  84. make -j CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 EMBED=ipxescript bin-arm64-efi/{snp{,only},ipxe,intel,realtek}.efi ${BUILDOPTS}
  85. [[ $? -eq 0 ]] || exit 82
  86.  
  87. # Copy the files to upload
  88. cp bin-arm64-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/arm64-efi/
  89. cp bin-i386-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/i386-efi/
  90. cp bin-x86_64-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/
  91.  
  92. # Build with 10 second delay
  93. make -j EMBED=ipxescript10sec bin-{i386,x86_64}-efi/{snp{,only},ipxe,intel,realtek}.efi ${BUILDOPTS}
  94. [[ $? -eq 0 ]] || exit 91
  95.  
  96. make -j CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 EMBED=ipxescript10sec bin-arm64-efi/{snp{,only},ipxe,intel,realtek}.efi ${BUILDOPTS}
  97. [[ $? -eq 0 ]] || exit 93
  98.  
  99. # Copy the files to upload
  100. cp bin-arm64-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/10secdelay/arm64-efi/
  101. cp bin-i386-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/10secdelay/i386-efi/
  102. cp bin-x86_64-efi/{snp{,only},ipxe,intel,realtek}.efi ${FOGDIR}/packages/tftp/10secdelay/
  103.  
Advertisement
Add Comment
Please, Sign In to add comment