FUCKING SHIT

This commit is contained in:
Dionysus 2024-02-16 13:52:42 -05:00
parent 562cfa92eb
commit e6dd721e6d
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
1 changed files with 27 additions and 21 deletions

48
vps
View File

@ -6,6 +6,7 @@
set -xev
# Configuration
ARCH=x86_64 # x86_64 or x86_64-musl
DRIVE=/dev/vda
HOSTNAME=blackhole
SSH_PORT=22 # Change me
@ -24,7 +25,9 @@ setup_root() {
mount ${DRIVE}1 /mnt
mkdir -p /mnt/var/db/xbps/keys
cp /var/db/xbps/keys/* /mnt/var/db/xbps/keys/
XBPS_ARCH=x86_64-musl xbps-install -S -r /mnt -R https://repo-default.voidlinux.org/current/musl base-system linux
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
cp vps /mnt/root/
xchroot /mnt /bin/bash
}
@ -42,45 +45,48 @@ setup_chroot() {
printf "ip link set eth0 up\nip addr add ${IP_ADDR}/24 dev eth0\nip route add default via $GATEWAY\n" > /etc/rc.local
printf "printf \"nameserver 208.67.222.222\\\nnameserver 208.67.220.220\\\nnameserver 2620:119:35::35\\\nnameserver 2620:119:53::53\" > /etc/resolv.conf" >> /etc/rc.local
#>/var/log/lastlog && chattr +i /var/log/lastlog
>/var/log/lastlog && chattr +i /var/log/lastlog
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -K 0 -p '"$SSH_PORT"' -R -m -w -t -T 1 -F 2>&1\n' > /etc/sv/dropbear/run
#printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
#printf "set boldtext\nset minibar\nset nohelp\nset nowrap\nset quickblank\nset tabsize 4\nunbind ^J main\nset selectedcolor black,red\ninclude \"/usr/share/nano/*.nanorc\"\n" > /etc/nanorc
#echo "hsts=0" >> /etc/wgetrc
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
printf "set boldtext\nset minibar\nset nohelp\nset nowrap\nset quickblank\nset tabsize 4\nunbind ^J main\nset selectedcolor black,red\ninclude \"/usr/share/nano/*.nanorc\"\n" > /etc/nanorc
echo "hsts=0" >> /etc/wgetrc
#printf "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%%wheel ALL=(ALL) ALL\n" > /etc/sudoers
#printf "\n\033[1m \033[32m\"Bee\" careful \033[34m__\n \033[32mwith sudo! \033[34m// \ \n \\\\\\_/ \033[33m//\n \033[35m''-.._.-''-.._.. \033[33m-(||)(')\n '''\033[0m\n" > /etc/sudoers.d/sudoers.lecture
#echo "proc /proc proc defaults,hidepid=2 0 0" >> /etc/fstab
#mount -o remount /proc
echo "proc /proc proc defaults,hidepid=2 0 0" >> /etc/fstab
mount -o remount /proc
ln -s /etc/sv/socklog-unix/ /etc/runit/runsvdir/default/ # We use this instead of /var/service because the system is not currently running
ln -s /etc/sv/nanoklogd/ /etc/runit/runsvdir/default/
ln -s /etc/sv/dropbear/ /etc/runit/runsvdir/default/
ln -s /usr/share/zoneinfo/$TIMEZONE /etc/localtime
#hwclock --systohc
#chsh -s /bin/sh
useradd -m $USERNAME && passwd $USERNAME
#gpasswd -a $USERNAME lxd
hwclock --systohc
chsh -s /bin/bash
#cp vps /home/$USERNAME/ && chown $USERNAME:$USERNAME /home/$USERNAME/vps
useradd -m -s /bin/bash $USERNAME && passwd $USERNAME
gpasswd -a $USERNAME lxd
cp vps /home/$USERNAME/ && chown $USERNAME:$USERNAME /home/$USERNAME/vps
if [ ! $ARCH = 'x86_64-musl' ]; then
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
echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0" >> /etc/fstab
#touch /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
touch /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
#xbps-reconfigure -fa
xbps-reconfigure -fa
}
setup_user() {
@ -92,4 +98,4 @@ setup_user() {
[ $1 = "root" ] && setup_root
[ $1 = "chroot" ] && setup_chroot
[ $1 = "user" ] && setup_user
[ $1 = "user" ] && setup_user