mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 21:27:02 +01:00
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.
Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.
The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:
- 52 relative `source` lines for lib/common.sh and lib/android.sh. The
correct prefix differs per file: 40 were ../../ and 12 were ../../../,
so a blanket replace would have fixed one set and broken the other.
- REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
each walking up four levels from a directory now two levels shallower.
This caused a real regression -- the fixes suite went red with
"log_warn: command not found" -- caught by running it and comparing
against the pre-move baseline worktree.
- conftest.py's sys.path entries, which took the pytest gate down with
14 collection errors, and the `# shellcheck source=` directives, which
took shellcheck down with SC1091.
16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.
Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
109 lines
3.8 KiB
Bash
Executable File
109 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Intel GPU installation & configuration script (open source stack)
|
|
# Expects GPU_VENDOR=intel
|
|
# Environment overrides:
|
|
# INTEL_USE_AMBER=0/1 # use mesa-amber instead of mesa (legacy Gen2-11 classic drivers)
|
|
# INTEL_INSTALL_LIB32=auto/1/0 # install 32-bit libs (auto: only if multilib enabled) default auto
|
|
# INTEL_INSTALL_VULKAN=1/0 # install vulkan-intel (default 1)
|
|
# INTEL_INSTALL_LIB32_VK=auto/1/0 # 32-bit vulkan driver (auto: if 32-bit mesa installed) default auto
|
|
# INTEL_INSTALL_XF86=0/1 # install xf86-video-intel legacy DDX (default 0, not recommended)
|
|
# INTEL_ENABLE_GUC= # empty (do nothing) or 0/1/2/3 value to set enable_guc= kernel param
|
|
# INTEL_SKIP_INITRAMFS=0/1 # skip mkinitcpio regeneration (default 0)
|
|
# INTEL_VERBOSE=0/1 # verbose logging
|
|
set -e
|
|
|
|
[ "$GPU_VENDOR" = "intel" ] || {
|
|
echo "Intel installer invoked but GPU_VENDOR=$GPU_VENDOR"
|
|
exit 0
|
|
}
|
|
|
|
INTEL_USE_AMBER=${INTEL_USE_AMBER:-0}
|
|
INTEL_INSTALL_LIB32=${INTEL_INSTALL_LIB32:-auto}
|
|
INTEL_INSTALL_VULKAN=${INTEL_INSTALL_VULKAN:-1}
|
|
INTEL_INSTALL_LIB32_VK=${INTEL_INSTALL_LIB32_VK:-auto}
|
|
INTEL_INSTALL_XF86=${INTEL_INSTALL_XF86:-0}
|
|
INTEL_ENABLE_GUC=${INTEL_ENABLE_GUC:-}
|
|
INTEL_SKIP_INITRAMFS=${INTEL_SKIP_INITRAMFS:-0}
|
|
INTEL_VERBOSE=${INTEL_VERBOSE:-1}
|
|
|
|
vlog() { if [ "$INTEL_VERBOSE" = 1 ]; then echo "[intel] $*"; fi; }
|
|
info() { echo "[intel] $*"; }
|
|
warn() { echo "[intel][warn] $*" >&2; }
|
|
|
|
# Detect multilib
|
|
if grep -q '^\[multilib\]' /etc/pacman.conf; then MULTILIB=1; else MULTILIB=0; fi
|
|
|
|
# Base mesa package
|
|
if [ "$INTEL_USE_AMBER" = 1 ]; then
|
|
BASE_MESA=mesa-amber
|
|
LIB32_BASE=lib32-mesa-amber
|
|
else
|
|
BASE_MESA=mesa
|
|
LIB32_BASE=lib32-mesa
|
|
fi
|
|
|
|
install_pkg() {
|
|
local pkg="$1"
|
|
if pacman -Qi "$pkg" > /dev/null 2>&1; then
|
|
vlog "$pkg already installed"
|
|
else
|
|
if pacman -Si "$pkg" > /dev/null 2>&1; then
|
|
yes | sudo pacman -Sy --noconfirm "$pkg"
|
|
else
|
|
warn "Package $pkg not found in repos (not handling AUR here)"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
info "Installing Intel GPU stack"
|
|
install_pkg "$BASE_MESA"
|
|
|
|
# 32-bit mesa
|
|
if { [ "$INTEL_INSTALL_LIB32" = auto ] && [ $MULTILIB = 1 ]; } || [ "$INTEL_INSTALL_LIB32" = 1 ]; then
|
|
install_pkg "$LIB32_BASE"
|
|
else
|
|
vlog "Skipping 32-bit mesa (INTEL_INSTALL_LIB32=$INTEL_INSTALL_LIB32 MULTILIB=$MULTILIB)"
|
|
fi
|
|
|
|
# Vulkan
|
|
if [ "$INTEL_INSTALL_VULKAN" = 1 ]; then
|
|
install_pkg vulkan-intel
|
|
if { [ "$INTEL_INSTALL_LIB32_VK" = auto ] && [ $MULTILIB = 1 ]; } || [ "$INTEL_INSTALL_LIB32_VK" = 1 ]; then
|
|
install_pkg lib32-vulkan-intel
|
|
else
|
|
vlog "Skipping 32-bit vulkan (INTEL_INSTALL_LIB32_VK=$INTEL_INSTALL_LIB32_VK MULTILIB=$MULTILIB)"
|
|
fi
|
|
fi
|
|
|
|
# Legacy xf86-video-intel (not recommended)
|
|
if [ "$INTEL_INSTALL_XF86" = 1 ]; then
|
|
install_pkg xf86-video-intel
|
|
else
|
|
vlog "Not installing xf86-video-intel (INTEL_INSTALL_XF86=$INTEL_INSTALL_XF86)"
|
|
fi
|
|
|
|
# GuC / HuC enablement
|
|
if [ -n "$INTEL_ENABLE_GUC" ]; then
|
|
if ! echo "$INTEL_ENABLE_GUC" | grep -Eq '^[0-3]$'; then
|
|
warn "INTEL_ENABLE_GUC must be 0..3; ignoring"
|
|
else
|
|
info "Configuring enable_guc=$INTEL_ENABLE_GUC"
|
|
sudo mkdir -p /etc/modprobe.d
|
|
echo "options i915 enable_guc=$INTEL_ENABLE_GUC" | sudo tee /etc/modprobe.d/i915-guc.conf > /dev/null
|
|
if [ "$INTEL_SKIP_INITRAMFS" != 1 ] && [ -f /etc/mkinitcpio.conf ]; then
|
|
info "Regenerating initramfs (mkinitcpio -P) for GuC/HuC change"
|
|
sudo mkinitcpio -P || warn "mkinitcpio failed; continue manually"
|
|
else
|
|
info "Skipping initramfs regeneration (INTEL_SKIP_INITRAMFS=$INTEL_SKIP_INITRAMFS)"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Report kernel driver
|
|
KDRV=$(lspci -k -d ::0300 2> /dev/null | awk '/Kernel driver in use:/ {print $5; exit}')
|
|
[ -z "$KDRV" ] && KDRV=$(lsmod | grep -E 'i915|xe' | head -n1 | awk '{print $1}')
|
|
info "Kernel driver in use: ${KDRV:-unknown}"
|
|
|
|
info "Intel GPU stack installation complete"
|
|
export INTEL_STACK_DONE=1
|