summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-devel@skarnet.org>2022-08-09 12:17:29 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-08 15:10:59 +0000
commit6538fa7b249fbaac6f75465e202e67b93dbcaa4c (patch)
treeb05324af9a0e519f3be30cc35703e5e3ee6091ed
parentfe1d66651a552bba62267aaac8d0c89b383d132b (diff)
downloadalpine-conf-6538fa7b249fbaac6f75465e202e67b93dbcaa4c.zip
setup-xorg-base: fix case with several sources in repositories
setup-xorg-base didn't correctly handle the case where /etc/apk/repositories contains several main sources, and that caused test failures. We fix this by throwing out the big sed command (which fails on multiline /etc/apk/repositories) and processing the repositories file in a pedestrian way, line by line in shell. Since we entirely cut grep and sed and make sure we never fork in the loop, the performance is acceptable. Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--setup-xorg-base.in18
1 files changed, 18 insertions, 0 deletions
diff --git a/setup-xorg-base.in b/setup-xorg-base.in
index 78bacf8..1a7d7b3 100644
--- a/setup-xorg-base.in
+++ b/setup-xorg-base.in
@@ -23,6 +23,24 @@ while getopts "d:n:h" opt; do
done
shift $(($OPTIND - 1))
+# For every main/ repo, enable corresponding community/ repo
+orig="$ROOT"/etc/apk/repositories
+if test -f "$orig"; then
+ echo '>> Enabling community repositories'
+ tmp="$orig".tmp:setup-xorg-base
+ :> "$tmp"
+ while read line ; do
+ echo "$line"
+ nosharp="${line##\#*}"
+ nomain="${line%%/main}"
+ if test "$line" = "$nosharp" && test "$line" != "$nomain"; then
+ echo "$nomain"/community
+ fi
+ done < "$orig" >> "$tmp"
+ mv -f "$tmp" "$orig"
+ $MOCK apk update
+fi
+
# enable community repo
if [ -f "$ROOT"/etc/apk/repositories ] && ! grep -q '^[^#].*/community$' "$ROOT"/etc/apk/repositories; then
repo=$(grep '^[^#].*/main$' /etc/apk/repositories | sed 's:/main$:/community:')