dev/runs/base

237 lines
6.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# NAME: Install base system packages with hardware detection
set -euo pipefail
# Source common functions
source "$(dirname "$0")/../common.sh" || {
echo "[ERROR] Could not source common.sh" >&2
exit 1
}
check_requirements() {
if ! command_exists paru; then
log_error "paru not found. Install it first"
exit 1
fi
}
detect_hardware() {
local cpu_vendor gpu_info microcode gpu_packages
cpu_vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}')
gpu_info=$(lspci | grep -i vga)
log_info "Detected CPU: $cpu_vendor"
log_info "Detected GPU: $gpu_info"
# Determine microcode package
case "$cpu_vendor" in
"GenuineIntel")
microcode="intel-ucode"
log_info "Using Intel microcode"
;;
"AuthenticAMD")
microcode="amd-ucode"
log_info "Using AMD microcode"
;;
*)
microcode=""
log_warn "Unknown CPU vendor, skipping microcode"
;;
esac
# Determine GPU drivers
gpu_packages=""
if echo "$gpu_info" | grep -qi "amd\|radeon"; then
gpu_packages="xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon opencl-mesa lib32-opencl-mesa"
log_info "Using AMD GPU drivers"
elif echo "$gpu_info" | grep -qi "intel"; then
gpu_packages="xf86-video-intel vulkan-intel lib32-vulkan-intel intel-media-driver"
log_info "Using Intel GPU drivers"
elif echo "$gpu_info" | grep -qi "nvidia"; then
gpu_packages="nvidia nvidia-utils lib32-nvidia-utils nvidia-settings"
log_info "Using NVIDIA drivers"
else
log_warn "Unknown GPU, using generic drivers"
fi
}
install_base_system() {
log_info "Installing system base packages"
local base_packages="base base-devel sudo stow linux-cachyos linux-cachyos-headers linux-firmware efibootmgr efitools mkinitcpio grub systemd-boot-manager"
if [[ -n "$microcode" ]]; then
base_packages="$base_packages $microcode"
fi
paru -S --needed --overwrite="*" $base_packages
}
install_networking() {
log_info "Installing networking packages"
paru -S --needed \
networkmanager networkmanager-openvpn network-manager-applet \
dhclient dnsmasq iptables-nft iwd wpa_supplicant wireless-regdb \
bluez-libs blueman openssh
}
install_audio_video() {
log_info "Installing audio and video packages"
paru -S --needed \
pipewire pipewire-alsa pipewire-pulse wireplumber \
pavucontrol alsa-firmware alsa-plugins alsa-utils \
gst-libav gst-plugin-pipewire gst-plugins-bad gst-plugins-ugly \
mpv ffmpegthumbnailer
}
install_fonts_themes() {
log_info "Installing fonts and themes"
paru -S --needed \
adobe-source-han-sans-cn-fonts adobe-source-han-sans-jp-fonts \
adobe-source-han-sans-kr-fonts adobe-source-serif-fonts \
awesome-terminal-fonts inter-font noto-fonts noto-fonts-cjk noto-fonts-emoji \
ttf-bitstream-vera ttf-dejavu ttf-fantasque-nerd ttf-fira-code ttf-fira-mono \
ttf-fira-sans ttf-font-awesome-5 ttf-liberation ttf-linux-libertine \
ttf-meslo-nerd ttf-ms-win11-auto ttf-opensans otf-font-awesome-5 otf-libertinus \
papirus-icon-theme rose-pine-gtk-theme
}
install_development() {
log_info "Installing development tools"
paru -S --needed \
git git-lfs git-crypt github-cli lazygit \
go go-task python python-defusedxml python-packaging \
python-protobuf python-pynvim python-pywlroots lua luarocks \
ccls cmake ninja neovim-nightly-bin
}
install_cli_utilities() {
log_info "Installing CLI utilities"
paru -S --needed \
bat btop duf dysk dust eza fd fzf glances glow httpie ncdu \
plocate ripgrep tealdeer the_silver_searcher tmux wget \
xdg-user-dirs zoxide yazi yq zsh
}
install_window_managers() {
log_info "Installing window managers and desktop environment"
paru -S --needed \
swaybg swayfx-git swayidle swaylock-effects waybar \
wlogout wdisplays wl-clipboard rofi-lbonn-wayland-git
}
install_gui_applications() {
log_info "Installing GUI applications"
paru -S --needed \
chromium zen-browser-bin \
legcord-bin slack-desktop teams-for-linux-bin \
obs-studio obsidian sublime-merge dbeaver \
libreoffice-fresh kitty nemo nemo-fileroller
}
install_system_utilities() {
log_info "Installing system utilities"
paru -S --needed \
brightnessctl cronie cups cups-pdf gamemode gvfs gvfs-afc gvfs-google \
gvfs-gphoto2 gvfs-mtp gvfs-nfs gvfs-smb haveged hdparm less lvm2 \
man-db man-pages meld modemmanager mtools mupdf netctl nss-mdns \
ntfs-3g ntp nvme-cli opencl-mesa pacman-contrib pass pika-backup \
pkgfile power-profiles-daemon pv reflector remmina rsync rtkit \
samba seahorse sg3_utils smartmontools snapper solaar steam \
steam-native-runtime syncthing system-config-printer \
transmission-qt ufw unrar unzip upower usb_modeswitch usbutils \
vi vorta w3m which xdg-desktop-portal xdg-desktop-portal-gnome \
xdg-desktop-portal-gtk xdg-desktop-portal-wlr yad zenity
}
install_gaming_graphics() {
log_info "Installing gaming and graphics packages"
local gaming_base="lib32-alsa-lib lib32-alsa-plugins lib32-gamemode lib32-libpulse lib32-mesa lib32-openal lib32-vkd3d lib32-vulkan-mesa-layers vkd3d vulkan-mesa-layers vulkan-tools vulkan-validation-layers wine protonup-qt"
if [[ -n "$gpu_packages" ]]; then
paru -S --needed $gaming_base $gpu_packages
else
paru -S --needed $gaming_base
fi
}
install_hardware_support() {
log_info "Installing hardware support"
paru -S --needed \
sof-firmware xf86-input-libinput xfsprogs \
xorg-server xorg-xdpyinfo xorg-xhost xorg-xinit xorg-xinput \
xorg-xkill xorg-xrandr xorg-xwayland
}
install_cloud_devops() {
log_info "Installing cloud and DevOps tools"
paru -S --needed \
aws-cli aws-session-manager-plugin insomnia-bin \
kubectl kubectx kubefwd-bin ngrok postgresql
}
install_document_tools() {
log_info "Installing document and productivity tools"
paru -S --needed \
pandoc-cli texinfo wkhtmltopdf-bin zathura zathura-pdf-mupdf \
swappy wf-recorder
}
install_security_tools() {
log_info "Installing security tools"
paru -S --needed \
yubico-authenticator-bin yubikey-manager-qt
}
install_misc_packages() {
log_info "Installing miscellaneous packages"
paru -S --needed \
pyenv watchman-bin wimlib \
slurp grim swaync gum nwg-look lxsession colordiff
log_info "Updating tldr database"
tldr --update
}
main() {
init_script
check_requirements
detect_hardware
install_base_system
install_networking
install_audio_video
install_fonts_themes
install_development
install_cli_utilities
install_window_managers
install_gui_applications
install_system_utilities
install_gaming_graphics
install_hardware_support
install_cloud_devops
install_document_tools
install_security_tools
install_misc_packages
finish_script 0
}
main "$@"