void/setup

203 lines
8.1 KiB
Plaintext
Raw Normal View History

2024-02-29 03:45:58 +00:00
#!/bin/sh
# void setup script - developed by acidvegas (https://git.acid.vegas/void)
# note: After importing keys: printf "FINGERPRINTHERE:6:" | gpg --import-ownertrust
set -xev
# Configuration
2024-07-16 22:12:48 +00:00
ARCH=x86_64 # x86_64 or x86_64-musl
CPU=intel # amd or intel (blank for none)
2024-02-29 03:45:58 +00:00
DISPLAY_SERVER=xorg # xorg or blank for none
2024-07-16 22:12:48 +00:00
GFX_DRIVER=intel # amd, intel, or nvidia (blank for none)
2024-07-16 23:08:30 +00:00
REMOTE=dropbear # dropbear or ssh
2024-07-16 22:12:48 +00:00
USERNAME=acidvegas
2024-02-29 03:45:58 +00:00
GIT_URL="https://raw.githubusercontent.com/acidvegas/void/master"
setup_root() {
2024-07-10 00:50:57 +00:00
setup_packages
2024-07-16 22:12:48 +00:00
useradd -m -s /bin/bash $USERNAME && gpasswd -a $USERNAME wheel && passwd $USERNAME
gpasswd -a $USERNAME _incus && gpasswd -a $USERNAME _incus-admin # Typically incus & incus-admin but void uses the underscore prefix
2024-02-29 03:45:58 +00:00
for item in 6x11 7x12 7x14; do
wget -O /usr/share/kbd/consolefonts/ohsnap${item}r.psfu $GIT_URL/font/ohsnap${item}r.psfu
done
2024-02-29 03:45:58 +00:00
printf "\nnohook resolv.conf\n" >> /etc/dhcpcd.conf
#printf "\nipv4only\nnodhcp6\n" >> /etc/dhcpcd.conf # For fixing "dhcpcd: ipv6nd_sendadvertisement: Operation not permitted" error
printf "nameserver 9.9.9.9\nnameserver149.112.112.112\nnameserver 2620:fe::fe\nnameserver 2620:fe::9" > /etc/resolv.conf
2024-02-29 03:45:58 +00:00
echo "proc /proc proc defaults,hidepid=2 0 0" >> /etc/fstab && mount -o remount /proc
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
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
2024-07-15 03:09:01 +00:00
printf "#\!/bin/sh\nclear && (echo && printf \" E N T E R T H E V O I D\n" && echo) | nms -af red\n" > /etc/profile.d/motd.sh
2024-02-29 03:45:58 +00:00
printf "\nFONT=\"ohsnap6x11r\"\n" >> /etc/rc.conf
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
2024-07-16 23:08:30 +00:00
if [ $REMOTE = "ssh" ]; then
xbps-install -y openssh
printf "PermitRootLogin no\nPasswordAuthentication no\n" >> /etc/ssh/sshd_config
ln -sfv /etc/sv/sshd /var/service/
elif [ $REMOTE = "dropbear" ]; then
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p CHANGE:ME -w -s -R -F\n' > /etc/sv/dropbear/run
fi
2024-02-29 03:45:58 +00:00
printf "\nhsts=0\n" >> /etc/wgetrc
for item in dhcpcd dropbear incus incus-user socklog-unix nanoklogd wpa_supplicant; do
ln -sfv /etc/sv/$item /var/service # Use /etc/runit/runsvdir/default/ instead of /var/service if in a chroot environemnt
done
2024-02-29 03:45:58 +00:00
}
setup_nonfree() {
2024-02-29 03:45:58 +00:00
xbps-install -Suy void-repo-nonfree
# Might need to `xbps-recorder -f` after this
2024-02-29 03:45:58 +00:00
if [ $CPU = "intel" ]; then
xbps-install -y intel-ucode linux-firmware-intel
2024-02-29 03:45:58 +00:00
elif [ $CPU = "amd" ]; then
xbps-install -y linux-firmware-amd
fi
if [ $DISPLAY_SERVER = "xorg" ]; then
if [ $GFX_DRIVER = "intel" ]; then
xbps-install -y mesa-dri vulkan-loader mesa-vulkan-intel intel-video-accel
elif [ $GFX_DRIVER = "amd" ]; then
xbps-install -y mesa-dri vulkan-loader mesa-vulkan-radeon radeon-video-accel # Un-tested
elif [ $GFX_DRIVER = "nvidia" ]; then
xbps-install -y nvidia nvidia-libs nvidia-settings nvidia-xconfig # Un-tested
2024-02-29 03:45:58 +00:00
fi
fi
xbps-install -y Signal-Desktop vscode # Optional
}
setup_packages() {
# Un-comment to enable non-free proprietary software to be installed
#setup_nonfree
if [ $DISPLAY_SERVER = "xorg" ]; then
2024-07-16 21:39:19 +00:00
#xbps-install -y mesa-dri # Raspberry Pi
xbps-install -y xorg libX11 libX11-devel libXft libXft-devel libXinerama libXinerama-devel libXrandr libXrandr-devel xbacklight xrandr
xbps-install -y alacritty dmenu dunst firefox pinentry-dmenu redshift scrot unclutter xclip
2024-07-16 23:08:30 +00:00
xbps-install -y ohsnap-font font-unifont-bdf freefont-ttf noto-fonts-ttf noto-fonts-ttf-extra noto-fonts-cjk noto-fonts-emoji # These fonts give you the most unicode support coverage (noto)
2024-02-29 03:45:58 +00:00
fi
# Development
2024-07-16 21:39:19 +00:00
if [ $ARCH = 'x86_64' ]; then
xbps-install -y gcc
fi
xbps-install -y checkbashisms go make patch pkg-config python3 python3-pip
2024-02-29 03:45:58 +00:00
# Essentials
xbps-install -y curl dropbear git jq progress rsync socklog-void tmux tor tree unzip zip
2024-07-15 03:05:40 +00:00
2024-07-16 21:39:19 +00:00
# Raspberry Pi specific
xbps-install -y rng-tools && ln -sfv /etc/sv/rngd /var/service/ && sv up rngd
xbps-install -y bandwhich bpfmon glow gnupg2-scdaemon lxc incus incus-client incus-tools lazygit oath-toolkit websocat
2024-07-10 00:50:57 +00:00
#xbps-install -y earlyoom && ln -sfv /etc/sv/earlyoom /var/service/
2024-02-29 03:45:58 +00:00
# Alternatives
2024-07-10 00:50:57 +00:00
xbps-install -y bat btop delta duf exa procs
2024-02-29 03:45:58 +00:00
# Fun
xbps-install -y asciiquarium cmatrix no-more-secrets tty-solitaire
# Audio
#xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 youtube-dl # Revamp audio setup at some point
2024-02-29 03:45:58 +00:00
# Recon
#xbps-install -y aircrack-ng bettercap ettercap masscan tcpdump termshark wireshark
# Radio
#xbps-install -y airspy chirp CubicSDR gnuradio gqrx inspectrum librtlsdr rtl-sdr rx_tools SoapyRTLSDR SDRPlusPlus
2024-02-29 03:45:58 +00:00
}
setup_configs() {
wget -O $HOME/.alacritty.toml $GIT_URL/alacritty/.alacritty.toml
wget -O $HOME/.tmux.conf $GIT_URL/tmux/.tmux.conf
for item in bashrc bash_aliases bash_functions; do
2024-07-16 23:08:30 +00:00
wget -O $HOME/.$item $GIT_URL/bash/.$item
done
mkdir -p $HOME/.config/cmus && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave
mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc
2024-02-29 03:45:58 +00:00
wget -O $HOME/.gitconfig $GIT_URL/git/.gitconfig
mkdir $HOME/.gnupg && wget -O $HOME/.gnupg/gpg.conf $GIT_URL/gpg/gpg.conf
2024-07-10 00:50:57 +00:00
printf "pinentry-program /usr/bin/pinentry-curses\ndefault-cache-ttl 3600" > $HOME/.gnupg/gpg-agent.conf
#printf "pinentry-program /usr/bin/pinentry-dmenu\ndefault-cache-ttl 3600" > $HOME/.gnupg/gpg-agent.conf
2024-02-29 03:45:58 +00:00
chmod 700 $HOME/.gnupg && chmod 600 $HOME/.gnupg/*
wget -O $HOME/.xinitrc $GIT_URL/xorg/.xinitrc
mkdir $HOME/.scripts
for SCRIPT in cmus-now dbc gitremote irc-post-commit-hook mutag pmf shotz statusbar todo torwall; do
wget -O $HOME/.scripts/$SCRIPT $GIT_URL/scripts/$SCRIPT && chmod +x $HOME/.scripts/$SCRIPT
done
mkdir -p $HOME/.local/share/fonts && wget -O $HOME/.local/share/fonts/BlockZone.ttf $GIT_URL/font/BlockZone.ttf && fc-cache -f -v
2024-02-29 03:45:58 +00:00
}
setup_fun() {
BUILD=$HOME/dev/build
mkdir -p $BUILD
wget -O $HOME/.scripts/irc2ansi.py https://github.com/internet-relay-chat/archive/blob/master/art/irc2ansi.py
wget -O $HOME/.scripts/bomber $GIT_URL/scripts/bomber && chmod +x $HOME/.scripts/bomber
wget -O $HOME/.scripts/pipes https://raw.githubusercontent.com/pipeseroni/pipes.sh/master/pipes.sh && chmod +x $HOME/.scripts/pipes
git clone https://github.com/AngelJumbo/lavat.git $BUILD/lavat
sudo make -C $BUILD/lavat clean install
git clone https://github.com/lptstr/fire --recurse $BUILD/fire
sudo make -C $BUILD/fire clean install
git clone https://github.com/ricoriedel/wipe $BUILD/wipe
cargo build --release --manifest-path $BUILD/wipe/Cargo.toml # Need to install
git clone https://github.com/pythops/bouncinamation $BUILD/bouncinamation
cargo build --release --manifest-path $BUILD/bouncinamation/Cargo.toml # Need to install
2024-07-10 00:50:57 +00:00
go install github.com/maaslalani/confetty@latest # Animations
go install github.com/maaslalani/gambit@latest # Chess
go install github.com/maxpaulus43/go-sweep@latest # Minesweeper
2024-02-29 03:45:58 +00:00
}
setup_builds() {
BUILD=$HOME/dev/build
mkdir -p $BUILD
git clone --depth 1 http://git.suckless.org/dwm $BUILD/dwm
wget -O $BUILD/dwm/config.h $GIT_URL/dwm/config.h
wget -O $BUILD/dwm/patch_nosquares.diff $GIT_URL/dwm/patch_nosquares.diff
wget -O $BUILD/dwm/patch_notitles.diff $GIT_URL/dwm/patch_notitles.diff
patch $BUILD/dwm/drw.c $BUILD/dwm/patch_nosquares.diff
patch $BUILD/dwm/dwm.c $BUILD/dwm/patch_notitles.diff
sudo make -C $BUILD/dwm clean install
go install -v github.com/projectdiscovery/pdtm/cmd/pdtm@latest && pdtm --all
}
2024-07-15 03:05:40 +00:00
[ "$#" -ne 1 ] && echo "usage: $0 [root|config|build|fun]" && exit 1
2024-02-29 03:45:58 +00:00
case "$1" in
2024-07-15 03:05:40 +00:00
root) setup_root ;;
config) setup_configs ;;
build) setup_builds ;;
fun) setup_fun ;;
*) echo "usage: $0 [root|config|build|fun]\n"; exit 1 ;;
2024-02-29 03:45:58 +00:00
esac