tweaks to the sync script

This commit is contained in:
2025-11-25 15:15:30 -07:00
parent 50a4476a01
commit 5ce2d6a6ec

View File

@@ -1,63 +1,64 @@
#!/bin/bash
set -e
BASE_URL="https://repo.rakuos.org/dists"
COMPONENTS=(main contrib non-free)
ARCH=$(dpkg --print-architecture)
APT_LIST_DIR="/var/lib/apt/lists"
SOURCES_FILE="/etc/apt/sources.list.d/rakuos.sources"
# Fetch list of suites from server
SUITES=$(wget -qO- "$BASE_URL/" | grep -oP '(?<=href=")[^"/]+(?=/")')
if [[ -z "$SUITES" ]]; then
echo "Error: No suites found at $BASE_URL"
# Parse suites from rakuos.sources
if [[ ! -f "$SOURCES_FILE" ]]; then
echo "Error: $SOURCES_FILE not found"
exit 1
fi
echo "Detected suites: $SUITES"
echo
# Extract suites from the file (handles both single and multi-line format)
SUITES=$(grep -E "^Suites:" "$SOURCES_FILE" | sed 's/^Suites://;s/,/ /g' | xargs)
if [[ -z "$SUITES" ]]; then
echo "Error: No suites found in $SOURCES_FILE"
exit 1
fi
for SUITE in $SUITES; do
echo "=== Processing suite: $SUITE ==="
for comp in "${COMPONENTS[@]}"; do
COMP_URL="$BASE_URL/$SUITE/$comp/dep11"
YAML_FILE="$COMP_URL/Components-$ARCH.yml.gz"
ICON_FILE48="$COMP_URL/icons-48x48.tar.gz"
ICON_FILE64="$COMP_URL/icons-64x64.tar.gz"
ICON_FILE128="$COMP_URL/icons-128x128.tar.gz"
# DEP-11 YAML
if wget -q -O \
"$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_Components-${ARCH}.yml.gz" \
"$YAML_FILE"; then
echo "Fetched DEP11 YAML for $SUITE / $comp"
OUT_FILE="$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_Components-${ARCH}.yml.gz"
if wget -q -O "$OUT_FILE" "$YAML_FILE"; then
if ! gzip -t "$OUT_FILE" 2>/dev/null; then
rm -f "$OUT_FILE"
fi
fi
# 48px icons
if wget -q -O \
"$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-48x48.tar.gz" \
"$ICON_FILE48"; then
echo "Fetched 48x48 icons for $SUITE / $comp"
OUT_FILE="$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-48x48.tar.gz"
if wget -q -O "$OUT_FILE" "$ICON_FILE48"; then
if ! tar -tzf "$OUT_FILE" >/dev/null 2>&1; then
rm -f "$OUT_FILE"
fi
fi
# 64px icons
if wget -q -O \
"$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-64x64.tar.gz" \
"$ICON_FILE64"; then
echo "Fetched 64x64 icons for $SUITE / $comp"
OUT_FILE="$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-64x64.tar.gz"
if wget -q -O "$OUT_FILE" "$ICON_FILE64"; then
if ! tar -tzf "$OUT_FILE" >/dev/null 2>&1; then
rm -f "$OUT_FILE"
fi
fi
# 128px icons
if wget -q -O \
"$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-128x128.tar.gz" \
"$ICON_FILE128"; then
echo "Fetched 128x128 icons for $SUITE / $comp"
OUT_FILE="$APT_LIST_DIR/repo.rakuos.org_dists_${SUITE}_${comp}_dep11_icons-128x128.tar.gz"
if wget -q -O "$OUT_FILE" "$ICON_FILE128"; then
if ! tar -tzf "$OUT_FILE" >/dev/null 2>&1; then
rm -f "$OUT_FILE"
fi
fi
echo
done
done