fix: Arch Linux package database sync and dpkg pattern matching

Fix two issues preventing installer tests from passing:

1. Arch Linux: Sync package database before installing packages
   - Fresh Arch containers have no package database (core, extra)
   - Added pacman -Sy before pacman -S in both basic prereqs and system deps
   - Error was: "warning: database file for 'core' does not exist"
   - Applied to both root and non-root installation paths

2. Debian/Ubuntu: Fix package check pattern for architecture suffixes
   - dpkg shows packages as "python3-cairo:amd64" not "python3-cairo "
   - Changed grep pattern from "^ii  $pkg " to "^ii  $pkg"
   - Now matches packages with or without :amd64/:arm64 suffixes
   - Error was: "FAIL: python3-cairo not installed" (even though it was)

Changes:
- install.sh lines 132-134, 233-234: Add pacman -Sy sync before install
- tests/test_installer.sh line 41: Fix dpkg grep pattern

This allows all 5 OS versions to pass:
- Debian 12 (Bookworm)
- Debian Trixie (testing)
- Ubuntu 22.04 LTS
- Ubuntu 24.04 LTS
- Arch Linux (rolling) [NEW]

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
torlando-tech 2025-10-28 21:07:08 -04:00
commit 3ad8ffffcf
2 changed files with 8 additions and 1 deletions

View file

@ -129,8 +129,11 @@ elif command -v pacman &> /dev/null; then
print_info "Installing basic prerequisites: ${MISSING_PACKAGES[*]}"
# Use sudo only if not running as root
if [ "$EUID" -eq 0 ]; then
# Sync package database first (required in fresh containers)
pacman -Sy --noconfirm
pacman -S --noconfirm ${MISSING_PACKAGES[*]}
else
sudo pacman -Sy --noconfirm
sudo pacman -S --noconfirm ${MISSING_PACKAGES[*]}
fi
print_success "Basic prerequisites installed"
@ -226,8 +229,11 @@ elif command -v pacman &> /dev/null; then
echo "Installing: python-pip python-gobject python-dbus python-cairo bluez bluez-utils"
# Use sudo only if not running as root
if [ "$EUID" -eq 0 ]; then
# Sync package database first (may have been synced in basic prereqs, but ensure it's current)
pacman -Sy --noconfirm
pacman -S --noconfirm python-pip python-gobject python-dbus python-cairo bluez bluez-utils
else
sudo pacman -Sy --noconfirm
sudo pacman -S --noconfirm python-pip python-gobject python-dbus python-cairo bluez bluez-utils
fi
print_success "System dependencies installed (using pre-compiled system packages)"

View file

@ -37,7 +37,8 @@ echo ""
check_package() {
local pkg="$1"
if [ "$OS_TYPE" = "debian" ]; then
dpkg -l | grep -q "^ii $pkg " || { echo "FAIL: $pkg not installed"; exit 1; }
# Match package with or without architecture suffix (e.g., python3-cairo:amd64)
dpkg -l | grep -q "^ii $pkg" || { echo "FAIL: $pkg not installed"; exit 1; }
elif [ "$OS_TYPE" = "arch" ]; then
pacman -Q "$pkg" &> /dev/null || { echo "FAIL: $pkg not installed"; exit 1; }
fi