[devtools,1/1] arch-nspawn: ignore localhost for repository mirror

Message ID 20180723070418.16657-1-list@eworm.de
State New
Headers show
Series
  • [devtools,1/1] arch-nspawn: ignore localhost for repository mirror
Related show

Commit Message

Christian Hesse July 23, 2018, 7:04 a.m. UTC
From: Christian Hesse <mail@eworm.de>

My system has a mirror configuration where only the host can access a
local caching service on localhost. So ignore localhost urls.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 arch-nspawn.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/arch-nspawn.in b/arch-nspawn.in
index b9c846e..020ed71 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -60,7 +60,7 @@  fi
 
 pacconf_cmd=$(command -v pacman-conf || command -v pacconf)
 # shellcheck disable=2016
-host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
+host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | grep -E -v '(127.0.0.1|localhost)' | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
 # shellcheck disable=2016
 [[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')