commit cbc1c6dd61e6984414c62387c706f69a1570db5d Author: Till Dieminger Date: Sun Aug 31 21:32:04 2025 +0200 Init diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c834d5 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# Arch Setup Scripts + +These are heavily build upon [Lukes Auto-Rice Bootstrapping Scripts](https://github.com/LukeSmithxyz/LARBS). +I prefer to have them fully CLI and minimal. + + +For this to actually work, the dotfiles need to contain all the nessecary stuff to start dwm, and a few other things. + + + +### Minimal Arch Install Guide + +Super barebones install, just ot get stuff running fast, mostly summary of [the wiki](https://wiki.archlinux.org/title/Installation_guide). For encryption see [here](https://git.bocken.org/Alexander/mykb/src/branch/master/docs/luks2.md). For other fancy stuff see the Arch Wiki. + +1. Boot from Arch ISO +2. Connect to the internet + - `iwctl` + - `device list` + - Assume device name is `wlan0` + - If device or adapter is off + - `device name set-property Powered on` + - `adapter adapter set-property Powered on` + - `station wlan0 scan` + - `station wlan0 get-networks` + - `station wlan0 connect YOUR_SSID` + +2. Update the system clock + - `timedatectl` + +3. Partition the disks (lets assume `/dev/nvme0n1`) + - `fdisk /dev/nvme0n1` + - Create a new GPT partition table: `g` + - Create new partitions: + - EFI System Partition (ESP): `n`, `+1G` + - SWAP Partition: `n`, `+16G` (or whatever you want) + - Root Partition: `n`, `+100G` (or whatever you want) + - Home Partition: `n`, (rest of the space) + - Write changes: `w` + - Verify partitions: `lsblk` + - Format the partitions: + - `mkfs.fat -F32 /dev/nvme0n1p1` (ESP) + - `mkswap /dev/nvme0n1p2` (SWAP) + - `mkfs.ext4 /dev/nvme0n1p3` (Root) + - `mkfs.ext4 /dev/nvme0n1p4` (Home) + +4. Mount the file systems + - `mount /dev/nvme0n1p3 /mnt` (Mount root) + - `mount --mkdir /dev/nvme0n1p1 /mnt/boot` (Mount ESP) + - `mount --mkdir /dev/nvme0n1p4 /mnt/home` (Mount home) + - `swapon /dev/nvme0n1p2` (Enable SWAP) + - Verify mounts: `lsblk` + +5. Install essential packages + - `pacstrap -K /mnt base linux linux-firmware base-devel vim networkmanager efibootmgr grub` + - You can add other packages you want here, like `git`, `curl`, etc. + +6. Generate fstab (file system table) + - `genfstab -U /mnt >> /mnt/etc/fstab` + - Verify fstab: `cat /mnt/etc/fstab` + +7. Chroot into the new System + - `arch-chroot /mnt` + +8. Localization + - `ln -sf /usr/share/zoneinfo/Region/City /etc/localtime` + - `hwclock --systohc` + - Edit `/etc/locale.gen` and uncomment your locale, e.g., `en_US.UTF-8 UTF-8` + - `locale-gen` + - `echo "LANG=en_US.UTF-8" > /etc/locale.conf` + - Edit Hostname: `echo "myhostname" > /etc/hostname` + +9. Initramfs + - `mkinitcpio -P` + +10. Set root password + - `passwd` + +11. Bootloader + - `grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB` + - `grub-mkconfig -o /boot/grub/grub.cfg` + +12. Enable essential services + - `systemctl enable NetworkManager` + +13. Exit chroot and unmount + - `exit` + - `umount -R /mnt` + - `swapoff -a` diff --git a/archSetupScript.sh b/archSetupScript.sh new file mode 100644 index 0000000..63215e0 --- /dev/null +++ b/archSetupScript.sh @@ -0,0 +1,229 @@ +#!/bin/sh + +### LOGGING SETUP ### +LOGFILE="/tmp/larbs-install-$(date +%Y%m%d-%H%M%S).log" +exec > >(tee -a "$LOGFILE") 2>&1 +echo "🔧 Logging installation to $LOGFILE" + + +### CONFIGURABLE OPTIONS ### +dotfilesrepo="https://git.dieminger.ch/TRAAL/dotfiles" + +cwd=$(pwd) +progsfile="$cwd/progs.csv" +echo $progsfile +break +aurhelper="paru" +repobranch="master" +export TERM=ansi + +### VALIDATE ARGUMENTS ### +if [ $# -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +name="$1" +pass1="$2" + +### FUNCTIONS ### + +installpkg() { + pacman --noconfirm --needed -S "$1" +} + +error() { + printf "%s\n" "$1" >&2 + exit 1 +} + +adduserandpass() { + echo "Adding user \"$name\"..." + useradd -m -g wheel -s /bin/zsh "$name" 2>/dev/null || { + echo "User already exists. Adding to wheel group and continuing..." + usermod -a -G wheel "$name" + mkdir -p /home/"$name" + chown "$name":wheel /home/"$name" + } + export repodir="/home/$name/.local/src" + mkdir -p "$repodir" + chown -R "$name":wheel "$(dirname "$repodir")" + echo "$name:$pass1" | chpasswd +} + +refreshkeys() { + case "$(readlink -f /sbin/init)" in + *systemd*) + pacman --noconfirm -S archlinux-keyring + ;; + *) + pacman --noconfirm --needed -S \ + artix-keyring artix-archlinux-support + grep -q "^\[extra\]" /etc/pacman.conf || echo "[extra] +Include = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf + pacman -Sy --noconfirm + pacman-key --populate archlinux + ;; + esac +} + +manualinstall() { + pacman -Qq "$1" && return 0 + sudo -u "$name" mkdir -p "$repodir/$1" + sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch --no-tags -q "https://aur.archlinux.org/$1.git" "$repodir/$1" || { + cd "$repodir/$1" || return 1 + sudo -u "$name" git pull --force origin master + } + cd "$repodir/$1" || exit 1 + sudo -u "$name" -D "$repodir/$1" makepkg --noconfirm -si || return 1 +} + +maininstall() { + installpkg "$1" +} + +gitmakeinstall() { + progname="${1##*/}" + progname="${progname%.git}" + dir="$repodir/$progname" + sudo -u "$name" git -C "$repodir" clone --depth 1 --single-branch --no-tags -q "$1" "$dir" || { + cd "$dir" || return 1 + sudo -u "$name" git pull --force origin master + } + cd "$dir" || exit 1 + make + make install + cd /tmp || return 1 +} + +gitaurinstall(){ + git clone "https://aur.archlinux.org/$1.git" "/tmp/$1" + cd "/tmp/$1" || return 1 + chown -R "$name":wheel "/tmp/$1" + sudo -u "$name" makepkg --noconfirm -si + cd /tmp || return 1 + rm -rf "/tmp/$1" +} + +aurinstall() { + echo "$aurinstalled" | grep -q "^$1$" && return 1 + sudo -u "$name" $aurhelper -S --noconfirm "$1" +} + +pipinstall() { + [ -x "$(command -v "pip")" ] || installpkg python-pip + yes | pip install "$1" +} + +installationloop() { + cp $progsfile /tmp/progs.csv + total=$(wc -l "/home/$name/.config/nvim/autoload/plug.vim" + chown -R "$name:wheel" "/home/$name/.config/nvim" + sudo -u "$name" nvim -c "PlugInstall|q|q" +} + +### START INSTALLATION ### + +pacman --noconfirm --needed -Sy libnewt || error "Must be run as root on an Arch-based system with internet access." + +refreshkeys || error "Failed to refresh keys." + +# Required base packages +for x in curl ca-certificates base-devel git ntp zsh; do + installpkg "$x" +done + +ntpd -q -g + +adduserandpass || error "Could not add user." + +[ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers + +# Allow passwordless sudo for wheel +trap 'rm -f /etc/sudoers.d/larbs-temp' HUP INT QUIT TERM PWR EXIT +echo "%wheel ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/larbs-temp + +# Pacman config +grep -q "ILoveCandy" /etc/pacman.conf || sed -i "/#VerbosePkgLists/a ILoveCandy" /etc/pacman.conf +sed -Ei "s/^#(ParallelDownloads).*/\1 = 5/;/^#Color$/s/#//" /etc/pacman.conf +sed -i "s/-j2/-j$(nproc)/;/^#MAKEFLAGS/s/^#//" /etc/makepkg.conf + +# Install AUR helper +gitaurinstall "$aurhelper" || error "Failed to install AUR helper." +$aurhelper -Y --save --devel + +# Main install +installationloop + +# Dotfiles +putgitrepo "$dotfilesrepo" "/home/$name" "$repobranch" +rm -rf "/home/$name/.git/" "/home/$name/README.md" "/home/$name/LICENSE" "/home/$name/FUNDING.yml" + +# Neovim plugins +[ ! -f "/home/$name/.config/nvim/autoload/plug.vim" ] && vimplugininstall + +rmmod pcspkr +echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf + +chsh -s /bin/zsh "$name" +sudo -u "$name" mkdir -p "/home/$name/.cache/zsh/" + +dbus-uuidgen > /var/lib/dbus/machine-id +echo "export \$(dbus-launch)" > /etc/profile.d/dbus.sh + +# Enable touchpad tap +[ ! -f /etc/X11/xorg.conf.d/40-libinput.conf ] && cat > /etc/X11/xorg.conf.d/40-libinput.conf < /etc/sudoers.d/00-larbs-wheel-can-sudo +echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/shutdown,/usr/bin/reboot,/usr/bin/systemctl suspend,/usr/bin/wifi-menu,/usr/bin/mount,/usr/bin/umount,/usr/bin/pacman -Syu,/usr/bin/pacman -Syyu,/usr/bin/pacman -Syyu --noconfirm,/usr/bin/loadkeys,/usr/bin/pacman -Syyuw --noconfirm,/usr/bin/pacman -S -u -y --config /etc/pacman.conf --,/usr/bin/pacman -S -y -u --config /etc/pacman.conf --" > /etc/sudoers.d/01-larbs-cmds-without-password +echo "Defaults editor=/usr/bin/nvim" > /etc/sudoers.d/02-larbs-visudo-editor + +mkdir -p /etc/sysctl.d +echo "kernel.dmesg_restrict = 0" > /etc/sysctl.d/dmesg.conf + +# Final message +echo "ASS installation completed successfully for user '$name'." +echo "Log in as '$name' and run 'startx' to start your graphical environment." +echo "Full log saved to: $LOGFILE" diff --git a/progs.csv b/progs.csv new file mode 100644 index 0000000..388cc16 --- /dev/null +++ b/progs.csv @@ -0,0 +1,114 @@ +#TAG,NAME IN REPO (or git url),PURPOSE (should be a verb phrase to sound right while installing) +,openssh,"is needed for ssh and scp." +,networkmanager,"manages network connections." +,base-devel,"is needed to compile AUR packages." +,xorg-server,"is the graphical server. This first one may take a while as it pulls many other dependencies first on clean installs." +,xorg-xwininfo,"allows querying information about windows." +,xorg-xinit,"starts the graphical server." +,polkit,"manages user policies." +,libertinus-font,"provides the sans and serif fonts for LARBS." +,ttf-font-awesome,"provides extended glyph support." +,ttf-dejavu,"properly displays emojis." +,ranger,"is an extensive terminal file manager that everyone likes." +A,ueberzugpp,"enables previews in the ranger file manager." +,bc,"is a mathematics language used for the dropdown calculator." +,xorg-xprop,"is a tool for detecting window properties." +,arandr,"allows the user to customize monitor arrangements." +,dosfstools,"allows your computer to access dos-like filesystems." +,libnotify,"allows desktop notifications." +,dunst,"is a suckless notification system." +,calcurse,"terminal-based organizer for interactive and command line use" +,exfat-utils,"allows management of FAT drives." +,xwallpaper,"sets the wallpaper." +,ffmpeg,"can record and splice video and audio on the command line." +,ffmpegthumbnailer,"creates thumbnail previews of video files." +,gnome-keyring,"serves as the system keyring." +A,gtk-theme-arc-gruvbox-git,"gives the dark GTK theme used in LARBS." +,python-qdarkstyle,"provides a dark Qt theme." +,neovim,"a tidier vim with some useful features" +,mpd,"is a lightweight music daemon." +,mpc,"is a terminal interface for mpd." +,mpv,"is the patrician's choice video player." +,man-db,"lets you read man pages of programs." +,ncmpcpp,"a ncurses interface for music with multiple formats and a powerful tag editor." +,newsboat,"is a terminal RSS client." +,noto-fonts,"is an expansive font package." +,noto-fonts-emoji,"is an emoji font." +,ntfs-3g,"allows accessing NTFS partitions." +,wireplumber,"is the audio system." +,pipewire-pulse,"gives pipewire compatibility with PulseAudio programs." +,pulsemixer,"is an audio controller." +A,sc-im,"is an Excel-like terminal spreadsheet manager." +,maim,"can take quick screenshots at your request." +,unclutter,"hides an inactive mouse." +,unzip,"unzips zips." +,lynx,"is a terminal browser also used in LARBS for generating in-terminal previews of websites, emails and HTML files." +,xcape,"gives the special escape/super mappings of LARBS." +,xclip,"allows for copying and pasting from the command line." +,xdotool,"provides window action utilities on the command line." +,yt-dlp,"can download any YouTube video (or playlist or channel) when given the link." +,zathura,"is a pdf viewer with vim-like bindings." +,zathura-pdf-mupdf,"allows mupdf pdf compatibility in zathura." +,poppler,"manipulates .pdfs and gives .pdf previews and other .pdf functions." +,mediainfo,"shows audio and video information and is used in the file browser." +,atool,"manages and gives information about archives." +,fzf,"is a fuzzy finder tool used for easy selection and location of files." +,bat,"can highlight code output and display files and is used to generate previews in the file browser." +,xorg-xbacklight,"enables changing screen brightness levels." +A,zsh-fast-syntax-highlighting-git,"provides syntax highlighting in the shell." +A,task-spooler,"queues commands or files for download." +A,simple-mtpfs,"enables the mounting of cell phones." +A,htop-vim,"is a graphical and colorful system monitor." +G,https://git.dieminger.ch/TRAAL/dwmblocks,"serves as the modular status bar." +G,https://git.dieminger.ch/TRAAL/dmenu,"runs commands and provides a UI for selection." +G,https://git.dieminger.ch/TRAAL/st,"is my custom build of suckless's terminal emulator." +G,https://git.dieminger.ch/TRAAL/dwm,"is the window manager." +G,https://git.dieminger.ch/TRAAL/slock,"is the screen locker." +A,mutt-wizard-git,"is a light-weight terminal-based email system." +,korganizer,"is a calendar and todo list manager that syncs with caldav." +,socat,"is a utility which establishes two byte streams and transfers data between them." +,moreutils,"is a collection of useful unix tools." +,texlive,"LaTex compiler and all it's libraries (big install)" +A,qrcp,"quick and easy file transfers in local networks via per-use self-hosted server" +,ttf-inconsolata,"The best monospace font." +A,pass,"Password manager that uses gpg and git" +,pass-otp,"One time password support for pass" +,qutebrowser,"vim-like browser with large customizability" +,python-adblock,"Brave-like adblocking in qutebrowser" +,firefox, "the browser that just works" +,gomuks,"Terminal based Matrix/Element client" +,rsync,"the smarter `cp`" +A,tremc,"Terminal transmission client for torrents" +,picom,"Window Compositor which allows for gaussian blur effects" +A,pass-git-helper,"Store your git specific logins in pass and automatically retrieve them when needed" +,python-numpy,"Efficient Matrix and array handling in Python" +,python-matplotlib,"Good Python plotting library copying matlabs implementation" +,python-scipy,"Always needed for scientific python" +,shellcheck,"A linter for shellscripts" +,bluez,"you will want bluetooth, right?" +,bluez-utils,"Interact with your bluetooth on the commandline" +A,cronie,"A simple cronjob manager" +,chrony,"Keep time accurately, even with only periodic internet" +A,bthandler,"A dmenu-wrapper for the most-important actions with bluetooth" +A,keynav,"Quick mouse-less navigation" +,zsh-autosuggestions,"Get command suggestions in ZSH" +A,zsh-fast-syntax-highlighting,"Syntax highlighting in ZSH" +,dash,"Probably the fastest strictly POSIX compliant shell" +A,bashbinsh,"Make dash your default /bin/sh, even with updates" +A,ttf-symbola,"Beatuiful monochrome emoji font" +,pacman-contrib,"pactree & co" +,ttf-font-awesome,"lots of useful icons in font-format" +,python-brotli,"do it faster" +,python-cchardet,"do it faster as well" +,zathura-jvu,"DJVU Support for Zathura" +A,xvkbd,"A virtual keyboard used to print primary clipboard by emulating keypresses" +,gimp,"A libre Photoshop equivalent" +,perl-image-exiftool,"Image metadata reading/writing from the command line" +,asp,"Read PKGBUILDs from default repos" +,system-config-printer,"An easy GUI for printer editting" +A,cncndrvcups-lb-bin,"Driver for our printer" +,python-http2,"dependency for calcurse caldav sync" +,texlive-lang,"Latex spelling support for most languages" +,wmctrl,"Control your windows from the commandline" +A,mpv-sponsorblock-minimal-git,"Skip sponsored segments in youtube videos when viewing them in mpv" +A,libxft-bgra-git,"Colored font"