#!/usr/bin/env bash # =========================================================================== # Stage 11: System Tweaks # sysctl tuning, kernel cmdline parameters, TLP/powertop, modprobe. # Uses distro-agnostic variables from lib/distro.sh. # =========================================================================== # CAUTION: GPU kernel parameters are hardware-specific (AMD Radeon 680M). # They are COMMENTED OUT by default. Uncomment only if you have the same GPU. # =========================================================================== CONFIG_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}/config" # =========================================================================== # 1. TLP / PowerTOP # =========================================================================== info "Configuring power management..." $SERVICE_ENABLE tlp 2>/dev/null && ok "TLP enabled." || warn "TLP not available." if command -v powertop &>/dev/null; then # Enable powertop auto-tune via systemd service if [ ! -f /etc/systemd/system/powertop.service ]; then sudo tee /etc/systemd/system/powertop.service > /dev/null << 'EOF' [Unit] Description=PowerTOP auto tune [Service] Type=oneshot ExecStart=/usr/sbin/powertop --auto-tune [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload fi $SERVICE_ENABLE powertop 2>/dev/null && ok "PowerTOP auto-tune enabled." || true fi ok "Stage 11 complete: system tweaks applied."