From f6621318e7ab34999cfe310bd88b19bc1aa1518b Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 1 Feb 2018 19:27:34 +0100 Subject: add xvoidstrap --- xvoidstrap | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 xvoidstrap (limited to 'xvoidstrap') diff --git a/xvoidstrap b/xvoidstrap new file mode 100755 index 0000000..1be19df --- /dev/null +++ b/xvoidstrap @@ -0,0 +1,55 @@ +#!/bin/sh -e +# xvoidstrap DIR [PACKAGES...] - bootstrap a new Void installation +# +# (Setting XBPS_ARCH=x86_64-musl works.) + +fail() { + printf '%s\n' "$1" 1>&2 + exit 1 +} + +if [ "$(id -u)" -ne 0 ]; then + fail 'xvoidstrap needs to run as root' +fi + +umask 0022 + +case "$1" in + /*) CHROOT=$1; shift;; + *) fail 'no absolute chroot dir given';; +esac + +[ -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 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 https://repo.voidlinux.eu/current \ + -R https://repo.voidlinux.eu/current/musl \ + -S -r "$CHROOT" \ + ${@:-base-system lvm2 cryptsetup grub} + +printf '\n' +cat </etc/dracut.conf.d/hostonly.conf +- Rebuild initrd: xbps-reconfigure -f linux4.?? +EOF -- cgit 1.4.1