mklive.sh.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. #!/bin/sh
  2. #
  3. # vim: set ts=4 sw=4 et:
  4. #
  5. #-
  6. # Copyright (c) 2009-2015 Juan Romero Pardines.
  7. # All rights reserved.
  8. #
  9. # Redistribution and use in source and binary forms, with or without
  10. # modification, are permitted provided that the following conditions
  11. # are met:
  12. # 1. Redistributions of source code must retain the above copyright
  13. # notice, this list of conditions and the following disclaimer.
  14. # 2. Redistributions in binary form must reproduce the above copyright
  15. # notice, this list of conditions and the following disclaimer in the
  16. # documentation and/or other materials provided with the distribution.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. #-
  29. trap 'error_out $? $LINENO' INT TERM 0
  30. umask 022
  31. readonly REQUIRED_PKGS="base-files libgcc dash coreutils sed tar gawk syslinux grub-i386-efi grub-x86_64-efi squashfs-tools xorriso"
  32. readonly INITRAMFS_PKGS="binutils xz device-mapper dhclient dracut-network openresolv"
  33. readonly PROGNAME=$(basename "$0")
  34. info_msg() {
  35. printf "\033[1m$@\n\033[m"
  36. }
  37. die() {
  38. info_msg "ERROR: $@"
  39. error_out 1 $LINENO
  40. }
  41. print_step() {
  42. CURRENT_STEP=$((CURRENT_STEP+1))
  43. info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $@"
  44. }
  45. mount_pseudofs() {
  46. for f in sys dev proc; do
  47. mkdir -p "$ROOTFS"/$f
  48. mount --bind /$f "$ROOTFS"/$f
  49. done
  50. }
  51. umount_pseudofs() {
  52. umount -f "$ROOTFS"/sys >/dev/null 2>&1
  53. umount -f "$ROOTFS"/dev >/dev/null 2>&1
  54. umount -f "$ROOTFS"/proc >/dev/null 2>&1
  55. }
  56. error_out() {
  57. umount_pseudofs
  58. [ -d "$BUILDDIR" -a -z "$KEEP_BUILDDIR" ] && rm -rf "$BUILDDIR"
  59. exit "${1:=0}"
  60. }
  61. usage() {
  62. cat <<_EOF
  63. Usage: $PROGNAME [options]
  64. Options:
  65. -a <xbps-arch> Set XBPS_ARCH (do not use it unless you know what it is)
  66. -b <system-pkg> Set an alternative base-system package (defaults to base-system).
  67. -r <repo-url> Use this XBPS repository (may be specified multiple times).
  68. -c <cachedir> Use this XBPS cache directory (a subdirectory of current
  69. directory if unset).
  70. -k <keymap> Default keymap to use (us if unset)
  71. -l <locale> Default locale to use (en_US.UTF-8 if unset).
  72. -i <lz4|gzip|bzip2|xz> Compression type for the initramfs image (xz if unset).
  73. -s <gzip|lzo|xz> Compression type for the squashfs image (xz if unset)
  74. -o <file> Output file name for the ISO image (auto if unset).
  75. -p "pkg pkgN ..." Install additional packages into the ISO image.
  76. -I <includedir> Include directory structure under given path into rootfs
  77. -C "cmdline args" Add additional kernel command line arguments.
  78. -T "title" Modify the bootloader title.
  79. -v linux<version> Install a custom Linux version on ISO image (linux meta-package if unset).
  80. -K Do not remove builddir.
  81. The $PROGNAME script generates a live image of the Void Linux distribution.
  82. This ISO image can be written to a CD/DVD-ROM or any USB stick.
  83. _EOF
  84. exit 1
  85. }
  86. copy_void_keys() {
  87. mkdir -p "$1"/var/db/xbps/keys
  88. cp keys/*.plist "$1"/var/db/xbps/keys
  89. }
  90. copy_dracut_files() {
  91. mkdir -p "$1"/usr/lib/dracut/modules.d/01vmklive
  92. cp dracut/vmklive/* "$1"/usr/lib/dracut/modules.d/01vmklive/
  93. }
  94. copy_autoinstaller_files() {
  95. mkdir -p "$1"/usr/lib/dracut/modules.d/01autoinstaller
  96. cp dracut/autoinstaller/* "$1"/usr/lib/dracut/modules.d/01autoinstaller/
  97. }
  98. install_prereqs() {
  99. XBPS_ARCH=$ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \
  100. -c "$XBPS_HOST_CACHEDIR" -y $REQUIRED_PKGS
  101. [ $? -ne 0 ] && die "Failed to install required software, exiting..."
  102. }
  103. install_packages() {
  104. XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \
  105. ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn $PACKAGE_LIST $INITRAMFS_PKGS
  106. [ $? -ne 0 ] && die "Missing required binary packages, exiting..."
  107. mount_pseudofs
  108. LANG=C XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \
  109. ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y $PACKAGE_LIST $INITRAMFS_PKGS
  110. [ $? -ne 0 ] && die "Failed to install $PACKAGE_LIST"
  111. xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1
  112. chroot "$ROOTFS" env -i xbps-reconfigure -f base-files
  113. # Enable choosen UTF-8 locale and generate it into the target rootfs.
  114. if [ -f "$ROOTFS"/etc/default/libc-locales ]; then
  115. sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i "$ROOTFS"/etc/default/libc-locales
  116. fi
  117. chroot "$ROOTFS" env -i xbps-reconfigure -a
  118. if [ -x installer.sh ]; then
  119. install -Dm755 installer.sh "$ROOTFS"/usr/sbin/void-installer
  120. else
  121. install -Dm755 /usr/sbin/void-installer "$ROOTFS"/usr/sbin/void-installer
  122. fi
  123. # Cleanup and remove useless stuff.
  124. rm -rf "$ROOTFS"/var/cache/* "$ROOTFS"/run/* "$ROOTFS"/var/run/*
  125. }
  126. copy_include_directory() {
  127. find "$INCLUDE_DIRECTORY" -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} "$ROOTFS"/ \;
  128. }
  129. generate_initramfs() {
  130. local _args
  131. copy_dracut_files "$ROOTFS"
  132. copy_autoinstaller_files "$ROOTFS"
  133. chroot "$ROOTFS" env -i /usr/bin/dracut -N --"${INITRAMFS_COMPRESSION}" \
  134. --add-drivers "ahci" --force-add "vmklive autoinstaller" --omit systemd "/boot/initrd" $KERNELVERSION
  135. [ $? -ne 0 ] && die "Failed to generate the initramfs"
  136. mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
  137. cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz
  138. }
  139. cleanup_rootfs() {
  140. for f in ${INITRAMFS_PKGS}; do
  141. revdeps=$(xbps-query -r "$ROOTFS" -X $f)
  142. if [ -n "$revdeps" ]; then
  143. xbps-pkgdb -r "$ROOTFS" -m auto $f
  144. else
  145. xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
  146. fi
  147. done
  148. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01vmklive
  149. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01autoinstaller
  150. }
  151. generate_isolinux_boot() {
  152. cp -f "$SYSLINUX_DATADIR"/isolinux.bin "$ISOLINUX_DIR"
  153. cp -f "$SYSLINUX_DATADIR"/ldlinux.c32 "$ISOLINUX_DIR"
  154. cp -f "$SYSLINUX_DATADIR"/libcom32.c32 "$ISOLINUX_DIR"
  155. cp -f "$SYSLINUX_DATADIR"/vesamenu.c32 "$ISOLINUX_DIR"
  156. cp -f "$SYSLINUX_DATADIR"/libutil.c32 "$ISOLINUX_DIR"
  157. cp -f "$SYSLINUX_DATADIR"/chain.c32 "$ISOLINUX_DIR"
  158. cp -f isolinux/isolinux.cfg.in "$ISOLINUX_DIR"/isolinux.cfg
  159. cp -f ${SPLASH_IMAGE} "$ISOLINUX_DIR"
  160. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  161. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  162. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  163. -e "s|@@ARCH@@|$BASE_ARCH|" \
  164. -e "s|@@LOCALE@@|${LOCALE}|" \
  165. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  166. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  167. "$ISOLINUX_DIR"/isolinux.cfg
  168. }
  169. generate_grub_efi_boot() {
  170. cp -f grub/grub.cfg "$GRUB_DIR"
  171. cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
  172. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  173. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  174. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  175. -e "s|@@ARCH@@|$BASE_ARCH|" \
  176. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  177. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  178. -e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
  179. mkdir -p "$GRUB_DIR"/fonts
  180. cp -f "$GRUB_DATADIR"/unicode.pf2 "$GRUB_DIR"/fonts
  181. modprobe -q loop || :
  182. # Create EFI vfat image.
  183. truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
  184. mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
  185. GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)"
  186. LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
  187. mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
  188. cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR"
  189. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  190. --directory="/usr/lib/grub/i386-efi" \
  191. --format="i386-efi" \
  192. --output="/tmp/bootia32.efi" \
  193. "boot/grub/grub.cfg"
  194. if [ $? -ne 0 ]; then
  195. umount "$GRUB_EFI_TMPDIR"
  196. losetup --detach "${LOOP_DEVICE}"
  197. die "Failed to generate EFI loader"
  198. fi
  199. mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
  200. cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI
  201. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  202. --directory="/usr/lib/grub/x86_64-efi" \
  203. --format="x86_64-efi" \
  204. --output="/tmp/bootx64.efi" \
  205. "boot/grub/grub.cfg"
  206. if [ $? -ne 0 ]; then
  207. umount "$GRUB_EFI_TMPDIR"
  208. losetup --detach "${LOOP_DEVICE}"
  209. die "Failed to generate EFI loader"
  210. fi
  211. cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI
  212. umount "$GRUB_EFI_TMPDIR"
  213. losetup --detach "${LOOP_DEVICE}"
  214. rm -rf "$GRUB_EFI_TMPDIR"
  215. }
  216. generate_squashfs() {
  217. umount_pseudofs
  218. # Find out required size for the rootfs and create an ext3fs image off it.
  219. ROOTFS_SIZE=$(du --apparent-size -sm "$ROOTFS"|awk '{print $1}')
  220. mkdir -p "$BUILDDIR/tmp/LiveOS"
  221. truncate -s "$((ROOTFS_SIZE+ROOTFS_SIZE))M" \
  222. "$BUILDDIR"/tmp/LiveOS/ext3fs.img >/dev/null 2>&1
  223. mkdir -p "$BUILDDIR/tmp-rootfs"
  224. mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >/dev/null 2>&1
  225. mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs"
  226. cp -a "$ROOTFS"/* "$BUILDDIR"/tmp-rootfs/
  227. umount -f "$BUILDDIR/tmp-rootfs"
  228. mkdir -p "$IMAGEDIR/LiveOS"
  229. "$VOIDHOSTDIR"/usr/bin/mksquashfs "$BUILDDIR/tmp" "$IMAGEDIR/LiveOS/squashfs.img" \
  230. -comp "${SQUASHFS_COMPRESSION}" || die "Failed to generate squashfs image"
  231. chmod 444 "$IMAGEDIR/LiveOS/squashfs.img"
  232. # Remove rootfs and temporary dirs, we don't need them anymore.
  233. rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp"
  234. }
  235. generate_iso_image() {
  236. "$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \
  237. -iso-level 3 -rock -joliet \
  238. -max-iso9660-filenames -omit-period \
  239. -omit-version-number -relaxed-filenames -allow-lowercase \
  240. -volid "VOID_LIVE" \
  241. -eltorito-boot boot/isolinux/isolinux.bin \
  242. -eltorito-catalog boot/isolinux/boot.cat \
  243. -no-emul-boot -boot-load-size 4 -boot-info-table \
  244. -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
  245. -isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \
  246. -output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image"
  247. }
  248. #
  249. # main()
  250. #
  251. while getopts "a:b:r:c:C:T:Kk:l:i:I:s:S:o:p:v:h" opt; do
  252. case $opt in
  253. a) BASE_ARCH="$OPTARG";;
  254. b) BASE_SYSTEM_PKG="$OPTARG";;
  255. r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
  256. c) XBPS_CACHEDIR="$OPTARG";;
  257. K) readonly KEEP_BUILDDIR=1;;
  258. k) KEYMAP="$OPTARG";;
  259. l) LOCALE="$OPTARG";;
  260. i) INITRAMFS_COMPRESSION="$OPTARG";;
  261. I) INCLUDE_DIRECTORY="$OPTARG";;
  262. s) SQUASHFS_COMPRESSION="$OPTARG";;
  263. S) ROOTFS_FREESIZE="$OPTARG";;
  264. o) OUTPUT_FILE="$OPTARG";;
  265. p) PACKAGE_LIST="$OPTARG";;
  266. C) BOOT_CMDLINE="$OPTARG";;
  267. T) BOOT_TITLE="$OPTARG";;
  268. v) LINUX_VERSION="$OPTARG";;
  269. h) usage;;
  270. *) usage;;
  271. esac
  272. done
  273. shift $((OPTIND - 1))
  274. XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=http://alpha.de.repo.voidlinux.org/current --repository=http://alpha.de.repo.voidlinux.org/current/musl"
  275. # Configure dracut to use overlayfs for the writable overlay.
  276. BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
  277. ARCH=$(xbps-uhelper arch)
  278. # Set defaults
  279. : ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
  280. : ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}}
  281. : ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}}
  282. : ${KEYMAP:=us}
  283. : ${LOCALE:=en_US.UTF-8}
  284. : ${INITRAMFS_COMPRESSION:=xz}
  285. : ${SQUASHFS_COMPRESSION:=xz}
  286. : ${BASE_SYSTEM_PKG:=base-system}
  287. : ${BOOT_TITLE:="Void Linux"}
  288. # Required packages in the image for a working system.
  289. PACKAGE_LIST="$BASE_SYSTEM_PKG $PACKAGE_LIST"
  290. # Check for root permissions.
  291. if [ "$(id -u)" -ne 0 ]; then
  292. die "Must be run as root, exiting..."
  293. fi
  294. if [ -n "$ROOTDIR" ]; then
  295. BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
  296. else
  297. BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
  298. fi
  299. BUILDDIR=$(readlink -f "$BUILDDIR")
  300. IMAGEDIR="$BUILDDIR/image"
  301. ROOTFS="$IMAGEDIR/rootfs"
  302. VOIDHOSTDIR="$BUILDDIR/void-host"
  303. BOOT_DIR="$IMAGEDIR/boot"
  304. ISOLINUX_DIR="$BOOT_DIR/isolinux"
  305. GRUB_DIR="$BOOT_DIR/grub"
  306. ISOLINUX_CFG="$ISOLINUX_DIR/isolinux.cfg"
  307. CURRENT_STEP=0
  308. STEP_COUNT=9
  309. [ -n "${INCLUDE_DIRECTORY}" ] && STEP_COUNT=$((STEP_COUNT+1))
  310. : ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux}
  311. : ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
  312. : ${SPLASH_IMAGE:=data/splash.png}
  313. : ${XBPS_INSTALL_CMD:=xbps-install}
  314. : ${XBPS_REMOVE_CMD:=xbps-remove}
  315. : ${XBPS_QUERY_CMD:=xbps-query}
  316. : ${XBPS_RINDEX_CMD:=xbps-rindex}
  317. : ${XBPS_UHELPER_CMD:=xbps-uhelper}
  318. : ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
  319. mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR"
  320. print_step "Synchronizing XBPS repository data..."
  321. copy_void_keys "$ROOTFS"
  322. copy_void_keys "$VOIDHOSTDIR"
  323. XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
  324. XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
  325. # Get linux version for ISO
  326. # If linux version option specified use
  327. if [ -n "$LINUX_VERSION" ]; then
  328. if ! echo "$LINUX_VERSION" | grep "linux[0-9._]\+"; then
  329. die "-v option must be in format linux<version>"
  330. fi
  331. _linux_series="$LINUX_VERSION"
  332. PACKAGE_LIST="$PACKAGE_LIST $LINUX_VERSION"
  333. else # Otherwise find latest stable version from linux meta-package
  334. _linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux|head -1)
  335. fi
  336. _kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
  337. KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
  338. if [ "$?" -ne "0" ]; then
  339. die "Failed to find kernel package version"
  340. fi
  341. : ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date +%Y%m%d).iso"}
  342. print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
  343. install_prereqs
  344. mkdir -p "$ROOTFS"/etc
  345. [ -s data/motd ] && cp data/motd "$ROOTFS"/etc
  346. [ -s data/issue ] && cp data/issue "$ROOTFS"/etc
  347. print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
  348. install_packages
  349. if [ -n "${INCLUDE_DIRECTORY}" ];then
  350. print_step "Copying directory structure into the rootfs: ${INCLUDE_DIRECTORY} ..."
  351. copy_include_directory
  352. fi
  353. print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
  354. generate_initramfs
  355. print_step "Generating isolinux support for PC-BIOS systems..."
  356. generate_isolinux_boot
  357. print_step "Generating GRUB support for EFI systems..."
  358. generate_grub_efi_boot
  359. print_step "Cleaning up rootfs..."
  360. cleanup_rootfs
  361. print_step "Generating squashfs image ($SQUASHFS_COMPRESSION) from rootfs..."
  362. generate_squashfs
  363. print_step "Generating ISO image..."
  364. generate_iso_image
  365. hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
  366. info_msg "Created $(readlink -f "$OUTPUT_FILE") ($hsize) successfully."