about summary refs log tree commit diff
path: root/xvoidstrap
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-02-01 19:27:34 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-02-01 19:27:34 +0100
commitf6621318e7ab34999cfe310bd88b19bc1aa1518b (patch)
tree29ed8bde5104cc2b17839ba68916e4a330810fd4 /xvoidstrap
parente9c011077d578aeb0e1f2c85b566b2769ecee160 (diff)
downloadxtools-f6621318e7ab34999cfe310bd88b19bc1aa1518b.tar.gz
xtools-f6621318e7ab34999cfe310bd88b19bc1aa1518b.tar.xz
xtools-f6621318e7ab34999cfe310bd88b19bc1aa1518b.zip
add xvoidstrap v0.50
Diffstat (limited to 'xvoidstrap')
-rwxr-xr-xxvoidstrap55
1 files changed, 55 insertions, 0 deletions
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 <<EOF | tee ${CHROOT}/checklist
+Void post-install checklist
+- Set hostname: /etc/hostname
+- Configure fstab: /etc/fstab
+- Set locale: /etc/locale.conf and /etc/default/libc-locales
+- Rebuild locale: xbps-reconfigure -f glibc-locales
+- Install boot-loader: grub-install /dev/sda
+- Make dracut hostonly: echo hostonly=yes >/etc/dracut.conf.d/hostonly.conf
+- Rebuild initrd: xbps-reconfigure -f linux4.??
+EOF