From 12bf9c0625f05642ab95a2571bd8fe549f12be29 Mon Sep 17 00:00:00 2001 From: stenstorp Date: Tue, 30 Apr 2019 13:43:52 +0930 Subject: [PATCH 01/13] mkrootfs.sh.in: Actually implement the -b option --- mkrootfs.sh.in | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in index c0309ec..a7229bd 100644 --- a/mkrootfs.sh.in +++ b/mkrootfs.sh.in @@ -57,7 +57,7 @@ Supported architectures: i686, i686-musl, x86_64, x86_64-musl, Options - -b Set an alternative base-system package (defaults to base-system) + -b Set an alternative base-system package (defaults to base-voidstrap) -c Set XBPS cache directory (defaults to \$PWD/xbps-cachedir-) -C Full path to the XBPS configuration file -h Show this help @@ -72,10 +72,14 @@ _EOF # SCRIPT EXECUTION STARTS HERE # ######################################## +# Set the default system package. +SYSPKG="base-voidstrap" + # Boilerplate option parsing. This script supports the bare minimum # needed to build an image. -while getopts "C:c:hr:x:o:V" opt; do +while getopts "b:C:c:hr:x:o:V" opt; do case $opt in + b) SYSPKG="$OPTARG";; C) XBPS_CONFFILE="-C $OPTARG";; c) XBPS_CACHEDIR="--cachedir=$OPTARG";; h) usage; exit 0;; @@ -136,10 +140,10 @@ chmod 755 "$ROOTFS" mount_pseudofs # With everything setup, we can now run the install to load the -# base-voidstrap package into the rootfs. This will not produce a +# system package into the rootfs. This will not produce a # bootable system but will instead produce a base component that can # be quickly expanded to perform other actions on. -run_cmd_target "xbps-install -S $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY -r $ROOTFS -y base-voidstrap" +run_cmd_target "xbps-install -S $XBPS_CONFFILE $XBPS_CACHEDIR $XBPS_REPOSITORY -r $ROOTFS -y $SYSPKG" # Enable en_US.UTF-8 locale and generate it into the target ROOTFS. # This is a bit of a hack since some glibc stuff doesn't really work From 40dd7a4ede3f217947311dc5742a5f73d30000d4 Mon Sep 17 00:00:00 2001 From: stenstorp Date: Tue, 30 Apr 2019 13:09:01 +0930 Subject: [PATCH 02/13] mkrootfs.sh.in: Mention ppc-musl --- mkrootfs.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in index a7229bd..be3b7b1 100644 --- a/mkrootfs.sh.in +++ b/mkrootfs.sh.in @@ -53,7 +53,7 @@ Supported architectures: i686, i686-musl, x86_64, x86_64-musl, armv5tel, armv5tel-musl, armv6l, armv6l-musl, armv7l, armv7l-musl aarch64, aarch64-musl, mipsel, mipsel-musl - ppc + ppc, ppc-musl Options From b795f541a64f342e3252c48712d1207db91f8694 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 5 Jan 2019 04:10:01 +0100 Subject: [PATCH 03/13] mkrootfs: enable ppc64 + ppc-musl support Closes: #26 [via git-merge-pr] --- lib.sh.in | 12 ++++++++++++ mkrootfs.sh.in | 1 + 2 files changed, 13 insertions(+) diff --git a/lib.sh.in b/lib.sh.in index c5cc433..a108190 100644 --- a/lib.sh.in +++ b/lib.sh.in @@ -173,6 +173,18 @@ register_binfmt() { _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" QEMU_BIN=qemu-aarch64-static ;; + ppc64le*) + _cpu=ppc64le + _magic="\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00" + _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00" + QEMU_BIN=qemu-ppc64le-static + ;; + ppc64*) + _cpu=ppc64 + _magic="\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15" + _mask="\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" + QEMU_BIN=qemu-ppc64-static + ;; ppc*) _cpu=ppc _magic="\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14" diff --git a/mkrootfs.sh.in b/mkrootfs.sh.in index be3b7b1..93b9f94 100644 --- a/mkrootfs.sh.in +++ b/mkrootfs.sh.in @@ -54,6 +54,7 @@ Supported architectures: i686, i686-musl, x86_64, x86_64-musl, aarch64, aarch64-musl, mipsel, mipsel-musl ppc, ppc-musl + ppc64le, ppc64le-musl, ppc64, ppc64-musl Options From 7b6fdc6003b12f099d01eaa59adf077bae0d5daa Mon Sep 17 00:00:00 2001 From: Robert Lowry Date: Mon, 18 Feb 2019 16:10:06 -0600 Subject: [PATCH 04/13] installer.sh.in: clarify 'Network' source Closes: #45 [via git-merge-pr] --- installer.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh.in b/installer.sh.in index f9b311a..2e6e31c 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1342,7 +1342,7 @@ menu_source() { DIALOG --title " Select installation source " \ --menu "$MENULABEL" 8 70 0 \ "Local" "Packages from ISO image" \ - "Network" "Packages from official remote reposity" + "Network" "Base system only, downloaded from official reposity" case "$(cat $ANSWER)" in "Local") src="local";; "Network") src="net"; From 3b0177266d06b8ee099e58b4ae28554d8d5c86b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kalle=20M=C3=B8ller?= Date: Wed, 20 Mar 2019 14:28:40 +0100 Subject: [PATCH 05/13] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 42a6764..5877410 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,10 @@ This repository contains utilities for Void Linux: * mkrootfs (The Void Linux rootfs maker for ARM platforms) * mknet (Script to generate netboot tarballs for Void) -#### Dependencies +#### Build Dependencies + * make +#### Dependencies * xbps>=0.45 * qemu-user-static binaries (for mkrootfs) From 43fae882e94a48dfa5397ef5d4b3e61e769abbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kalle=20M=C3=B8ller?= Date: Wed, 20 Mar 2019 14:41:01 +0100 Subject: [PATCH 06/13] Added compressions Apparrently xz requires liblz4 Closes: #54 [via git-merge-pr] --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5877410..fb6c540 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ This repository contains utilities for Void Linux: * make #### Dependencies + * Compression type for the initramfs image + * liblz4 (for lz4, xz) (default) * xbps>=0.45 * qemu-user-static binaries (for mkrootfs) From cd127e832021838d3f18ab63993e4135ca582023 Mon Sep 17 00:00:00 2001 From: Noah Huppert Date: Thu, 28 Mar 2019 20:43:36 -0400 Subject: [PATCH 07/13] mklive: fixed -o option so it could take an absolute path Closes: #56 [via git-merge-pr] --- mklive.sh.in | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mklive.sh.in b/mklive.sh.in index c568e45..4dfd36a 100644 --- a/mklive.sh.in +++ b/mklive.sh.in @@ -287,7 +287,7 @@ generate_iso_image() { -no-emul-boot -boot-load-size 4 -boot-info-table \ -eltorito-alt-boot -e boot/grub/efiboot.img -isohybrid-gpt-basdat -no-emul-boot \ -isohybrid-mbr "$SYSLINUX_DATADIR"/isohdpfx.bin \ - -output "$CURDIR/$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image" + -output "$OUTPUT_FILE" "$IMAGEDIR" || die "Failed to generate ISO image" } # @@ -340,9 +340,6 @@ if [ "$(id -u)" -ne 0 ]; then die "Must be run as root, exiting..." fi -readonly CURDIR="$PWD" - - if [ -n "$ROOTDIR" ]; then BUILDDIR=$(mktemp --tmpdir="$ROOTDIR" -d) else @@ -417,7 +414,7 @@ generate_squashfs print_step "Generating ISO image..." generate_iso_image -hsize=$(du -sh "$CURDIR/$OUTPUT_FILE"|awk '{print $1}') -info_msg "Created $(readlink -f "$CURDIR"/"$OUTPUT_FILE") ($hsize) successfully." +hsize=$(du -sh "$OUTPUT_FILE"|awk '{print $1}') +info_msg "Created $(readlink -f "$OUTPUT_FILE") ($hsize) successfully." From 65f88c6d6fce152a02de690e922aaea141730d53 Mon Sep 17 00:00:00 2001 From: Urs Schulz Date: Wed, 2 May 2018 15:43:27 +0200 Subject: [PATCH 08/13] mkplatformfs.sh: error out without base tarball --- mkplatformfs.sh.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 9692bcd..546b5f5 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -143,6 +143,10 @@ ROOTFS=$(mktemp -d) || die "failed to create tempdir, exiting..." # Now that we have a directory for the ROOTFS, we can expand the # existing base filesystem into the directory +if [ ! -e "$BASE_TARBALL" ]; then + die "no valid base tarball given, exiting." +fi + info_msg "Expanding base tarball $BASE_TARBALL into $ROOTFS for $PLATFORM build." tar xf "$BASE_TARBALL" -C "$ROOTFS" From d3505ba860d05e1354362d45be470ddf7445f28a Mon Sep 17 00:00:00 2001 From: Urs Schulz Date: Wed, 2 May 2018 15:51:54 +0200 Subject: [PATCH 09/13] mkplatformfs.sh: add option to disable compression --- mkplatformfs.sh.in | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 546b5f5..553b068 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -61,6 +61,7 @@ Options -C Full path to the XBPS configuration file -r Set XBPS repository (may be set multiple times) -x Use threads to compress the image (dynamic if unset) + -n Do not compress the image, instead print out the rootfs directory -h Show this help -V Show version _EOF @@ -71,8 +72,9 @@ _EOF # ######################################## BASEPKG=base-system +COMPRESSION="y" -while getopts "b:p:k:c:C:r:x:hV" opt; do +while getopts "b:p:k:c:C:r:x:nhV" opt; do case $opt in b) BASEPKG="$OPTARG" ;; p) EXTRA_PKGS="$OPTARG" ;; @@ -81,6 +83,7 @@ while getopts "b:p:k:c:C:r:x:hV" opt; do C) XBPS_CONFFILE="-C $OPTARG" ;; r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG" ;; x) COMPRESSOR_THREADS="$OPTARG" ;; + n) COMPRESSION="n" ;; h) usage; exit 0 ;; V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0 ;; esac @@ -207,17 +210,23 @@ cleanup_chroot # only for it to be out of date, we remove it now. rm -rf "$ROOTFS/var/cache/*" 2>/dev/null -# Finally we can compress the tarball, the name will include the -# platform and the date on which the tarball was built. -tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz -run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball " +# Compress the tarball or just print out the path? +if [ "$COMPRESSION" = "y" ]; then + # Finally we can compress the tarball, the name will include the + # platform and the date on which the tarball was built. + tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz + run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball " -# Now that we have the tarball we don't need the rootfs anymore, so we -# can get rid of it. -rm -rf "$ROOTFS" + # Now that we have the tarball we don't need the rootfs anymore, so we + # can get rid of it. + rm -rf "$ROOTFS" -# Last thing to do before closing out is to let the user know that -# this succeeded. This also ensures that there's something visible -# that the user can look for at the end of the script, which can make -# it easier to see what's going on if something above failed. -info_msg "Successfully created $tarball ($PLATFORM)" + # Last thing to do before closing out is to let the user know that + # this succeeded. This also ensures that there's something visible + # that the user can look for at the end of the script, which can make + # it easier to see what's going on if something above failed. + info_msg "Successfully created $tarball ($PLATFORM)" +else + # User requested just printing out the path to the rootfs, here it comes. + info_msg "Successfully created rootfs under $ROOTFS" +fi From 86834e3ff74e49892bedece28927fd0b95a299b8 Mon Sep 17 00:00:00 2001 From: Urs Schulz Date: Wed, 2 May 2018 16:09:35 +0200 Subject: [PATCH 10/13] mkplatformfs.sh: fix -k option Closes: #64 [via git-merge-pr] --- mkplatformfs.sh.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 553b068..dfd860c 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -210,6 +210,14 @@ cleanup_chroot # only for it to be out of date, we remove it now. rm -rf "$ROOTFS/var/cache/*" 2>/dev/null +# Now we can run the POST_CMD script. This user-supplied script gets the +# $ROOTFS as a parameter. +if [ -n "$POST_CMD" ]; then + info_msg "Running user supllied command: $POST_CMD" + run_cmd $POST_CMD $ROOTFS +fi + + # Compress the tarball or just print out the path? if [ "$COMPRESSION" = "y" ]; then # Finally we can compress the tarball, the name will include the From 90cfccb9032faf34bbe5c8688b35108499f10e29 Mon Sep 17 00:00:00 2001 From: human Date: Sun, 28 Apr 2019 11:51:26 +0300 Subject: [PATCH 11/13] installer: better check for /bin/dialog this works on distros where /bin isn't a symlink to /usr/bin --- installer.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer.sh.in b/installer.sh.in index 2e6e31c..17ec46e 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1425,7 +1425,7 @@ menu() { esac } -if [ ! -x /bin/dialog ]; then +if ! command -v dialog >/dev/null; then echo "ERROR: missing dialog command, exiting..." exit 1 fi From aa50f22312798d94ad1f94a0d829831bf603ad3b Mon Sep 17 00:00:00 2001 From: human Date: Sun, 28 Apr 2019 14:26:27 +0300 Subject: [PATCH 12/13] installer: better timezone menu Closes: #65 [via git-merge-pr] --- installer.sh.in | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index 17ec46e..c007316 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -577,22 +577,22 @@ set_locale() { } menu_timezone() { - local _tzones="$(cd /usr/share/zoneinfo; find Africa/ America/ Antarctica/ Arctic/ Asia/ Atlantic/ Australia/ Europe/ Indian/ Pacific/ posix/ -type f | sort)" - local _TIMEZONES= + local areas=(Africa America Antarctica Arctic Asia Atlantic Australia Europe Indian Pacific) - for f in ${_tzones}; do - _TIMEZONES="${_TIMEZONES} ${f} -" - done - while true; do - DIALOG --title " Select your timezone " --menu "$MENULABEL" 14 70 14 ${_TIMEZONES} - if [ $? -eq 0 ]; then - set_option TIMEZONE "$(cat $ANSWER)" + local area locations location + while (IFS='|'; DIALOG ${area:+--default-item|"$area"} --title " Select area " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${areas[@]}")); do + area=$(cat $ANSWER) + read -a locations -d '\n' < <(find /usr/share/zoneinfo/$area -type f -printf '%P\n' | sort) + if (IFS='|'; DIALOG --title " Select location (${area}) " --menu "$MENULABEL" 19 51 19 $(printf '%s||' "${locations[@]//_/ }")); then + location=$(tr ' ' '_' < $ANSWER) + set_option TIMEZONE "$area/$location" TIMEZONE_DONE=1 - break + return 0 else - return + continue fi done + return 1 } set_timezone() { From 53b58fef3ff5fb0a40ff6be368ed1acfe87cb3e3 Mon Sep 17 00:00:00 2001 From: Cameron Nemo Date: Sun, 19 May 2019 18:21:56 -0700 Subject: [PATCH 13/13] Remove defunct systemd support Closes: #70 [via git-merge-pr] --- dracut/vmklive/copy-initramfs.sh | 9 --------- mklive.sh.in | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 dracut/vmklive/copy-initramfs.sh diff --git a/dracut/vmklive/copy-initramfs.sh b/dracut/vmklive/copy-initramfs.sh deleted file mode 100644 index ccb2178..0000000 --- a/dracut/vmklive/copy-initramfs.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- -# ex: ts=8 sw=4 sts=4 et filetype=sh - -# Copy the initramfs back to the new rootfs for proper shutdown. -KVER=$(uname -r) -if [ -x /usr/bin/systemctl ]; then - cp /run/initramfs/live/boot/initrd $NEWROOT/boot/initramfs-${KVER}.img -fi diff --git a/mklive.sh.in b/mklive.sh.in index 4dfd36a..a4dca79 100644 --- a/mklive.sh.in +++ b/mklive.sh.in @@ -155,13 +155,8 @@ generate_initramfs() { copy_dracut_files "$ROOTFS" copy_autoinstaller_files "$ROOTFS" - if [ "$BASE_SYSTEM_PKG" = "base-system-systemd" ]; then - _args="--add systemd" - else - _args="--omit systemd" - fi chroot "$ROOTFS" env -i /usr/bin/dracut -N --"${INITRAMFS_COMPRESSION}" \ - --add-drivers "ahci" --force-add "vmklive autoinstaller" ${_args} "/boot/initrd" $KERNELVERSION + --add-drivers "ahci" --force-add "vmklive autoinstaller" --omit systemd "/boot/initrd" $KERNELVERSION [ $? -ne 0 ] && die "Failed to generate the initramfs" mv "$ROOTFS"/boot/initrd "$BOOT_DIR"