mklive.sh.in 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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. # Cleanup and remove useless stuff.
  121. rm -rf "$ROOTFS"/var/cache/* "$ROOTFS"/run/* "$ROOTFS"/var/run/*
  122. }
  123. enable_services() {
  124. SERVICE_LIST="$*"
  125. for service in $SERVICE_LIST; do
  126. if ! [ -e $ROOTFS/etc/sv/$service ]; then
  127. die "service $service not in /etc/sv"
  128. fi
  129. ln -sf /etc/sv/$service $ROOTFS/etc/runit/runsvdir/default/
  130. done
  131. }
  132. copy_include_directories() {
  133. for includedir in "${INCLUDE_DIRS[@]}"; do
  134. info_msg "=> copying include directory '$includedir' ..."
  135. find "$includedir" -mindepth 1 -maxdepth 1 -exec cp -rfpPv {} "$ROOTFS"/ \;
  136. done
  137. }
  138. generate_initramfs() {
  139. local _args
  140. copy_dracut_files "$ROOTFS"
  141. copy_autoinstaller_files "$ROOTFS"
  142. chroot "$ROOTFS" env -i /usr/bin/dracut -N --"${INITRAMFS_COMPRESSION}" \
  143. --add-drivers "ahci" --force-add "vmklive autoinstaller" --omit systemd "/boot/initrd" $KERNELVERSION
  144. [ $? -ne 0 ] && die "Failed to generate the initramfs"
  145. mv "$ROOTFS"/boot/initrd "$BOOT_DIR"
  146. cp "$ROOTFS"/boot/vmlinuz-$KERNELVERSION "$BOOT_DIR"/vmlinuz
  147. }
  148. cleanup_rootfs() {
  149. for f in ${INITRAMFS_PKGS}; do
  150. revdeps=$(xbps-query -r "$ROOTFS" -X $f)
  151. if [ -n "$revdeps" ]; then
  152. xbps-pkgdb -r "$ROOTFS" -m auto $f
  153. else
  154. xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
  155. fi
  156. done
  157. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01vmklive
  158. rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01autoinstaller
  159. }
  160. generate_isolinux_boot() {
  161. cp -f "$SYSLINUX_DATADIR"/isolinux.bin "$ISOLINUX_DIR"
  162. cp -f "$SYSLINUX_DATADIR"/ldlinux.c32 "$ISOLINUX_DIR"
  163. cp -f "$SYSLINUX_DATADIR"/libcom32.c32 "$ISOLINUX_DIR"
  164. cp -f "$SYSLINUX_DATADIR"/vesamenu.c32 "$ISOLINUX_DIR"
  165. cp -f "$SYSLINUX_DATADIR"/libutil.c32 "$ISOLINUX_DIR"
  166. cp -f "$SYSLINUX_DATADIR"/chain.c32 "$ISOLINUX_DIR"
  167. cp -f isolinux/isolinux.cfg.in "$ISOLINUX_DIR"/isolinux.cfg
  168. cp -f ${SPLASH_IMAGE} "$ISOLINUX_DIR"
  169. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  170. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  171. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  172. -e "s|@@ARCH@@|$BASE_ARCH|" \
  173. -e "s|@@LOCALE@@|${LOCALE}|" \
  174. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  175. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  176. "$ISOLINUX_DIR"/isolinux.cfg
  177. }
  178. generate_grub_efi_boot() {
  179. cp -f grub/grub.cfg "$GRUB_DIR"
  180. cp -f grub/grub_void.cfg.in "$GRUB_DIR"/grub_void.cfg
  181. sed -i -e "s|@@SPLASHIMAGE@@|$(basename "${SPLASH_IMAGE}")|" \
  182. -e "s|@@KERNVER@@|${KERNELVERSION}|" \
  183. -e "s|@@KEYMAP@@|${KEYMAP}|" \
  184. -e "s|@@ARCH@@|$BASE_ARCH|" \
  185. -e "s|@@BOOT_TITLE@@|${BOOT_TITLE}|" \
  186. -e "s|@@BOOT_CMDLINE@@|${BOOT_CMDLINE}|" \
  187. -e "s|@@LOCALE@@|${LOCALE}|" "$GRUB_DIR"/grub_void.cfg
  188. mkdir -p "$GRUB_DIR"/fonts
  189. cp -f "$GRUB_DATADIR"/unicode.pf2 "$GRUB_DIR"/fonts
  190. modprobe -q loop || :
  191. # Create EFI vfat image.
  192. truncate -s 32M "$GRUB_DIR"/efiboot.img >/dev/null 2>&1
  193. mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
  194. GRUB_EFI_TMPDIR="$(mktemp --tmpdir="$HOME" -d)"
  195. LOOP_DEVICE="$(losetup --show --find "${GRUB_DIR}"/efiboot.img)"
  196. mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
  197. cp -a "$IMAGEDIR"/boot "$VOIDHOSTDIR"
  198. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  199. --directory="/usr/lib/grub/i386-efi" \
  200. --format="i386-efi" \
  201. --output="/tmp/bootia32.efi" \
  202. "boot/grub/grub.cfg"
  203. if [ $? -ne 0 ]; then
  204. umount "$GRUB_EFI_TMPDIR"
  205. losetup --detach "${LOOP_DEVICE}"
  206. die "Failed to generate EFI loader"
  207. fi
  208. mkdir -p "${GRUB_EFI_TMPDIR}"/EFI/BOOT
  209. cp -f "$VOIDHOSTDIR"/tmp/bootia32.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTIA32.EFI
  210. xbps-uchroot "$VOIDHOSTDIR" grub-mkstandalone -- \
  211. --directory="/usr/lib/grub/x86_64-efi" \
  212. --format="x86_64-efi" \
  213. --output="/tmp/bootx64.efi" \
  214. "boot/grub/grub.cfg"
  215. if [ $? -ne 0 ]; then
  216. umount "$GRUB_EFI_TMPDIR"
  217. losetup --detach "${LOOP_DEVICE}"
  218. die "Failed to generate EFI loader"
  219. fi
  220. cp -f "$VOIDHOSTDIR"/tmp/bootx64.efi "${GRUB_EFI_TMPDIR}"/EFI/BOOT/BOOTX64.EFI
  221. umount "$GRUB_EFI_TMPDIR"
  222. losetup --detach "${LOOP_DEVICE}"
  223. rm -rf "$GRUB_EFI_TMPDIR"
  224. }
  225. generate_squashfs() {
  226. umount_pseudofs
  227. # Find out required size for the rootfs and create an ext3fs image off it.
  228. ROOTFS_SIZE=$(du --apparent-size -sm "$ROOTFS"|awk '{print $1}')
  229. mkdir -p "$BUILDDIR/tmp/LiveOS"
  230. truncate -s "$((ROOTFS_SIZE+ROOTFS_SIZE))M" \
  231. "$BUILDDIR"/tmp/LiveOS/ext3fs.img >/dev/null 2>&1
  232. mkdir -p "$BUILDDIR/tmp-rootfs"
  233. mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >/dev/null 2>&1
  234. mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs"
  235. cp -a "$ROOTFS"/* "$BUILDDIR"/tmp-rootfs/
  236. umount -f "$BUILDDIR/tmp-rootfs"
  237. mkdir -p "$IMAGEDIR/LiveOS"
  238. "$VOIDHOSTDIR"/usr/bin/mksquashfs "$BUILDDIR/tmp" "$IMAGEDIR/LiveOS/squashfs.img" \
  239. -comp "${SQUASHFS_COMPRESSION}" || die "Failed to generate squashfs image"
  240. chmod 444 "$IMAGEDIR/LiveOS/squashfs.img"
  241. # Remove rootfs and temporary dirs, we don't need them anymore.
  242. rm -rf "$ROOTFS" "$BUILDDIR/tmp-rootfs" "$BUILDDIR/tmp"
  243. }
  244. generate_iso_image() {
  245. "$VOIDHOSTDIR"/usr/bin/xorriso -as mkisofs \
  246. -iso-level 3 -rock -joliet \
  247. -max-iso9660-filenames -omit-period \
  248. -omit-version-number -relaxed-filenames -allow-lowercase \
  249. -volid "VOID_LIVE" \
  250. -eltorito-boot boot/isolinux/isolinux.bin \
  251. -eltorito-catalog boot/isolinux/boot.cat \
  252. -no-emul-boot -boot-load-size 4 -boot-info-table \
  253. -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \
  254. -isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \
  255. -output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image"
  256. }
  257. #
  258. # main()
  259. #
  260. while getopts "a:b:r:c:C:T:Kk:l:i:I:S:s:o:p:v:h" opt; do
  261. case $opt in
  262. a) BASE_ARCH="$OPTARG";;
  263. b) BASE_SYSTEM_PKG="$OPTARG";;
  264. r) XBPS_REPOSITORY="--repository=$OPTARG $XBPS_REPOSITORY";;
  265. c) XBPS_CACHEDIR="$OPTARG";;
  266. K) readonly KEEP_BUILDDIR=1;;
  267. k) KEYMAP="$OPTARG";;
  268. l) LOCALE="$OPTARG";;
  269. i) INITRAMFS_COMPRESSION="$OPTARG";;
  270. I) INCLUDE_DIRS+=("$OPTARG");;
  271. S) SERVICE_LIST="$SERVICE_LIST $OPTARG";;
  272. s) SQUASHFS_COMPRESSION="$OPTARG";;
  273. o) OUTPUT_FILE="$OPTARG";;
  274. p) PACKAGE_LIST="$PACKAGE_LIST $OPTARG";;
  275. C) BOOT_CMDLINE="$OPTARG";;
  276. T) BOOT_TITLE="$OPTARG";;
  277. v) LINUX_VERSION="$OPTARG";;
  278. h) usage;;
  279. *) usage;;
  280. esac
  281. done
  282. shift $((OPTIND - 1))
  283. XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=https://repo-default.voidlinux.org/current --repository=https://repo-default.voidlinux.org/current/musl"
  284. # Configure dracut to use overlayfs for the writable overlay.
  285. BOOT_CMDLINE="$BOOT_CMDLINE rd.live.overlay.overlayfs=1 "
  286. ARCH=$(xbps-uhelper arch)
  287. # Set defaults
  288. : ${BASE_ARCH:=$(xbps-uhelper arch 2>/dev/null || uname -m)}
  289. : ${XBPS_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${BASE_ARCH}}
  290. : ${XBPS_HOST_CACHEDIR:="$(pwd -P)"/xbps-cachedir-${ARCH}}
  291. : ${KEYMAP:=us}
  292. : ${LOCALE:=en_US.UTF-8}
  293. : ${INITRAMFS_COMPRESSION:=xz}
  294. : ${SQUASHFS_COMPRESSION:=xz}
  295. : ${BASE_SYSTEM_PKG:=base-system}
  296. : ${BOOT_TITLE:="Void Linux"}
  297. case $BASE_ARCH in
  298. x86_64*|i686*) ;;
  299. *) >&2 echo architecture $BASE_ARCH not supported by mklive.sh; exit 1;;
  300. esac
  301. # Required packages in the image for a working system.
  302. PACKAGE_LIST="$BASE_SYSTEM_PKG $PACKAGE_LIST"
  303. # Check for root permissions.
  304. if [ "$(id -u)" -ne 0 ]; then
  305. die "Must be run as root, exiting..."
  306. fi
  307. if [ -n "$ROOTDIR" ]; then
  308. BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d)
  309. else
  310. BUILDDIR=$(mktemp --tmpdir="$(pwd -P)" -d)
  311. fi
  312. BUILDDIR=$(readlink -f "$BUILDDIR")
  313. IMAGEDIR="$BUILDDIR/image"
  314. ROOTFS="$IMAGEDIR/rootfs"
  315. VOIDHOSTDIR="$BUILDDIR/void-host"
  316. BOOT_DIR="$IMAGEDIR/boot"
  317. ISOLINUX_DIR="$BOOT_DIR/isolinux"
  318. GRUB_DIR="$BOOT_DIR/grub"
  319. CURRENT_STEP=0
  320. STEP_COUNT=10
  321. [ "${#INCLUDE_DIRS[@]}" -gt 0 ] && STEP_COUNT=$((STEP_COUNT+1))
  322. : ${SYSLINUX_DATADIR:="$VOIDHOSTDIR"/usr/lib/syslinux}
  323. : ${GRUB_DATADIR:="$VOIDHOSTDIR"/usr/share/grub}
  324. : ${SPLASH_IMAGE:=data/splash.png}
  325. : ${XBPS_INSTALL_CMD:=xbps-install}
  326. : ${XBPS_REMOVE_CMD:=xbps-remove}
  327. : ${XBPS_QUERY_CMD:=xbps-query}
  328. : ${XBPS_RINDEX_CMD:=xbps-rindex}
  329. : ${XBPS_UHELPER_CMD:=xbps-uhelper}
  330. : ${XBPS_RECONFIGURE_CMD:=xbps-reconfigure}
  331. mkdir -p "$ROOTFS" "$VOIDHOSTDIR" "$ISOLINUX_DIR" "$GRUB_DIR"
  332. print_step "Synchronizing XBPS repository data..."
  333. copy_void_keys "$ROOTFS"
  334. copy_void_keys "$VOIDHOSTDIR"
  335. XBPS_ARCH=$BASE_ARCH $XBPS_INSTALL_CMD -r "$ROOTFS" ${XBPS_REPOSITORY} -S
  336. XBPS_ARCH=$ARCH $XBPS_INSTALL_CMD -r "$VOIDHOSTDIR" ${XBPS_REPOSITORY} -S
  337. # Get linux version for ISO
  338. # If linux version option specified use
  339. if [ -n "$LINUX_VERSION" ]; then
  340. if ! echo "$LINUX_VERSION" | grep "linux[0-9._]\+"; then
  341. die "-v option must be in format linux<version>"
  342. fi
  343. _linux_series="$LINUX_VERSION"
  344. PACKAGE_LIST="$PACKAGE_LIST $LINUX_VERSION"
  345. else # Otherwise find latest stable version from linux meta-package
  346. _linux_series=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -x linux | grep 'linux[0-9._]\+')
  347. fi
  348. _kver=$(XBPS_ARCH=$BASE_ARCH $XBPS_QUERY_CMD -r "$ROOTFS" ${XBPS_REPOSITORY:=-R} -p pkgver ${_linux_series})
  349. KERNELVERSION=$($XBPS_UHELPER_CMD getpkgversion ${_kver})
  350. if [ "$?" -ne "0" ]; then
  351. die "Failed to find kernel package version"
  352. fi
  353. : ${OUTPUT_FILE="void-live-${BASE_ARCH}-${KERNELVERSION}-$(date -u +%Y%m%d).iso"}
  354. print_step "Installing software to generate the image: ${REQUIRED_PKGS} ..."
  355. install_prereqs
  356. mkdir -p "$ROOTFS"/etc
  357. [ -s data/motd ] && cp data/motd "$ROOTFS"/etc
  358. [ -s data/issue ] && cp data/issue "$ROOTFS"/etc
  359. print_step "Installing void pkgs into the rootfs: ${PACKAGE_LIST} ..."
  360. install_packages
  361. : ${DEFAULT_SERVICE_LIST:=agetty-tty1 agetty-tty2 agetty-tty3 agetty-tty4 agetty-tty5 agetty-tty6 udevd}
  362. print_step "Enabling services: ${SERVICE_LIST} ..."
  363. enable_services ${DEFAULT_SERVICE_LIST} ${SERVICE_LIST}
  364. if [ "${#INCLUDE_DIRS[@]}" -gt 0 ];then
  365. print_step "Copying directory structures into the rootfs ..."
  366. copy_include_directories
  367. fi
  368. print_step "Generating initramfs image ($INITRAMFS_COMPRESSION)..."
  369. generate_initramfs
  370. print_step "Generating isolinux support for PC-BIOS systems..."
  371. generate_isolinux_boot
  372. print_step "Generating GRUB support for EFI systems..."
  373. generate_grub_efi_boot
  374. print_step "Cleaning up rootfs..."
  375. cleanup_rootfs
  376. print_step "Generating squashfs image ($SQUASHFS_COMPRESSION) from rootfs..."
  377. generate_squashfs
  378. print_step "Generating ISO image..."
  379. generate_iso_image
  380. hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')
  381. info_msg "Created $(readlink -f "$OUTPUT_FILE") ($hsize) successfully."