random

- collection of un-sorted bollocks
git clone git://git.acid.vegas/random.git
Log | Files | Refs | Archive

arch (4670B)

      1 #!/bin/sh
      2 set -xev
      3 
      4 GIT_URL="https://raw.githubusercontent.com/acidvegas/archlinux/master"
      5 RPI=0
      6 
      7 setup_initial() {
      8 	systemctl stop sshd && systemctl disable sshd
      9 	history -c && export HISTFILESIZE=0 && export HISTSIZE=0 && unset HISTFILE
     10 	[ -f /root/.bash_history ] && rm /root/.bash_history
     11 	passwd
     12 	[ $RPI -eq 1 ] && userdel -r alarm
     13 	useradd -m -s /bin/bash acidvegas && gpasswd -a acidvegas wheel && passwd acidvegas
     14 	timedatectl set-timezone America/New_York && timedatectl set-ntp true
     15 	echo "LANG=en_US.UTF-8" > /etc/locale.conf && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
     16 }
     17 
     18 setup_wifi() {
     19 	echo "wildwest" > /etc/hostname
     20 	echo -e "[Match]\nName=wlan0\n\n[Network]\nDHCP=ipv4\nMulticastDNS=yes\n#Address=10.0.0.200/24\nGateway=10.0.0.1" > /etc/systemd/network/25-wireless.network
     21 	echo -e "[Resolve]\nDNS=8.8.4.4 8.8.8.8 2001:4860:4860::8888 2001:4860:4860::8844\nFallbackDNS=1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001\nMulticastDNS=yes\nDNSSEC=no\nCache=yes" > /etc/systemd/resolved.conf
     22 	ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
     23 	wpa_passphrase MYSSID passphrase > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf && chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
     24 	systemctl start systemd-networkd && systemctl enable systemd-networkd
     25 	systemctl start systemd-resolved && systemctl enable systemd-resolved
     26 	systemctl start wpa_supplicant@wlan0 && systemctl enable wpa_supplicant@wlan0
     27 }
     28 
     29 setup_pacman() {
     30 	MI="Include = /etc/pacman.d/mirrorlist"
     31 	echo -e "[options]\nArchitecture = auto\nColor\nCheckSpace\nHoldPkg = pacman glibc\nParallelDownloads = 10\nSigLevel = Required DatabaseOptional\nLocalFileSigLevel = Optional\nRemoteFileSigLevel = Required\n\n" > /etc/pacman.conf
     32 	echo -e "[core-testing]\n$MI\n\n[core]\n$MI\n\n[extra-testing]\n$MI\n\n[extra]\n$MI\n\n" >> /etc/pacman.conf
     33 	[ $RPI -eq 0 ] && echo -e "[multilib-testing]\n$MI\n\n[multilib]\n$MI"     >> /etc/pacman.conf
     34 	[ $RPI -eq 1 ] && echo -e "[community]\n$MI\n\n[alarm]\n$MI\n\n[aur]\n$MI" >> /etc/pacman.conf
     35 	pacman-key --init
     36 	[ $RPI -eq 1 ] && pacman-key --populate archlinuxarm && echo 'Server = http://mirror.archlinuxarm.org/$arch/$repo' > /etc/pacman.d/mirrorlist
     37 	[ $RPI -eq 0 ] && pacman-key --populate archlinux
     38 	pacman -Syyu
     39 	pacman -S checkbashisms gcc go make patch pkg-config python python-pip
     40 	pacman -S asciiquarium cmatrix hollywood tty-solitaire
     41 	pacman -S abduco curl fzf git man nano ncdu progress rsync sudo tor unzip weechat which yank
     42 	pacman -S bandwhich exa glow gping gpm
     43 	pacman -S alsa-utils alsa-lib alsa-firmware libpulse pulseaudio cmus id3v2 mps-youtube python-eyed3 youtube-dl # TODO: check these
     44 	pacman -S dmenu dunst firefox scrot unclutter xclip
     45 	pacman -S acpi xorg-xbacklight xorg-xinit xorg-xrandr xorg-server xorg-xsetroot
     46 	pacman -S fakeroot xorg-font-util xorg-mkfontscale xorg-mkfontdir
     47 	[ $RPI -eq 1 ] && pacman -S xf86-video-fbdev
     48 	[ $RPI -eq 0 ] && pacman -S xf86-video-intel mesa lib32-mesa
     49 	#[ $RPI -eq 0 ] && pacman -S nvidia nvidia-utils lib32-nvidia-utils
     50 	[ $RPI -eq 1 ] && systemctl start gpm && systemctl enable gpm
     51 }
     52 
     53 setup_configs() {
     54 	if [ $RPI -eq 1 ]; then
     55 		sed -i 's/^console=tty1/console=tty3/' /boot/cmdline.txt && echo "quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log_level=3 logo.nologo consoleblank=0" >> /boot/cmdline.txt
     56 		echo -e "avoid_warnings=1\ndisable_splash=1\ndtparam=act_led_trigger=none\ndtparam=act_led_activelow=on\ndtparam=audio=on" > /boot/config.txt
     57 		wget -O /etc/fstab $GIT_URL/etc/fstab
     58 	fi
     59 	wget -O /etc/issue $GIT_URL/etc/issue
     60 	wget -O /etc/sudoers.d/sudoers.lecture $GIT_URL/etc/sudoers.d/sudoers.lecture
     61 	echo -e "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\"" > /etc/nanorc
     62 	echo -e "export VISUAL=nano\nexport EDITOR=nano\nunset HISTFILE\nln /dev/null ~/.bash_history -sf" >> /etc/profile
     63 	echo -e "AuthenticationMethods publickey\nBanner /etc/issue\nClientAliveInterval 0\nDisableForwarding yes\nPermitRootLogin no\nPort CHANGEME\nPrintLastLog no" > /etc/ssh/sshd_config
     64 	echo -e "Defaults lecture = always\nDefaults lecture_file = /etc/sudoers.d/sudoers.lecture\nroot ALL=(ALL) ALL\n%wheel ALL=(ALL) ALL" > /etc/sudoers
     65 	echo -e "[Journal]\nStorage=volatile\nSplitMode=none\nRuntimeMaxUse=500K" > /etc/systemd/journald.conf
     66 	mkdir -p /etc/systemd/system/systemd-logind.service.d && echo -e "[Service]\nSupplementaryGroups=proc" > /etc/systemd/system/systemd-logind.service.d/hidepid.conf
     67 	[ $RPI -eq 1 ] && echo "FONT=ohsnap6x11r" > /etc/vconsole.conf
     68 }
     69 
     70 setup_initial
     71 setup_wifi
     72 setup_pacman
     73 setup_configs