Dorian ba1a7bd3f6 Enhance README and build scripts for hardware-specific optimizations
- Updated README.md to clarify development setup for macOS/Docker and added production build instructions for specific hardware.
- Introduced new build scripts for optimized OS images targeting Start9 Server Pure, HP ProDesk 400 G4 DM, and Dell OptiPlex.
- Enhanced Dockerfile to specify platform compatibility and improved Alpine profile for Archipelago builds.
- Updated configuration files and init scripts to support new hardware profiles and ensure proper service management.
2026-01-31 19:47:52 +00:00

72 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Hardware detection and optimization script
# Auto-generated for specific hardware target
detect_hardware() {
echo "=== Hardware Detection ==="
# CPU info
if [ -f /proc/cpuinfo ]; then
echo "CPU: $(grep 'model name' /proc/cpuinfo | head -1 | cut -d':' -f2 | xargs)"
echo "Cores: $(grep -c processor /proc/cpuinfo)"
fi
# Memory
if [ -f /proc/meminfo ]; then
echo "Memory: $(grep MemTotal /proc/meminfo | awk '{printf "%.1f GB", $2/1024/1024}')"
fi
# Storage
if command -v lsblk >/dev/null 2>&1; then
echo "Storage:"
lsblk -d -o NAME,SIZE,TYPE | grep disk
fi
# Network
if command -v ip >/dev/null 2>&1; then
echo "Network interfaces:"
ip -br link show | grep -v lo
fi
# PCI devices (for hardware identification)
if command -v lspci >/dev/null 2>&1; then
echo "PCI devices:"
lspci | grep -E "VGA|Ethernet|Network"
fi
}
optimize_for_hardware() {
echo "=== Hardware Optimization ==="
# Load Intel microcode if Intel CPU
if grep -q Intel /proc/cpuinfo; then
echo "Intel CPU detected, loading microcode..."
modprobe intel_rapl_common 2>/dev/null || true
modprobe intel_powerclamp 2>/dev/null || true
fi
# Enable hardware acceleration for graphics
if lspci | grep -q "Intel.*Graphics"; then
echo "Intel Graphics detected"
modprobe i915 2>/dev/null || true
fi
# Optimize for NVMe if present
if [ -e /dev/nvme0n1 ]; then
echo "NVMe SSD detected, optimizing..."
echo none > /sys/block/nvme0n1/queue/scheduler 2>/dev/null || true
fi
# Optimize for SATA SSD if present
if [ -e /dev/sda ]; then
if hdparm -I /dev/sda 2>/dev/null | grep -q "Solid State"; then
echo "SATA SSD detected, optimizing..."
echo deadline > /sys/block/sda/queue/scheduler 2>/dev/null || true
fi
fi
}
# Run detection
detect_hardware
optimize_for_hardware