From be6ca7f40a7d8bc79c86a1f8f07dd179289ea52b Mon Sep 17 00:00:00 2001 From: "Mariano Z." Date: Thu, 17 Jul 2025 13:52:40 -0300 Subject: [PATCH] dev: automated commit - 2025-07-17 13:52:40 --- runs/base | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/runs/base b/runs/base index 21f681b..83fbe96 100755 --- a/runs/base +++ b/runs/base @@ -9,15 +9,25 @@ source "$(dirname "$0")/../common.sh" || { 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 + + # Check if running with sudo + if [[ $EUID -ne 0 ]]; then + log_error "This script must be run with sudo privileges" + exit 1 + fi } detect_hardware() { - local cpu_vendor gpu_info microcode gpu_packages + local cpu_vendor gpu_info cpu_vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}') gpu_info=$(lspci | grep -i vga) @@ -26,34 +36,33 @@ detect_hardware() { log_info "Detected GPU: $gpu_info" # Determine microcode package - microcode="" case "$cpu_vendor" in "GenuineIntel") - microcode="intel-ucode" + MICROCODE="intel-ucode" log_info "Using Intel microcode" ;; "AuthenticAMD") - microcode="amd-ucode" + MICROCODE="amd-ucode" log_info "Using AMD microcode" ;; *) - 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" + 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" + 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" + 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 } @@ -63,8 +72,8 @@ install_base_system() { 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" + if [[ -n "$MICROCODE" ]]; then + base_packages="$base_packages $MICROCODE" fi paru -S --needed --overwrite="*" $base_packages @@ -162,8 +171,8 @@ install_gaming_graphics() { 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 + if [[ -n "$GPU_PACKAGES" ]]; then + paru -S --needed $gaming_base $GPU_PACKAGES else paru -S --needed $gaming_base fi