04-iso 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Build script to compose the Live CD image.
  2. #
  3. # Copyright (c) 2017 MMPG.
  4. # Copyright (c) 2017-2020 Matias Fonzo <selk@dragora.org>.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # ISO file name
  18. ISONAME="${ISONAME:-dragora-3.0_$(date +%Y%m%d)-${arch}}"
  19. # Default mkisofs(8) invocation name
  20. MKISOFS=mkisofs
  21. # Perform sanity checks (requirements)
  22. if ! test -e "${rootdir}/squashfs-tools_lzip/mksquashfs"
  23. then
  24. echo "Local \`${rootdir}/squashfs-tools_lzip/mksquashfs' does not exist." 1>&2
  25. exit 2;
  26. fi
  27. if ! type mkisofs > /dev/null
  28. then
  29. echo "" 1>&2
  30. echo "\`mkisofs' is not found in your PATH." 1>&2
  31. if type genisoimage > /dev/null
  32. then
  33. MKISOFS=genisoimage
  34. else
  35. echo "\`genisoimage' was not found in your PATH." 1>&2
  36. echo "" 1>&2
  37. echo "Please install one of these programs to make the ISO image." 1>&2
  38. echo "" 1>&2
  39. exit 2;
  40. fi
  41. fi
  42. # This depends on the existence of the stage 1
  43. if test ! -d "${output}/stage1/usr/pkg"
  44. then
  45. echo "The stage number 1 does not exist or is incomplete." 1>&2
  46. echo "Build (completely) the stage 1 before processing '$stage'." 1>&2
  47. exit 1;
  48. fi
  49. if test ! -f "${rootdir}/initrd/initrd.img"
  50. then
  51. echo "${rootdir}/initrd/initrd.img: No such initramfs file" 1>&2
  52. exit 1;
  53. fi
  54. STAGE1="${output}/stage1"
  55. CDROM="${rootdir}/cdrom"
  56. # Re-create CD tree
  57. echo "Re-creating CD tree (${CDROM}) ..."
  58. rm -rf -- "$CDROM"
  59. mkdir -p -- "${CDROM}/isolinux"
  60. # Copy kernel installation to isolinux/
  61. cd -- "${STAGE1}/boot"
  62. for file in System.map-* config-* vmlinuz-*
  63. do
  64. cp -p "${STAGE1}/boot/$file" "${CDROM}/isolinux/${file%%-*}"
  65. done
  66. unset file
  67. # Copy local isolinux files and initramfs for ISOLINUX
  68. cp -p "${worktree}"/archive/isolinux/* "${CDROM}/isolinux/"
  69. rm -f "${CDROM}/isolinux/isohybrid.pl" \
  70. "${CDROM}/isolinux/generate-keymap"
  71. cp -p "${rootdir}/initrd/initrd.img" "${CDROM}/isolinux/"
  72. # Produce compressed image using mksquashfs(1)
  73. cd -- "$STAGE1"
  74. rm -f ./dragora.sfs
  75. "${rootdir}"/squashfs-tools_lzip/mksquashfs ./* "${CDROM}/dragora.sfs" \
  76. -comp lzip -b 128K -Xcompression-level 0 -Xdict-size 100% \
  77. -noappend -e ./tools ./var/cache/qi/packages ./root/.ash_history \
  78. ./*-log* ./usr/pkg/kernel-buildtree-* ./usr/src/linux-* ./usr/src/qi
  79. # Produce hybrid ISO-9660 image
  80. cd -- "$CDROM"
  81. rm -f ./${ISONAME}*
  82. $MKISOFS -v -o ${ISONAME}.iso \
  83. -J -R -iso-level 3 \
  84. -no-emul-boot -boot-load-size 4 -boot-info-table \
  85. -b "isolinux/isolinux.bin" \
  86. -c "isolinux/boot.cat" \
  87. -V "Dragora-${arch}" \
  88. .
  89. unset MKISOFS
  90. echo "Applying \"hybrid booting\" to the ISO image ..."
  91. "${worktree}"/archive/isolinux/isohybrid.pl ${ISONAME}.iso
  92. echo "Making .sha256 sum ..."
  93. sha256sum ${ISONAME}.iso > ${ISONAME}.iso.sha256
  94. echo "Finish ..."
  95. echo ""
  96. echo "***"
  97. echo "The ISO image has been produced at"
  98. echo " ${CDROM}/${ISONAME}.iso"
  99. echo "***"
  100. echo ""
  101. exit 0