Skip to content

Commit 00a043e

Browse files
dwalleckclaude
andcommitted
Fix CachyOS repository database errors during build
The build was failing because CachyOS repositories were configured in pacman.conf but the cachyos-mirrorlist file didn't exist or had no enabled mirrors. This caused pacman to fail when trying to sync repository databases. Changes: 1. Create /etc/pacman.d/cachyos-mirrorlist if it doesn't exist - Uses official CachyOS CDN: https://cdn.cachyos.org/repo/ - Enables existing mirrors if file exists but commented out 2. Only add CachyOS repos if cachyos-mirrorlist is available - Prevents configuration errors 3. Make jq installation more robust - Syncs databases before installing - Continues build even if some repos fail to sync - Allows validation to proceed with warnings if jq unavailable This fixes the GitHub Actions build failures where pacman reported "database file for 'cachyos' does not exist". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5859ca7 commit 00a043e

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

build/build-rootfs.sh

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,33 @@ else
205205
echo " - Warning: /etc/pacman.conf not found, skipping Color configuration"
206206
fi
207207

208+
# Configure CachyOS mirrorlist
209+
# Check if cachyos-mirrorlist exists, if not create it with default mirror
210+
CACHYOS_MIRRORLIST="$ROOTFS_DIR/etc/pacman.d/cachyos-mirrorlist"
211+
if [ -f "$CACHYOS_MIRRORLIST" ]; then
212+
echo " - Enabling CachyOS mirrors in cachyos-mirrorlist"
213+
# Try to enable existing mirrors if they're commented out
214+
sed -i 's|^#Server|Server|' "$CACHYOS_MIRRORLIST" || true
215+
else
216+
echo " - Creating cachyos-mirrorlist with default mirror"
217+
mkdir -p "$ROOTFS_DIR/etc/pacman.d"
218+
cat > "$CACHYOS_MIRRORLIST" <<'EOF'
219+
##
220+
## CachyOS repository mirrorlist
221+
##
222+
223+
## Worldwide
224+
Server = https://cdn.cachyos.org/repo/$arch/$repo
225+
EOF
226+
echo " - Created cachyos-mirrorlist"
227+
fi
228+
229+
# Note: CachyOS GPG keys will be initialized during OOBE
230+
# The OOBE script runs: pacman-key --init && pacman-key --populate archlinux cachyos
231+
208232
# Add CachyOS optimized repositories (x86-64-v3 for broad compatibility)
209233
# These must be BEFORE standard Arch repos to take priority
210-
if [ -f "$ROOTFS_DIR/etc/pacman.conf" ]; then
234+
if [ -f "$ROOTFS_DIR/etc/pacman.conf" ] && [ -f "$CACHYOS_MIRRORLIST" ]; then
211235
echo " - Adding CachyOS optimized repositories (x86-64-v3)"
212236
# Insert CachyOS repos before [core]
213237
sed -i '/^\[core\]/i \
@@ -229,7 +253,7 @@ Include = /etc/pacman.d/cachyos-mirrorlist\
229253
' "$ROOTFS_DIR/etc/pacman.conf"
230254
echo " - Added cachyos-v3, cachyos-core-v3, cachyos-extra-v3, and cachyos repositories"
231255
else
232-
echo " - Warning: /etc/pacman.conf not found, skipping CachyOS repository configuration"
256+
echo " - Warning: Cannot add CachyOS repositories (missing pacman.conf or cachyos-mirrorlist)"
233257
fi
234258

235259
# Enable some Arch mirrors in mirrorlist
@@ -262,7 +286,10 @@ echo "==> Validating rootfs..."
262286
# Ensure jq is installed on build host for JSON validation
263287
if ! command -v jq &> /dev/null; then
264288
echo " - Installing jq for JSON validation..."
265-
pacman -S --noconfirm jq
289+
# Sync databases first, then install jq
290+
# Use || true to continue even if CachyOS repos fail
291+
pacman -Sy --noconfirm 2>&1 || echo "Warning: Some repository databases failed to sync"
292+
pacman -S --noconfirm jq 2>&1 || echo "Warning: Failed to install jq, JSON validation will be limited"
266293
fi
267294

268295
VALIDATE_SCRIPT="$SCRIPT_DIR/validate.sh"

0 commit comments

Comments
 (0)