| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- #!/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
- }
- # Global variables for hardware detection
- MICROCODE=""
- GPU_PACKAGES=""
- 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
- 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
- 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
- GPU_PACKAGES=""
- 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 easyeffects lsp-plugins-lv2
- }
- 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-liberation ttf-linux-libertine \
- ttf-meslo-nerd ttf-opensans otf-libertinus \
- papirus-icon-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 swayidle swaylock-effects waybar \
- wlogout wdisplays wl-clipboard
- }
- install_gui_applications() {
- log_info "Installing GUI applications"
- paru -S --needed \
- chromium zen-browser-bin \
- legcord-bin \
- obs-studio obsidian 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 localsend 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 \
- kubectl kubectx 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 \
- yubikey-manager-qt
- }
- install_misc_packages() {
- log_info "Installing miscellaneous packages"
- paru -S --needed \
- pyenv 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 "$@"
|