diff --git a/dracut/locale.sh b/dracut/locale.sh index c56cec0..bad138b 100644 --- a/dracut/locale.sh +++ b/dracut/locale.sh @@ -2,17 +2,11 @@ # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # ex: ts=8 sw=4 sts=4 et filetype=sh -# Regen locales if it's set in the kernel cmdline. - type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh LOCALE=$(getarg locale.LANG) [ -z "$LOCALE" ] && LOCALE="en_US.UTF-8" -# Create new user and remove password. We'll use autologin by default. -sed -e "s,^\#\($LOCALE.*\),\1," -i $NEWROOT/etc/default/libc-locales -chroot $NEWROOT xbps-reconfigure -f glibc-locales >/dev/null 2>&1 - # also enable this locale in newroot. echo "LANG=$LOCALE" > $NEWROOT/etc/locale.conf echo "LC_COLLATE=C" >> $NEWROOT/etc/locale.conf diff --git a/mklive.sh.in b/mklive.sh.in index e680eec..565af4d 100644 --- a/mklive.sh.in +++ b/mklive.sh.in @@ -71,11 +71,19 @@ write_conf_file() { # Default configuration file for vmklive-@VERSION@. # # List of packages to be installed into the live image. -# By default the 'base-system-live' pkg is always installed because -# it is required to generate a working image. -#PACKAGE_LIST="foo blah" +# +# The 'base-system' package is always added to the generated image. +# +# To build an official live image add the following packages: +# - dialog +# - dracut-network +# - dosfstools +# - f2fs-tools +# - grub-x86_64-efi +# - parted +PACKAGE_LIST="dialog dracut-network dosfstools f2fs-tools grub-x86_64-efi parted" -# Syslinux splash image. +# Default Void Linux splash image for grub/syslinux. SPLASH_IMAGE=/usr/share/void-artwork/splash.png # Default keymap to use. @@ -105,11 +113,8 @@ Usage: $(basename $0) [options] Options: -C file Path to configuration file (defaults to ~/.mklive.conf) - -c (gzip|bzip2|xz) Compression type for the squashfs/initramfs image. - -l "pkgname ..." Generate a local repository in the image with these packages. - Packages must be delimited by blanks. - -r rootdir Use this directory to generate the image (if unset, - current working directory will be used). + -c (gzip|bzip2|xz) Compression type for the initramfs/squashfs image. + -r rootdir Use this directory to generate the image (if unset, defaults to cwd). -o outfile Output file name for the ISO image. -s splash Splash image file for isolinux. -V Show version. @@ -130,7 +135,10 @@ install_packages() { ${XBPS_INSTALL_CMD} ${XBPS_ARGS} ${PACKAGE_LIST} >>$LOGFILE 2>&1 ${XBPS_INSTALL_CMD} ${XBPS_ARGS} -u >>$LOGFILE 2>&1 ${XBPS_REMOVE_CMD} ${XBPS_ARGS} -o >>$LOGFILE 2>&1 - ${XBPS_QUERY_CMD} -r "$ROOTFS" -l > "${OUTPUT_FILE%.iso}"-package-list.txt + ${XBPS_QUERY_CMD} -r "$ROOTFS" -l | sort > "${OUTPUT_FILE%.iso}"-package-list.txt + + # Enable choosen UTF-8 locale and generate it into the target rootfs. + sed -e "s/\#\(${LOCALE}.*\)/\1/g" -i $ROOTFS/etc/default/libc-locales systemd-nspawn -D $ROOTFS xbps-reconfigure -fa >>$LOGFILE 2>&1 @@ -152,32 +160,10 @@ generate_initramfs() { --force-add "vmklive" "/boot/initrd.lz" $KERNELVERSION >>$LOGFILE 2>&1 mv $ROOTFS/kernel_temp/boot/initrd.lz $BOOT_DIR -} - -copy_kernel_and_modules() { - cp -a $ROOTFS/kernel_temp/boot/vmlinuz-$KERNELVERSION $BOOT_DIR/vmlinuz - # Copy kernel modules to the rootfs. - mkdir -p $ROOTFS/usr/lib/modules - cp -a $ROOTFS/kernel_temp/usr/lib/modules/$KERNELVERSION \ - $ROOTFS/usr/lib/modules - # remove temporary rootfs. + cp $ROOTFS/kernel_temp/boot/vmlinuz-$KERNELVERSION $BOOT_DIR/vmlinuz rm -rf $ROOTFS/kernel_temp } -generate_local_repository() { - mkdir -p $ROOTFS/packages - pkgs=$($XBPS_INSTALL_CMD -r /tmp/blah -n ${LOCALREPO_PKGLIST}) - set -- ${pkgs} - while [ $# -ne 0 ]; do - pkg=$1; action=$2; arch=$3; repo=$4; - shift 4 - bpkg=${repo}/${pkg}.${arch}.xbps - cp -f $bpkg $ROOTFS/packages - done - LD_LIBRARY_PATH="$ROOTFS/usr/lib" \ - $ROOTFS/usr/sbin/$XBPS_RINDEX_CMD -a $ROOTFS/packages/*.xbps 2>&1 >>$LOGFILE -} - generate_isolinux_boot() { cp -f $SYSLINUX_DATADIR/isolinux.bin "$ISOLINUX_DIR" cp -f $SYSLINUX_DATADIR/ldlinux.c32 "$ISOLINUX_DIR" @@ -266,11 +252,10 @@ generate_iso_image() { # # main() # -while getopts "C:c:l:o:r:s:hV" opt; do +while getopts "C:c:o:r:s:hV" opt; do case $opt in C) CONFIG_FILE="$OPTARG";; c) COMPRESSTYPE="$OPTARG";; - l) LOCALREPO_PKGLIST="$OPTARG";; o) OUTPUT_FILE="$OPTARG";; r) ROOTDIR="$OPTARG";; s) SPLASH_IMAGE="$OPTARG";; @@ -332,9 +317,9 @@ fi . $CONFIG_FILE if [ -z "$PACKAGE_LIST" ]; then - PACKAGE_LIST="base-system-live" + PACKAGE_LIST="base-system" else - PACKAGE_LIST="$PACKAGE_LIST" + PACKAGE_LIST="base-system $PACKAGE_LIST" fi if [ ! -f $SYSLINUX_DATADIR/isolinux.bin ]; then echo "Missing required isolinux files in $SYSLINUX_DATADIR, exiting..." @@ -393,7 +378,7 @@ info_msg "Redirecting stdout/stderr to $LOGFILE ..." # # Install live system and specified packages. # -info_msg "[1/9] Installing packages into the rootfs..." +info_msg "[1/7] Installing packages into the rootfs..." install_packages # @@ -405,50 +390,34 @@ write_etc_motd # # Generate the initramfs. # -info_msg "[2/9] Generating initramfs image ($COMPRESSTYPE)..." +info_msg "[2/7] Generating initramfs image ($COMPRESSTYPE)..." generate_initramfs -# -# Copy linux kernel and modules to rootfs. -# -info_msg "[3/9] Copying kernel image/modules from temporary rootfs..." -copy_kernel_and_modules - -# -# Generate the package local repository for void-installer. -# -if [ -z "$LOCALREPO_PKGLIST" ]; then - _skip="(disabled)" -fi -info_msg "[4/9] Generating package local repository ${_skip}..." -if [ -n "$LOCALREPO_PKGLIST" ]; then - generate_local_repository -fi # # Generate the isolinux boot. # -info_msg "[5/9] Generating isolinux support for PC-BIOS systems..." +info_msg "[3/7] Generating isolinux support for PC-BIOS systems..." generate_isolinux_boot # # Generate the GRUB EFI boot. # -info_msg "[6/9] Generating GRUB support for EFI systems..." +info_msg "[4/7] Generating GRUB support for EFI systems..." generate_grub_efi_boot # # Generate the squashfs image from rootfs. # -info_msg "[7/9] Generating squashfs image ($COMPRESSTYPE) from rootfs..." +info_msg "[5/7] Generating squashfs image ($COMPRESSTYPE) from rootfs..." generate_squashfs # # Generate the ISO image. # -info_msg "[8/9] Generating ISO image..." +info_msg "[6/7] Generating ISO image..." generate_iso_image -info_msg "[9/9] Removing build directory..." +info_msg "[7/7] Removing build directory..." rm -rf "$BUILDDIR" hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}')