Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh -e
- k=5.0
- p="e2fsprogs"
- # --- #
- die()
- {
- echo "error: $@" 1>&2
- exit 1
- }
- info()
- {
- echo 1>&2
- echo "===> $@" 1>&2
- }
- # --- #
- [ "$(id -u)" = 0 ] || die "must be superuser"
- mountpoint -q /mnt || die "/mnt is not a mountpoint"
- # --- #
- echo "===> gbsn's void-install 1.0 <==="
- echo
- echo "ENTER to install into /mnt or ^C to cancel"
- read x
- info "Setting up mountpoints"
- for dir in dev proc sys
- do
- mkdir -p /mnt/${dir}
- mount -B /${dir} /mnt/${dir}
- done
- info "Copying XBPS config"
- mkdir -p /mnt/usr/share
- cp -r /usr/share/xbps.d /mnt/usr/share
- mkdir -p /mnt/var/db/xbps/keys
- cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys
- info "Installing base packages"
- alias xi="xbps-install -r /mnt"
- xi -S
- xi -yU base-files xbps syslinux busybox util-linux kmod runit-void eudev mkinitcpio mkinitcpio-udev findutils grep
- info "Applying fixes"
- sed -i 's@mktemp -d --tmpdir@mktemp -d -p /tmp@' /mnt/usr/lib/initcpio/functions
- for f in $(/mnt/usr/bin/busybox --list)
- do
- ln -s busybox /mnt/usr/bin/$f || :
- done
- info "Installing kernel"
- xi -yU linux${k} linux-firmware-amd linux-firmware-intel linux-firmware-network
- if [ -n "${p}" ]
- then
- info "Installing extra packages"
- xi -yU ${p}
- fi
- info "Configuring packages"
- xbps-reconfigure -r /mnt base-files
- chroot /mnt xbps-reconfigure -a
- info "Configuring bootloader"
- mkdir -p /mnt/boot/extlinux
- chroot /mnt extlinux -i /boot/extlinux
- dev="$(findmnt -o SOURCE /mnt | sed 1d)"
- uuid="$(lsblk -o UUID "${dev}" | sed 1d)"
- dev="/dev/$(lsblk -o PKNAME "${dev}" | sed 1d)"
- dd if=/mnt/usr/lib/syslinux of="${dev}"
- cat > /mnt/boot/extlinux/extlinux.conf << EOF
- DEFAULT void
- LABEL void
- LINUX /$(cd /mnt/boot && echo vmlinuz*)
- INITRD /$(cd /mnt/boot && echo initramfs*)
- APPEND root=UUID=${uuid} rw quiet
- EOF
- info "Unmounting"
- umount /mnt/*
- umount /mnt
- sync
- info "Installation completed"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement