Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. #!/bin/sh -e
  2.  
  3. k=5.0
  4. p="e2fsprogs"
  5.  
  6. # --- #
  7.  
  8. die()
  9. {
  10. echo "error: $@" 1>&2
  11. exit 1
  12. }
  13.  
  14. info()
  15. {
  16. echo 1>&2
  17. echo "===> $@" 1>&2
  18. }
  19.  
  20. # --- #
  21.  
  22. [ "$(id -u)" = 0 ] || die "must be superuser"
  23. mountpoint -q /mnt || die "/mnt is not a mountpoint"
  24.  
  25. # --- #
  26.  
  27. echo "===> gbsn's void-install 1.0 <==="
  28.  
  29. echo
  30. echo "ENTER to install into /mnt or ^C to cancel"
  31. read x
  32.  
  33. info "Setting up mountpoints"
  34.  
  35. for dir in dev proc sys
  36. do
  37. mkdir -p /mnt/${dir}
  38. mount -B /${dir} /mnt/${dir}
  39. done
  40.  
  41. info "Copying XBPS config"
  42.  
  43. mkdir -p /mnt/usr/share
  44. cp -r /usr/share/xbps.d /mnt/usr/share
  45. mkdir -p /mnt/var/db/xbps/keys
  46. cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys
  47.  
  48. info "Installing base packages"
  49.  
  50. alias xi="xbps-install -r /mnt"
  51. xi -S
  52. xi -yU base-files xbps syslinux busybox util-linux kmod runit-void eudev mkinitcpio mkinitcpio-udev findutils grep
  53.  
  54. info "Applying fixes"
  55.  
  56. sed -i 's@mktemp -d --tmpdir@mktemp -d -p /tmp@' /mnt/usr/lib/initcpio/functions
  57. for f in $(/mnt/usr/bin/busybox --list)
  58. do
  59. ln -s busybox /mnt/usr/bin/$f || :
  60. done
  61.  
  62. info "Installing kernel"
  63.  
  64. xi -yU linux${k} linux-firmware-amd linux-firmware-intel linux-firmware-network
  65.  
  66. if [ -n "${p}" ]
  67. then
  68. info "Installing extra packages"
  69. xi -yU ${p}
  70. fi
  71.  
  72. info "Configuring packages"
  73.  
  74. xbps-reconfigure -r /mnt base-files
  75. chroot /mnt xbps-reconfigure -a
  76.  
  77. info "Configuring bootloader"
  78.  
  79. mkdir -p /mnt/boot/extlinux
  80. chroot /mnt extlinux -i /boot/extlinux
  81. dev="$(findmnt -o SOURCE /mnt | sed 1d)"
  82. uuid="$(lsblk -o UUID "${dev}" | sed 1d)"
  83. dev="/dev/$(lsblk -o PKNAME "${dev}" | sed 1d)"
  84. dd if=/mnt/usr/lib/syslinux of="${dev}"
  85. cat > /mnt/boot/extlinux/extlinux.conf << EOF
  86. DEFAULT void
  87.  
  88. LABEL void
  89. LINUX /$(cd /mnt/boot && echo vmlinuz*)
  90. INITRD /$(cd /mnt/boot && echo initramfs*)
  91. APPEND root=UUID=${uuid} rw quiet
  92. EOF
  93.  
  94. info "Unmounting"
  95.  
  96. umount /mnt/*
  97. umount /mnt
  98. sync
  99.  
  100. info "Installation completed"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement