/release/sparc64/mkisoimages.sh

https://bitbucket.org/freebsd/freebsd-head/ · Shell · 72 lines · 42 code · 6 blank · 24 comment · 7 complexity · 6303722bfd2c80d06ca039ab0cf6179b MD5 · raw file

  1. #!/bin/sh
  2. #
  3. # Module: mkisoimages.sh
  4. # Author: Jordan K Hubbard
  5. # Date: 22 June 2001
  6. #
  7. # $FreeBSD$
  8. #
  9. # This script is used by release/Makefile to build the (optional) ISO images
  10. # for a FreeBSD release. It is considered architecture dependent since each
  11. # platform has a slightly unique way of making bootable CDs. This script
  12. # is also allowed to generate any number of images since that is more of
  13. # publishing decision than anything else.
  14. #
  15. # Usage:
  16. #
  17. # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir]
  18. #
  19. # Where -b is passed if the ISO image should be made "bootable" by
  20. # whatever standards this architecture supports (may be unsupported),
  21. # image-label is the ISO image label, image-name is the filename of the
  22. # resulting ISO image, base-bits-dir contains the image contents and
  23. # extra-bits-dir, if provided, contains additional files to be merged
  24. # into base-bits-dir as part of making the image.
  25. publisher="The FreeBSD Project. http://www.freebsd.org/"
  26. IMG=/tmp/bootfs
  27. MNT=/mnt
  28. if [ "x$1" = "x-b" ]; then
  29. dd if=/dev/zero of=${IMG} bs=512 count=1024
  30. MD=`mdconfig -a -t vnode -f ${IMG}`
  31. sunlabel -w -B -b $4/boot/boot1 ${MD} auto
  32. newfs -O1 -o space -m 0 /dev/${MD}
  33. mount /dev/${MD} ${MNT}
  34. mkdir ${MNT}/boot
  35. cp $4/boot/loader ${MNT}/boot
  36. umount ${MNT}
  37. mdconfig -d -u ${MD#md}
  38. bootable="-B ,,,,${IMG}"
  39. shift
  40. else
  41. bootable=""
  42. fi
  43. if [ $# -lt 3 ]; then
  44. echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
  45. rm -f ${IMG}
  46. exit 1
  47. fi
  48. type mkisofs 2>&1 | grep " is " >/dev/null
  49. if [ $? -ne 0 ]; then
  50. echo The cdrtools port is not installed. Trying to get it now.
  51. if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then
  52. cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean
  53. else
  54. if ! pkg_add -r cdrtools; then
  55. echo "Could not get it via pkg_add - please go install this"
  56. echo "from the ports collection and run this script again."
  57. exit 2
  58. fi
  59. fi
  60. fi
  61. LABEL=$1; shift
  62. NAME=$1; shift
  63. echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
  64. mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $*
  65. rm $1/etc/fstab
  66. rm -f ${IMG}