#!/bin/sh -e # xvoidstrap DIR [PACKAGES...] - bootstrap a new Void installation # # (Setting XBPS_ARCH=x86_64-musl works.) fail() { printf '%s\n' "$1" >&2 exit 1 } if [ "$(id -u)" -ne 0 ]; then fail 'xvoidstrap needs to run as root' fi umask 0022 CHROOT=$1 shift [ -d "$CHROOT" ] || fail 'not a directory' [ -d "$CHROOT/bin" ] && fail 'directory contains /bin, bailing out' [ -d "$CHROOT/dev" ] && fail 'directory contains /dev, bailing out' [ -d "$CHROOT/etc" ] && fail 'directory contains /etc, bailing out' [ -d "$CHROOT/usr" ] && fail 'directory contains /usr, bailing out' chown root:root "$CHROOT" chmod 0755 "$CHROOT" mkdir -p "$CHROOT/boot" "$CHROOT/dev" mkdir -p -m 0555 "$CHROOT/proc" "$CHROOT/sys" if [ -d /var/db/xbps/keys ]; then mkdir -p "$CHROOT/var/db/xbps/keys" cp -a /var/db/xbps/keys/* "$CHROOT/var/db/xbps/keys" fi xbps-install \ -R ${XVOIDSTRAP_MIRROR:-https://repo-default.voidlinux.org/current} \ -R ${XVOIDSTRAP_MIRROR:-https://repo-default.voidlinux.org/current}/musl \ -R ${XVOIDSTRAP_MIRROR:-https://repo-default.voidlinux.org/current}/aarch64 \ -S -r "$CHROOT" \ ${@:-base-system lvm2 cryptsetup grub} printf '\n' cat </etc/dracut.conf.d/hostonly.conf - Rebuild initrd and grub config: xbps-reconfigure -f linux5.?? - Enable default services: ln -s /etc/sv/... /etc/runit/runsvdir/default/ EOF