fix: improve dependency installation diagnostics

Install mode-switch dependencies, support a69c:572f, avoid redundant generic headers when a usable kernel build tree exists, and discover DKMS logs dynamically. Addresses installer portions of #28, #55, #65, #66, and #68.
This commit is contained in:
Shen Mintao
2026-07-14 17:23:53 +08:00
parent 0ed5afba03
commit 7dc7569312
3 changed files with 163 additions and 61 deletions
+90 -30
View File
@@ -17,6 +17,29 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
DRV_NAME="aic8800"
DRV_VERSION="1.0.0"
INSTALL_LOG="/tmp/aic8800d80_install.log"
read_dkms_conf_value() {
local key="$1"
local file="$2"
grep -E "^[[:space:]]*${key}[[:space:]]*=" "$file" 2>/dev/null \
| head -1 \
| cut -d= -f2- \
| tr -d "\"'[:space:]"
}
if [ -f "./dkms.conf" ]; then
detected_name="$(read_dkms_conf_value PACKAGE_NAME ./dkms.conf)"
detected_version="$(read_dkms_conf_value PACKAGE_VERSION ./dkms.conf)"
[ -n "$detected_name" ] && DRV_NAME="$detected_name"
[ -n "$detected_version" ] && DRV_VERSION="$detected_version"
fi
mapfile -t DKMS_SOURCE_DIRS < <(find /usr/src -maxdepth 1 -type d -name "${DRV_NAME}-*" -print 2>/dev/null | sort)
print_section() {
echo ""
echo -e "${BLUE}━━━ $1 ━━━${NC}"
@@ -58,46 +81,73 @@ fi
print_section "2. Checking DKMS directory"
if [ -d "/usr/src/aic8800-1.0.0" ]; then
echo -e "${GREEN}✓${NC} /usr/src/aic8800-1.0.0 directory exists"
echo ""
echo "Content:"
ls -la /usr/src/aic8800-1.0.0/
echo ""
echo "Checking drivers/aic8800 inside DKMS:"
if [ -d "/usr/src/aic8800-1.0.0/drivers/aic8800" ]; then
echo -e "${GREEN}✓${NC} drivers/aic8800 copied to DKMS"
ls -la /usr/src/aic8800-1.0.0/drivers/aic8800/
else
echo -e "${RED}✗${NC} drivers/aic8800 NOT copied correctly!"
fi
echo "Detected package: ${DRV_NAME}/${DRV_VERSION}"
if [ "${#DKMS_SOURCE_DIRS[@]}" -gt 0 ]; then
for source_dir in "${DKMS_SOURCE_DIRS[@]}"; do
echo -e "${GREEN}✓${NC} $source_dir directory exists"
echo ""
echo "Content:"
ls -la "$source_dir/"
echo ""
echo "Checking drivers/aic8800 inside DKMS:"
if [ -d "$source_dir/drivers/aic8800" ]; then
echo -e "${GREEN}✓${NC} drivers/aic8800 copied to DKMS"
ls -la "$source_dir/drivers/aic8800/"
else
echo -e "${RED}✗${NC} drivers/aic8800 NOT copied correctly!"
fi
echo ""
done
else
echo -e "${RED}✗${NC} /usr/src/aic8800-1.0.0 directory NOT FOUND"
echo -e "${RED}✗${NC} No /usr/src/${DRV_NAME}-* directory found"
fi
print_section "3. Checking DKMS build logs"
if [ -f "/var/lib/dkms/aic8800/1.0.0/build/make.log" ]; then
echo -e "${GREEN}✓${NC} Build log found"
mapfile -t BUILD_LOGS < <(find "/var/lib/dkms/${DRV_NAME}" -type f -name make.log -print 2>/dev/null | sort)
if [ "${#BUILD_LOGS[@]}" -gt 0 ]; then
for build_log in "${BUILD_LOGS[@]}"; do
echo -e "${GREEN}✓${NC} Build log found: $build_log"
echo ""
echo "Last 50 lines of make.log:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
tail -50 "$build_log"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
done
else
echo -e "${RED}✗${NC} No make.log found under /var/lib/dkms/${DRV_NAME}/"
echo "The module may not have reached the build step yet, or this DKMS version stores logs elsewhere."
fi
if [ -f "$INSTALL_LOG" ]; then
echo ""
echo "Last 50 lines of make.log:"
echo -e "${GREEN}✓${NC} Installer log found: $INSTALL_LOG"
echo "Last 50 lines of installer log:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
tail -50 /var/lib/dkms/aic8800/1.0.0/build/make.log
tail -50 "$INSTALL_LOG"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
else
echo -e "${RED}✗${NC} Build log not found in /var/lib/dkms/aic8800/1.0.0/build/make.log"
echo -e "${YELLOW}!${NC} Installer log not found: $INSTALL_LOG"
fi
print_section "4. Checking dkms.conf"
if [ -f "/usr/src/aic8800-1.0.0/dkms.conf" ]; then
echo -e "${GREEN}✓${NC} dkms.conf found"
echo ""
echo "dkms.conf content:"
cat /usr/src/aic8800-1.0.0/dkms.conf
if [ "${#DKMS_SOURCE_DIRS[@]}" -gt 0 ]; then
for source_dir in "${DKMS_SOURCE_DIRS[@]}"; do
if [ -f "$source_dir/dkms.conf" ]; then
echo -e "${GREEN}✓${NC} dkms.conf found: $source_dir/dkms.conf"
echo ""
cat "$source_dir/dkms.conf"
echo ""
else
echo -e "${RED}✗${NC} dkms.conf NOT FOUND in $source_dir"
fi
done
else
echo -e "${RED}✗${NC} dkms.conf NOT FOUND!"
echo -e "${RED}✗${NC} No DKMS source directory available to inspect"
fi
if [ -f "./dkms.conf" ]; then
@@ -120,13 +170,23 @@ print_section "6. System information"
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
echo ""
echo "GCC version:"
gcc --version | head -1
echo "Compiler version:"
if command -v gcc >/dev/null 2>&1; then
gcc --version | head -1
elif command -v clang >/dev/null 2>&1; then
clang --version | head -1
else
echo "No gcc or clang found"
fi
echo ""
echo "Installed kernel headers:"
ls -d /lib/modules/$(uname -r)/build 2>/dev/null && echo "✓ Headers found" || echo "✗ Headers NOT found"
ls -d "/lib/modules/$(uname -r)/build" 2>/dev/null && echo "✓ Headers found" || echo "✗ Headers NOT found"
print_section "7. DKMS status"
echo "DKMS modules registered:"
dkms status
if command -v dkms >/dev/null 2>&1; then
dkms status
else
echo -e "${RED}✗${NC} dkms command not found"
fi