about summary refs log tree commit diff
path: root/xvoidstrap
blob: f43ac118b2f48e320e39d2d84d9cac4d8cdfa8af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/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 -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://alpha.de.repo.voidlinux.org/current} \
	-R ${XVOIDSTRAP_MIRROR:-https://alpha.de.repo.voidlinux.org/current}/musl \
	-S -r "$CHROOT" \
	${@:-base-system lvm2 cryptsetup grub}

printf '\n'
cat <<EOF | tee ${CHROOT}/checklist
Void post-install checklist
- Set root password: passwd
- Set root shell: chsh
- Set hostname: /etc/hostname
- Set time zone: ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
- 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
- Adjust kernel command-line in /etc/default/grub:
  printk.time=1 loglevel=6 net.ifnames=0 psi=1
- Make dracut hostonly: echo hostonly=yes >/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