|
@@ -9,15 +9,25 @@ source "$(dirname "$0")/../common.sh" || {
|
|
|
exit 1
|
|
exit 1
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+# Global variables for hardware detection
|
|
|
|
|
+MICROCODE=""
|
|
|
|
|
+GPU_PACKAGES=""
|
|
|
|
|
+
|
|
|
check_requirements() {
|
|
check_requirements() {
|
|
|
if ! command_exists paru; then
|
|
if ! command_exists paru; then
|
|
|
log_error "paru not found. Install it first"
|
|
log_error "paru not found. Install it first"
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
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() {
|
|
detect_hardware() {
|
|
|
- local cpu_vendor gpu_info microcode gpu_packages
|
|
|
|
|
|
|
+ local cpu_vendor gpu_info
|
|
|
|
|
|
|
|
cpu_vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}')
|
|
cpu_vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}')
|
|
|
gpu_info=$(lspci | grep -i vga)
|
|
gpu_info=$(lspci | grep -i vga)
|
|
@@ -26,34 +36,33 @@ detect_hardware() {
|
|
|
log_info "Detected GPU: $gpu_info"
|
|
log_info "Detected GPU: $gpu_info"
|
|
|
|
|
|
|
|
# Determine microcode package
|
|
# Determine microcode package
|
|
|
- microcode=""
|
|
|
|
|
case "$cpu_vendor" in
|
|
case "$cpu_vendor" in
|
|
|
"GenuineIntel")
|
|
"GenuineIntel")
|
|
|
- microcode="intel-ucode"
|
|
|
|
|
|
|
+ MICROCODE="intel-ucode"
|
|
|
log_info "Using Intel microcode"
|
|
log_info "Using Intel microcode"
|
|
|
;;
|
|
;;
|
|
|
"AuthenticAMD")
|
|
"AuthenticAMD")
|
|
|
- microcode="amd-ucode"
|
|
|
|
|
|
|
+ MICROCODE="amd-ucode"
|
|
|
log_info "Using AMD microcode"
|
|
log_info "Using AMD microcode"
|
|
|
;;
|
|
;;
|
|
|
*)
|
|
*)
|
|
|
- microcode=""
|
|
|
|
|
|
|
+ MICROCODE=""
|
|
|
log_warn "Unknown CPU vendor, skipping microcode"
|
|
log_warn "Unknown CPU vendor, skipping microcode"
|
|
|
;;
|
|
;;
|
|
|
esac
|
|
esac
|
|
|
|
|
|
|
|
# Determine GPU drivers
|
|
# Determine GPU drivers
|
|
|
- gpu_packages=""
|
|
|
|
|
if echo "$gpu_info" | grep -qi "amd\|radeon"; then
|
|
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"
|
|
log_info "Using AMD GPU drivers"
|
|
|
elif echo "$gpu_info" | grep -qi "intel"; then
|
|
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"
|
|
log_info "Using Intel GPU drivers"
|
|
|
elif echo "$gpu_info" | grep -qi "nvidia"; then
|
|
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"
|
|
log_info "Using NVIDIA drivers"
|
|
|
else
|
|
else
|
|
|
|
|
+ GPU_PACKAGES=""
|
|
|
log_warn "Unknown GPU, using generic drivers"
|
|
log_warn "Unknown GPU, using generic drivers"
|
|
|
fi
|
|
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"
|
|
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
|
|
fi
|
|
|
|
|
|
|
|
paru -S --needed --overwrite="*" $base_packages
|
|
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
|
|
lib32-vkd3d lib32-vulkan-mesa-layers vkd3d vulkan-mesa-layers vulkan-tools vulkan-validation-layers
|
|
|
wine protonup-qt"
|
|
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
|
|
else
|
|
|
paru -S --needed $gaming_base
|
|
paru -S --needed $gaming_base
|
|
|
fi
|
|
fi
|