03-iso 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Build script to compose the liveCD image.
  2. #
  3. # Copyright (c) 2017 MMPG.
  4. # Copyright (c) 2017 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. # Perform sanity checks (requirements)
  18. type mksquashfs > /dev/null || exit 2;
  19. type mkisofs > /dev/null || exit 2;
  20. # This depends on the existence of the stage 1
  21. if test ! -d "${output}/stage1/usr/pkg"
  22. then
  23. echo "The stage number 1 does not exist or is incomplete." 1>&2
  24. echo "Build (completely) the stage 1 before processing '$stage'." 1>&2
  25. exit 1;
  26. fi
  27. if test ! -f "${rootdir}/initrd/initrd.img"
  28. then
  29. echo "${rootdir}/initrd/initrd.img: No such initramfs file" 1>&2
  30. exit 1;
  31. fi
  32. STAGE1="${output}/stage1"
  33. CDROM="${rootdir}/cdrom"
  34. # Re-create CD tree
  35. rm -rf -- "$CDROM"
  36. mkdir -p -- "${CDROM}/isolinux"
  37. # Copy kernel installation to isolinux/
  38. cd -- "${STAGE1}/boot"
  39. for file in System.map config vmlinuz
  40. do
  41. if test -L $file -a ! -e $file
  42. then
  43. cp -p "${STAGE1}/$(readlink -- "$file")" "${CDROM}/isolinux/$file"
  44. elif test -f $file
  45. then
  46. cp -p "${STAGE1}/boot/$file" "${CDROM}/isolinux/$file"
  47. else
  48. echo "No valid symlinks or regular files for copying the kernel" 1>&2
  49. exit 1;
  50. fi
  51. done
  52. unset file
  53. # Copy local isolinux files and initramfs for ISOLINUX
  54. cp -p "${worktree}"/archive/isolinux/* "${CDROM}/isolinux/"
  55. rm -f "${CDROM}/isolinux/isohybrid.pl"
  56. cp -p "${rootdir}/initrd/initrd.img" "${CDROM}/isolinux/"
  57. # Produce compressed image using mksquashfs(1)
  58. cd -- "$STAGE1"
  59. rm -f ./dragora.sfs
  60. mksquashfs ./* "${CDROM}/dragora.sfs" \
  61. -comp gzip -b 256K -Xcompression-level 9 -keep-as-directory \
  62. -e ./tools ./var/cache/qi/packages ./root/.ash_history \
  63. ./usr/pkg/kernel-buildtree-* ./usr/src/linux-* ./usr/src/qi
  64. # Produce hybrid ISO-9660 image
  65. cd -- "$CDROM"
  66. rm -f ./dragora-live*
  67. mkisofs -v -o "${CDROM}/dragora-live.iso" \
  68. -no-emul-boot -boot-load-size 4 -boot-info-table \
  69. -b "isolinux/isolinux.bin" \
  70. -c "isolinux/boot.cat" \
  71. -A 'Dragora' -V 'Dragora' \
  72. .
  73. echo "Applying \"hybrid booting\" to the ISO image ..."
  74. "${worktree}"/archive/isolinux/isohybrid.pl "${CDROM}/dragora-live.iso"
  75. sha256sum "${CDROM}/dragora-live.iso" > "${CDROM}/dragora-live.iso.sha256"
  76. echo "Finish ..."
  77. echo ""
  78. echo "The ISO image has been produced:"
  79. echo "${CDROM}/dragora-live.iso"
  80. echo ""