56 lines
1.7 KiB
Bash
Executable File
56 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# enter the void (vps) - developed by acidvegas (https://git.acid.vegas/void)
|
|
|
|
set -xev
|
|
|
|
ARCH=x86_64-musl # x86_64 or x86_64-musl
|
|
DRIVE=/dev/vda
|
|
HOSTNAME=blackhole
|
|
TIMEZONE="America/New_York"
|
|
SWAP_SIZE=4 # In GB (set to 0 to disable)
|
|
USERNAME=acidvegas
|
|
|
|
setup_root() {
|
|
xbps-install -Su && xbps-install parted
|
|
wipefs -a $DRIVE
|
|
parted --script $DRIVE mklabel gpt
|
|
parted --script $DRIVE mkpart primary ext4 1MiB 100%
|
|
parted --script $DRIVE set 1 boot on
|
|
mkfs.ext4 ${DRIVE}1
|
|
mkdir -p /mnt
|
|
mount ${DRIVE}1 /mnt
|
|
mkdir -p /mnt/var/db/xbps/keys
|
|
cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/
|
|
REPO=https://repo-default.voidlinux.org/current
|
|
[ $ARCH = 'x86_64-musl' ] && REPO=$REPO/musl
|
|
XBPS_ARCH=$ARCH xbps-install -S -r /mnt -R "$REPO" base-system linux
|
|
xchroot /mnt /bin/bash
|
|
}
|
|
|
|
setup_chroot() {
|
|
passwd
|
|
xbps-install -u xbps
|
|
xbps-install -Su
|
|
useradd -m -s /bin/bash $USERNAME && passwd $USERNAME
|
|
ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime && hwclock --systohc
|
|
ln -sf /etc/sv/dhcpcd /etc/runit/runsvdir/default/
|
|
if [ ! $ARCH = 'x86_64-musl' ]; then
|
|
echo "en_US.UTF-8 UTF-8" > /etc/default/libc-locales
|
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
xbps-reconfigure -f glibc-locales
|
|
fi
|
|
echo "$HOSTNAME" > /etc/hostname
|
|
echo "UUID=$(blkid -s UUID -o value ${DRIVE}1) / ext4 rw,errors=remount-ro,noatime 0 1" > /etc/fstab
|
|
touch /swapfile && chattr +C /swapfile
|
|
dd if=/dev/zero of=/swapfile bs=1M count=$SWAP_SIZE status=progress
|
|
chmod 0600 /swapfile
|
|
mkswap /swapfile && swapon /swapfile
|
|
echo "/swapfile none swap sw 0 0" >> /etc/fstab
|
|
xbps-install -Sy grub
|
|
grub-install $DRIVE
|
|
grub-mkconfig -o /boot/grub/grub.cfg
|
|
echo "exit and run umount /mnt && reboot"
|
|
}
|
|
|
|
[ $1 = "root" ] && setup_root
|
|
[ $1 = "chroot" ] && setup_chroot |