mklive.sh.in 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. #!/bin/bash
  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. declare -a INCLUDE_DIRS=()
  35. info_msg() {
  36. printf "\033[1m$@\n\033[m"
  37. }
  38. die() {
  39. info_msg "ERROR: $@"
  40. error_out 1 $LINENO
  41. }
  42. print_step() {
  43. CURRENT_STEP=$((CURRENT_STEP+1))
  44. info_msg "[${CURRENT_STEP}/${STEP_COUNT}] $@"
  45. }
  46. mount_pseudofs() {
  47. for f in sys dev proc; do
  48. mkdir -p "$ROOTFS"/$f
  49. mount --rbind /$f "$ROOTFS"/$f
  50. done
  51. }
  52. umount_pseudofs() {
  53. umount -R -f "$ROOTFS"/sys >/dev/null 2>&1
  54. umount -R -f "$ROOTFS"/dev >/dev/null 2>&1
  55. umount -R -f "$ROOTFS"/proc >/dev/null 2>&1
  56. }
  57. error_out() {
  58. umount_pseudofs
  59. [ -d "$BUILDDIR" -a -z "$KEEP_BUILDDIR" ] && rm -rf "$BUILDDIR"
  60. exit "${1:=0}"
  61. }
  62. usage() {
  63. cat <<_EOF
  64. Usage: $PROGNAME [options]
  65. Options:
  66. -a <xbps-arch> Set XBPS_ARCH (do not use it unless you know what it is)
  67. -b <system-pkg> Set an alternative base-system package (defaults to base-system).
  68. -r <repo-url> Use this XBPS repository (may be specified multiple times).
  69. -c <cachedir> Use this XBPS cache directory (a subdirectory of current
  70. directory if unset).
  71. -k <keymap> Default keymap to use (us if unset)
  72. -l <locale> Default locale to use (en_US.UTF-8 if unset).
  73. -i <lz4|gzip|bzip2|xz> Compression type for the initramfs image (xz if unset).
  74. -s <gzip|lzo|xz> Compression type for the squashfs image (xz if unset)
  75. -o <file> Output file name for the ISO image (auto if unset).
  76. -p "pkg pkgN ..." Install additional packages into the ISO image.
  77. -I <includedir> Include directory structure under given path into rootfs
  78. -S "service serviceN ..." Services to enable
  79. -C "cmdline args" Add additional kernel command line arguments.
  80. -T "title" Modify the bootloader title.
  81. -v linux<version> Install a custom Linux version on ISO image (linux meta-package if unset).
  82. -K Do not remove builddir.
  83. The $PROGNAME script generates a live image of the Void Linux distribution.
  84. This ISO image can be written to a CD/DVD-ROM or any USB stick.
  85. _EOF
  86. exit 1
  87. }
  88. copy_void_keys() {
  89. mkdir -p "$1"/var/db/xbps/keys
  90. cp keys/*.plist "$1"/var/db/xbps/keys
  91. }
  92. copy_dracut_files() {
  93. mkdir -p "$1"/usr/lib/dracut/modules.d/01vmklive
  94. cp dracut/vmklive/* "$1"/usr/lib/dracut/modules.d/01vmklive/
  95. }
  96. copy_autoinstaller_files() {
  97. mkdir -p "$1"/usr/lib/dracut/modules.d/01autoinstaller
  98. cp dracut/autoinstaller/* "$1"/usr/lib/dracut/modules.d/01autoinstaller/
  99. }
  100. install_prereqs() {
  101. XBPS_ARCH=$ARCH "$XBPS_INSTALL_CMD" -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} \
  102. -c "$XBPS_HOST_CACHEDIR" -y $REQUIRED_PKGS
  103. [ $? -ne 0 ] && die "Failed to install required software, exiting..."
  104. }
  105. install_packages() {
  106. XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -r "$ROOTFS" \
  107. ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -yn $PACKAGE_LIST $INITRAMFS_PKGS
  108. [ $? -ne 0 ] && die "Missing required binary packages, exiting..."
  109. mount_pseudofs
  110. LANG=C XBPS_ARCH=$BASE_ARCH "${XBPS_INSTALL_CMD}" -U -r "$ROOTFS" \
  111. ${XBPS_REPOSITORY} -c "$XBPS_CACHEDIR" -y $PACKAGE_LIST $INITRAMFS_PKGS
  112. [ $? -ne 0 ] && die "Failed to install $PACKAGE_LIST"
  113. xbps-reconfigure -r "$ROOTFS" -f base-files >/dev/null 2>&1
  114. chroot "$ROOTFS" env -i xbps-reconfigure -f base-files
  115. # Enable choosen UTF-8 locale and generate it into the target rootfs.
  116. if [ -f "$ROOTFS"/etc/default/libc-locales ]; then
  117. sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i "$ROOTFS"/etc/default/libc-locales
  118. fi
  119. chroot "$ROOTFS" env -i xbps-reconfigure -a
  120. install -Dm755 installer.sh "$ROOTFS"/usr/sbin/void-installer
  121. # Cleanup and remove useless stuff.
  122. rm -rf "$ROOTFS"/var/cache/* "$ROOTFS"/run/* "$ROOTFS"/var/run/*
  123. }
  124. enable_services() {
  125. SERVICE_LIST="$*"
  126. for service in $SERVICE_LIST; do
  127. if ! [ -e $ROOTFS/etc/sv/$service ]; then
  128. die "service $service not in /etc/sv"
  129. fi
  130. ln -sf /etc/sv/$service $ROOTFS/etc/runit/runsvdir/default/
  131. done
  132. }
  133. copy_include_directories() {
  134. for includedir in "${INCLUDE_DIRS[@]}"; do
  135. info_msg "=> copying include directory '$includedir' ..."
  136. find "$includedir" -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} "$ROOTFS"/ \;
  137. done
  138. }
  139. generate_initramfs() {
  140. local _args
  141. copy_dracut_files "$ROOTFS"
  142. copy_autoinstaller_files "$ROOTFS"
  143. chroot "$ROOTFS" env -i /usr/bin/dracut -N --"${INITRAMFS_COMPRESSION}" \
  144. --add-drivers "ahci" --force-add "vmklive autoinstaller" --omit systemd "/boot/initrd" $KERNELVERSION
  145. [ $? -ne 0 ] && die "Failed to generate the initramfs"
  146. mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
  147. cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz
  148. }
  149. cleanup_rootfs() {
  150. for f in ${INITRAMFS_PKGS}; do
  151. revdeps=$(xbps-query -r "$ROOTFS" -X $f)
  152. if [ -n "$revdeps" ]; then
  153. xbps-pkgdb -r "$ROOTFS" -m auto $f
  154. else
  155. xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
  156. fi
  157. done
  158. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01vmklive
  159. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01autoinstaller
  160. }
  161. generate_isolinux_boot() {
  162. cp -f "$SYSLINUX_DATADIR"/isolinux.bin "$ISOLINUX_DIR"
  163. cp -f "$SYSLINUX_DATADIR"/ldlinux.c32 "$ISOLINUX_DIR"
  164. cp -f "$SYSLINUX_DATADIR"/libcom32.c32 "$ISOLINUX_DIR"
  165. cp -f "$SYSLINUX_DATADIR"/vesamenu.c32 "$ISOLINUX_DIR"
  166. cp -f "$SYSLINUX_DATADIR"/libutil.c32 "$ISOLINUX_DIR"
  167. cp -f "$SYSLINUX_DATADIR"/chain.c32 "$ISOLINUX_DIR"
  168. cp -f isolinux/isolinux.cfg.in "$ISOLINUX_DIR"/isolinux.cfg
  169. cp -f ${SPLASH_IMAGE} "$ISOLINUX_DIR"
  170. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  171. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  172. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  173. -e "s|@@ARCH@@|$BASE_ARCH|" \
  174. -e "s|@@LOCALE@@|${LOCALE}|" \
  175. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  176. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  177. "$ISOLINUX_DIR"/isolinux.cfg
  178. }
  179. generate_grub_efi_boot() {
  180. cp -f grub/grub.cfg "$GRUB_DIR"
  181. cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
  182. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  183. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  184. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  185. -e "s|@@ARCH@@|$BASE_ARCH|" \
  186. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  187. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  188. -e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
  189. mkdir -p "$GRUB_DIR"/fonts
  190. cp -f "$GRUB_DATADIR"/unicode.pf2 "$GRUB_DIR"/fonts
  191. modprobe -q loop || :
  192. # Create EFI vfat image.
  193. truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
  194. mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
  195. GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)"
  196. LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
  197. mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
  198. cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR"
  199. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  200. --directory="/usr/lib/grub/i386-efi" \
  201. --format="i386-efi" \
  202. --output="/tmp/bootia32.efi" \
  203. "boot/grub/grub.cfg"
  204. if [ $? -ne 0 ]; then
  205. umount "$GRUB_EFI_TMPDIR"
  206. losetup --detach "${LOOP_DEVICE}"
  207. die "Failed to generate EFI loader"
  208. fi
  209. mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
  210. cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI
  211. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  212. --directory="/usr/lib/grub/x86_64-efi" \
  213. --format="x86_64-efi" \
  214. --output="/tmp/bootx64.efi" \
  215. "boot/grub/grub.cfg"
  216. if [ $? -ne 0 ]; then
  217. umount "$GRUB_EFI_TMPDIR"
  218. losetup --detach "${LOOP_DEVICE}"
  219. die "Failed to generate EFI loader"
  220. fi
  221. cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI
  222. umount "$GRUB_EFI_TMPDIR"
  223. losetup --detach "${LOOP_DEVICE}"
  224. rm -rf "$GRUB_EFI_TMPDIR"
  225. }
  226. generate_squashfs() {
  227. umount_pseudofs
  228. # Find out required size for the rootfs and create an ext3fs image off it.
  229. ROOTFS_SIZE=$(du --apparent-size -sm "$ROOTFS"|awk '{print $1}')
  230. mkdir -p "$BUILDDIR/tmp/LiveOS"
  231. truncate -s "$((ROOTFS_SIZE+ROOTFS_SIZE))M" \
  232. "$BUILDDIR"/tmp/LiveOS/ext3fs.img >/dev/null 2>&1
  233. mkdir -p "$BUILDDIR/tmp-rootfs"
  234. mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >/dev/null 2>&1
  235. mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs"
  236. cp -a "$ROOTFS"/* "$BUILDDIR"/tmp-rootfs/
  237. umount -f "$BUILDDIR/tmp-rootfs"
  238. mkdir -p "$IMAGEDIR/LiveOS"
  239. "$VOIDHOSTDIR"/usr/bin/mksquashfs "$BUILDDIR/tmp" "$IMAGEDIR/LiveOS/squashfs.img" \
  240. -comp "${SQUASHFS_COMPRESSION}" || die "Failed to generate squashfs image"
  241. chmod 444 "$IMAGEDIR/LiveOS/squashfs.img"
  242. # Remove rootfs and temporary dirs, we don't need them anymore.
  243. rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp"
  244. }
  245. generate_iso_image() {
  246. "$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \
  247. -iso-level 3 -rock -joliet \
  248. -max-iso9660-filenames -omit-period \
  249. -omit-version-number -relaxed-filenames -allow-lowercase \
  250. -volid "VOID_LIVE" \
  251. -eltorito-boot boot/isolinux/isolinux.bin \
  252. -eltorito-catalog boot/isolinux/boot.cat \
  253. -no-emul-boot -boot-load-size 4 -boot-info-table \
  254. -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
  255. -isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \
  256. -output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image"
  257. }
  258. #
  259. # main()
  260. #
  261. while getopts "a:b:r:c:C:T:Kk:l:i:I:S:s:o:p:v:h" opt; do
  262. case $opt in
  263. a) BASE_ARCH="$OPTARG";;
  264. b) BASE_SYSTEM_PKG="$OPTARG";;
  265. r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
  266. c) XBPS_CACHEDIR="$OPTARG";;
  267. K) readonly KEEP_BUILDDIR=1;;
  268. k) KEYMAP="$OPTARG";;
  269. l) LOCALE="$OPTARG";;
  270. i) INITRAMFS_COMPRESSION="$OPTARG";;
  271. I) INCLUDE_DIRS+=("$OPTARG");;
  272. S) SERVICE_LIST="$SERVICE_LIST $OPTARG";;
  273. s) SQUASHFS_COMPRESSION="$OPTARG";;
  274. o) OUTPUT_FILE="$OPTARG";;
  275. p) PACKAGE_LIST="$PACKAGE_LIST $OPTARG";;
  276. C) BOOT_CMDLINE="$OPTARG";;
  277. T) BOOT_TITLE="$OPTARG";;
  278. v) LINUX_VERSION="$OPTARG";;
  279. h) usage;;
  280. *) usage;;
  281. esac
  282. done
  283. shift $((OPTIND - 1))
  284. XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl"
  285. # Configure dracut to use overlayfs for the writable overlay.
  286. BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
  287. ARCH=$(xbps-uhelper arch)
  288. # Set defaults
  289. : ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
  290. : ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}}
  291. : ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}}
  292. : ${KEYMAP:=us}
  293. : ${LOCALE:=en_US.UTF-8}
  294. : ${INITRAMFS_COMPRESSION:=xz}
  295. : ${SQUASHFS_COMPRESSION:=xz}
  296. : ${BASE_SYSTEM_PKG:=base-system}
  297. : ${BOOT_TITLE:="Void Linux"}
  298. case $BASE_ARCH in
  299. x86_64*|i686*) ;;
  300. *) >&2 echo architecture $BASE_ARCH not supported by mklive.sh; exit 1;;
  301. esac
  302. # Required packages in the image for a working system.
  303. PACKAGE_LIST="$BASE_SYSTEM_PKG $PACKAGE_LIST"
  304. # Check for root permissions.
  305. if [ "$(id -u)" -ne 0 ]; then
  306. die "Must be run as root, exiting..."
  307. fi
  308. if [ -n "$ROOTDIR" ]; then
  309. BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
  310. else
  311. BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
  312. fi
  313. BUILDDIR=$(readlink -f "$BUILDDIR")
  314. IMAGEDIR="$BUILDDIR/image"
  315. ROOTFS="$IMAGEDIR/rootfs"
  316. VOIDHOSTDIR="$BUILDDIR/void-host"
  317. BOOT_DIR="$IMAGEDIR/boot"
  318. ISOLINUX_DIR="$BOOT_DIR/isolinux"
  319. GRUB_DIR="$BOOT_DIR/grub"
  320. CURRENT_STEP=0
  321. STEP_COUNT=10
  322. [ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
  323. : ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux}
  324. : ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
  325. : ${SPLASH_IMAGE:=data/splash.png}
  326. : ${XBPS_INSTALL_CMD:=xbps-install}
  327. : ${XBPS_REMOVE_CMD:=xbps-remove}
  328. : ${XBPS_QUERY_CMD:=xbps-query}
  329. : ${XBPS_RINDEX_CMD:=xbps-rindex}
  330. : ${XBPS_UHELPER_CMD:=xbps-uhelper}
  331. : ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
  332. mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR"
  333. print_step "Synchronizing XBPS repository data..."
  334. copy_void_keys "$ROOTFS"
  335. copy_void_keys "$VOIDHOSTDIR"
  336. XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
  337. XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
  338. # Get linux version for ISO
  339. # If linux version option specified use
  340. if [ -n "$LINUX_VERSION" ]; then
  341. if ! echo "$LINUX_VERSION" | grep "linux[0-9._]\+"; then
  342. die "-v option must be in format linux<version>"
  343. fi
  344. _linux_series="$LINUX_VERSION"
  345. PACKAGE_LIST="$PACKAGE_LIST $LINUX_VERSION"
  346. else # Otherwise find latest stable version from linux meta-package
  347. _linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')
  348. fi
  349. _kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
  350. KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
  351. if [ "$?" -ne "0" ]; then
  352. die "Failed to find kernel package version"
  353. fi
  354. : ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"}
  355. print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
  356. install_prereqs
  357. mkdir -p "$ROOTFS"/etc
  358. [ -s data/motd ] && cp data/motd "$ROOTFS"/etc
  359. [ -s data/issue ] && cp data/issue "$ROOTFS"/etc
  360. print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
  361. install_packages
  362. : ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd}
  363. print_step "Enabling services: ${SERVICE_LIST} ..."
  364. enable_services ${DEFAULT_SERVICE_LIST} ${SERVICE_LIST}
  365. if [ "${#INCLUDE_DIRS[@]}" -gt 0 ];then
  366. print_step "Copying directory structures into the rootfs ..."
  367. copy_include_directories
  368. fi
  369. print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
  370. generate_initramfs
  371. print_step "Generating isolinux support for PC-BIOS systems..."
  372. generate_isolinux_boot
  373. print_step "Generating GRUB support for EFI systems..."
  374. generate_grub_efi_boot
  375. print_step "Cleaning up rootfs..."
  376. cleanup_rootfs
  377. print_step "Generating squashfs image ($SQUASHFS_COMPRESSION) from rootfs..."
  378. generate_squashfs
  379. print_step "Generating ISO image..."
  380. generate_iso_image
  381. hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
  382. info_msg "Created $(readlink -f "$OUTPUT_FILE") ($hsize) successfully."