void

- enter the void 🪐
git clone git://git.acid.vegas/archlinux.git
Log | Files | Refs | Archive

setup (11774B)

      1 #!/bin/sh
      2 # void setup script - developed by acidvegas (https://git.acid.vegas/void)
      3 
      4 # note: After importing keys: printf "FINGERPRINTHERE:6:" | gpg --import-ownertrust
      5 
      6 set -xev
      7 
      8 # Configuration
      9 ARCH=x86_64         # x86_64 or x86_64-musl
     10 CPU=intel           # amd or intel (blank for none)
     11 DISPLAY_SERVER=xorg # xorg or blank for none
     12 GFX_DRIVER=intel    # amd, intel, or nvidia (blank for none)
     13 PI=0                # 0 for desktop, 1 for Raspberry Pi
     14 REMOTE=dropbear     # dropbear or ssh (blank for none)
     15 USERNAME=acidvegas
     16 WIFI_DEV=wlan0
     17 
     18 
     19 GIT_URL="https://raw.githubusercontent.com/acidvegas/void/master"
     20 
     21 setup_root() {
     22 	setup_packages
     23 
     24 	useradd -m -s /bin/bash $USERNAME && gpasswd -a $USERNAME wheel && passwd $USERNAME
     25 	gpasswd -a $USERNAME _incus && gpasswd -a $USERNAME _incus-admin # Typically incus & incus-admin but void uses the underscore prefix
     26 
     27 	for item in 6x11 7x12 7x14; do
     28 		wget -O /usr/share/kbd/consolefonts/ohsnap${item}r.psfu $GIT_URL/font/ohsnap${item}r.psfu
     29 	done
     30 	printf "\nnohook resolv.conf\n" >> /etc/dhcpcd.conf
     31 	#printf "\nipv4only\nnodhcp6\n" >> /etc/dhcpcd.conf # For fixing "dhcpcd: ipv6nd_sendadvertisement: Operation not permitted" error
     32 	echo "CGROUP_MODE=\"unified\"" >> /etc/rc.conf
     33 	printf "nameserver 9.9.9.9\nnameserver149.112.112.112\nnameserver 2620:fe::fe\nnameserver 2620:fe::9" > /etc/resolv.conf
     34 	echo "proc /proc proc defaults,hidepid=2 0 0" >> /etc/fstab && mount -o remount /proc
     35 	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
     36 	printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
     37 	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
     38 	printf "\nFONT=\"ohsnap6x11r\"\n" >> /etc/rc.conf
     39 	printf "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%%wheel ALL=(ALL) ALL\n" > /etc/sudoers
     40 	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
     41 	printf "\nhsts=0\n" >> /etc/wgetrc
     42 
     43 	# For Drevo Calibur V2 FN key fix
     44 	#echo 0 | sudo pkexec tee /sys/module/hid_apple/parameters/fnmode
     45 
     46 	if [ $REMOTE = "dropbear" ]; then
     47 		LOCAL_IP=$(ip addr show $WIFI_DEV | grep 'inet ' | awk '{print $2}' | cut -d'/' -f1)
     48 		RND_PORT=$(shuf -i 10000-65535 -n 1)
     49 		xbps-install -y dropbear
     50 		printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p $LOCAL_IP:$RND_PORT -w -s -R -F' > /etc/sv/dropbear/run
     51 	fi
     52 
     53 	for item in dhcpcd incus incus-user socklog-unix nanoklogd wpa_supplicant; do
     54 		ln -sfv /etc/sv/$item /var/service # Use /etc/runit/runsvdir/default/ instead of /var/service if in a chroot environemnt
     55 	done
     56 }
     57 
     58 
     59 setup_nonfree() {
     60 	xbps-install -Suy void-repo-nonfree
     61 
     62 	if [ $CPU = "intel" ]; then
     63 		xbps-install -y intel-ucode linux-firmware-intel
     64 	elif [ $CPU = "amd" ]; then
     65 		xbps-install -y linux-firmware-amd
     66 	fi
     67 
     68 	if [ $DISPLAY_SERVER = "xorg" ]; then
     69 		if [ $GFX_DRIVER = "intel" ]; then
     70 			xbps-install -y  mesa-dri vulkan-loader mesa-vulkan-intel intel-video-accel
     71 		elif [ $GFX_DRIVER = "amd" ]; then
     72 			xbps-install -y mesa-dri vulkan-loader mesa-vulkan-radeon radeon-video-accel # Un-tested
     73 		elif [ $GFX_DRIVER = "nvidia" ]; then
     74 			xbps-install -y nvidia nvidia-libs nvidia-settings nvidia-xconfig # Un-tested
     75 		fi
     76 	fi
     77 
     78 	xbps-reconfigure -f linux
     79 
     80 	xbps-install -y Signal-Desktop
     81 }
     82 
     83 
     84 setup_packages() {
     85 	# Un-comment to enable non-free proprietary software to be installed
     86 	setup_nonfree
     87 
     88 	if [ $DISPLAY_SERVER = "xorg" ]; then
     89 		#xbps-install -y mesa-dri # Raspberry Pi
     90 		xbps-install -y xorg libX11 libX11-devel libXft libXft-devel libXinerama libXinerama-devel libXrandr libXrandr-devel xbacklight xrandr
     91 		xbps-install -y alacritty dmenu dunst firefox pinentry-dmenu redshift scrot unclutter xclip
     92 		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)
     93 	fi
     94 
     95 	# Development
     96 	if [ $ARCH = 'x86_64' ]; then
     97 		xbps-install -y gcc
     98 	fi
     99 	xbps-install -y cargo checkbashisms go make patch pkg-config python3 python3-pip
    100 	xbps-install -y ansible aws-cli python3-aiodns python3-aiofiles python3-aiohttp python3-boto3 python3-Flask terraform
    101 	xbps-install -y bluetuith
    102 
    103 	# Essentials
    104 	if [ $REMOTE = "dropbear" ]; then
    105 		xbps-install -y dhcpcd dropbear
    106 	elif [ $REMOTE = "ssh" ] || [ $REMOTE = "openssh" ]; then
    107 		xbps-install -y dhcpcd openssh
    108 	fi
    109 	xbps-install -y curl dropbear git jq progress rsync socklog-void tmux tor tree unzip whois zip
    110 	xbps-install -y tailscale wireguard wireguard-tools wireproxy
    111 
    112 	xbps-install -y python3-zulip zulip-desktop zulip-term
    113 
    114 	# Raspberry Pi specific
    115 	#xbps-install -y rng-tools && ln -sfv /etc/sv/rngd /var/service/ && sv up rngd
    116 
    117 	xbps-install -y  glow gotify-cli gnupg2-scdaemon lxc incus incus-client incus-tools lazygit oath-toolkit websocat
    118 	#xbps-install -y earlyoom && ln -sfv /etc/sv/earlyoom /var/service/
    119 
    120 	# Alternatives
    121 	xbps-install -y bat btop delta duf exa procs xsv
    122 
    123 	# Fun
    124 	xbps-install -y asciiquarium chess-tui cmatrix no-more-secrets tuimoji tty-solitaire
    125 
    126 	# Audio
    127 	#xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 spotify-tui youtube-dl # Revamp audio setup at some point
    128 
    129 	# Hardware
    130 	xbps-install -y bluetuith gpsd
    131 
    132 	# Recon
    133 	xbps-install -y aircrack-ng bettercap bandwhich bpfmon ettercap kismet masscan tcpdump termshark wireshark
    134 
    135 	# Radio
    136 	#xbps-install -y airspy chirp CubicSDR gnuradio gqrx inspectrum librtlsdr rtl-sdr rx_tools SoapyRTLSDR SDRPlusPlus
    137 }
    138 
    139 
    140 setup_configs() {
    141     mkdir -p $HOME/.config/alacritty/ && wget -O $HOME/.config/alacritty/alacritty.toml $GIT_URL/config/alacritty/alacritty.toml
    142    	mkdir -p $HOME/.config/cmus  && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave
    143 	mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc
    144 	mkdir -p $HOME/.config/git   && wget -O $HOME/.config/git/gitconfig $GIT_URL/config/git/gitconfig
    145 	mkdir -p $HOME/.config/tmux  && wget -O $HOME/.config/tmux/tmux.conf $GIT_URL/config/tmux/tmux.conf
    146 	mkdir -p $HOME/.config/X11/  && wget -O $HOME/.config/X11/xinitrc    $GIT_URL/config/X11/xinitrc
    147 
    148 	mkdir -p $HOME/.local/share/bash
    149 	for item in bash_aliases bash_functions bash_fun bash_recon; do
    150 		wget -O $HOME/.local/share/bash/$item $GIT_URL/local/share/bash/$item
    151 	done
    152 	wget -O $HOME/.bashrc $GIT_URL/.bashrc
    153 
    154 	mkdir -p $HOME/.local/share/gnupg && wget -O $HOME/.local/share/gnupg/gpg.conf $GIT_URL/local/share/gnupg/gpg.conf
    155 	printf "pinentry-program /usr/bin/pinentry-curses\ndefault-cache-ttl 3600" > $HOME/.local/share/gnupg/gpg-agent.conf
    156 	chmod 700 $HOME/.local/share/gnupg && chmod 600 $HOME/.local/share/gnupg/*
    157 
    158 	mkdir -p $HOME/.local/bin/scripts
    159 	for SCRIPT in cmus-now gitremote irc-post-commit-hook mutag pmf shotz statusbar todo; do
    160 		wget -O $HOME/.local/bin/scripts/$SCRIPT $GIT_URL/scripts/$SCRIPT && chmod +x $HOME/.scripts/$SCRIPT
    161 	done
    162 	wget -O $HOME/.scripts/dbc https://raw.githubusercontent.com/acidvegas/dbc/main/dbc && chmod +x $HOME/.scripts/dbc
    163 
    164 	mkdir -p $HOME/.local/share/fonts && wget -O $HOME/.local/share/fonts/BlockZone.ttf $GIT_URL/font/BlockZone.ttf && fc-cache -f -v
    165 
    166 	VERSION=$(curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest | jq -r .tag_name | cut -c2-)
    167 	wget -O $HOME/.local/bin/obsidian https://github.com/obsidianmd/obsidian-releases/releases/download/v${VERSION}/Obsidian-${VERSION}.AppImage
    168 }
    169 
    170 
    171 setup_fun() {
    172 	BUILD=$HOME/dev/build
    173 	mkdir -p $BUILD
    174 
    175 	wget -O $HOME/.scripts/irc2ansi.py https://raw.githubusercontent.com/internet-relay-chat/archive/master/art/irc2ansi.py
    176 	wget -O $HOME/.scripts/bomber $GIT_URL/scripts/bomber && chmod +x $HOME/.scripts/bomber
    177 	wget -O $HOME/.scripts/pipes https://raw.githubusercontent.com/pipeseroni/pipes.sh/master/pipes.sh && chmod +x $HOME/.scripts/pipes
    178 
    179 	git clone https://github.com/AngelJumbo/lavat.git $BUILD/lavat
    180 	sudo make -C $BUILD/lavat clean install
    181 
    182 	git clone https://github.com/lptstr/fire --recurse $BUILD/fire
    183 	sudo make -C $BUILD/fire clean install
    184 
    185 	git clone https://github.com/ricoriedel/wipe $BUILD/wipe
    186 	cargo build --release --manifest-path $BUILD/wipe/Cargo.toml # Need to install
    187 
    188 	git clone https://github.com/pythops/bouncinamation $BUILD/bouncinamation
    189 	cargo build --release --manifest-path $BUILD/bouncinamation/Cargo.toml # Need to install
    190 
    191 	go install github.com/maaslalani/confetty@latest  # Animations
    192 	go install github.com/maxpaulus43/go-sweep@latest # Minesweeper
    193 }
    194 
    195 
    196 setup_builds() {
    197 	BUILD=$HOME/dev/build
    198 	mkdir -p $BUILD
    199 
    200 	git clone --depth 1 http://git.suckless.org/dwm $BUILD/dwm
    201 	wget -O $BUILD/dwm/config.h $GIT_URL/dwm/config.h
    202 	wget -O $BUILD/dwm/patch_nosquares.diff $GIT_URL/dwm/patch_nosquares.diff
    203 	wget -O $BUILD/dwm/patch_notitles.diff $GIT_URL/dwm/patch_notitles.diff
    204 	patch $BUILD/dwm/drw.c $BUILD/dwm/patch_nosquares.diff
    205 	patch $BUILD/dwm/dwm.c $BUILD/dwm/patch_notitles.diff
    206 	sudo make -C $BUILD/dwm clean install
    207 }
    208 
    209 
    210 setup_user_packages() {
    211 	wget -O $HOME/.local/bin/cursor https://downloader.cursor.sh/linux/appImage/x64
    212 	chmod u+x $HOME/.local/bin/cursor
    213 
    214 	VERSION=$(curl -s https://api.github.com/repos/obsidianmd/obsidian-releases/releases/latest | jq -r .tag_name  | cut -c2-)
    215 	wget -O $HOME/.local/bin/obsidian https://github.com/obsidianmd/obsidian-releases/releases/download/v${VERSION}/Obsidian-${VERSION}.AppImage
    216 	chmod u+x $HOME/.local/bin/obsidian
    217 
    218 	VERSION=$(curl -s https://api.github.com/repos/boxdot/gurk-rs/releases/latest | jq -r .tag_name)
    219 	wget -O $HOME/.local/bin/gurk https://github.com/boxdot/gurk-rs/releases/download/${VERSION}/gurk-x86_64-unknown-linux-gnu.tar.gz
    220 	chmod u+x $HOME/.local/bin/gurk
    221 
    222 	TEMP=$(mktemp -d)
    223 	wget -O $TEMP/zed.tar.gz https://zed.dev/api/releases/stable/latest/zed-linux-x86_64.tar.gz
    224 	tar -xzf $TEMP/zed.tar.gz -C $TEMP
    225 	mv $TEMP/zed.app/bin/zed $HOME/.local/bin/zed
    226 	rm -rf $TEMP
    227 
    228 	mkdir -p $HOME/.config/pip && printf "[global]\nbreak-system-packages = true" > $HOME/.config/pip/pip.conf
    229 	pip install --user asyncwhois ecs elasticsearch meshtastic scalene
    230 
    231 	cargo install binsider
    232 	cargo install git-dumper
    233 	cargo install netscanner
    234 
    235 	go install -v github.com/nxtrace/NTrace-core@latest
    236 	go install -v github.com/projectdiscovery/asnmap/cmd/asnmap@latest
    237 	go install -v github.com/projectdiscovery/chaos-client/cmd/chaos@latest
    238 	go install -v github.com/projectdiscovery/cvemap/cmd/cvemap@latest
    239 	go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latest
    240 	go install -v github.com/projectdiscovery/httpx/cmd/httpx@latest
    241 	go install -v github.com/projectdiscovery/katana/cmd/katana@latest
    242 	go install -v github.com/projectdiscovery/mapcidr/cmd/mapcidr@latest
    243 	go install -v github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
    244 	go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
    245 	go install -v github.com/projectdiscovery/tlsx/cmd/tlsx@latest
    246 
    247 	git clone https://github.com/projectdiscovery/nuclei-templates.git $HOME/dev/git/mirror/nuclei-templates
    248 
    249 	git clone https://github.com/blechschmidt/massdns.git $HOME/dev/git/mirror/massdns
    250 	make -C $HOME/dev/git/mirror/massdns && sudo make -C $HOME/dev/git/mirror/massdns install
    251 }
    252 
    253 
    254 
    255 [ "$#" -ne 1 ] && echo "usage: $0 [root|config|build|fun]" && exit 1
    256 
    257 case "$1" in
    258 	root)   setup_root    ;;
    259 	config) setup_configs ;;
    260 	build)  setup_builds  ;;
    261 	fun)    setup_fun     ;;
    262 	*)      echo "usage: $0 [root|config|build|fun]\n"; exit 1 ;;
    263 esac