[aur-general] [RFC] command in PKGBUILD to select archlinux mirror to download from

Martti Kühne mysatyre at gmail.com
Thu Feb 5 16:52:04 UTC 2015

On Thu, Feb 5, 2015 at 5:34 PM, Rafael Ferreira <rafael.f.f1 at gmail.com> wrote:
> One too much lazy solution (but works) is to grep one server from
> mirrorlist (e.g.: first) and get specifically the prefix of the URL,
> which will be completed in the source array:
>   _srcurl=`grep -m 1 ^Server /etc/pacman.d/mirrorlist`
>   _srcurl=${_srcurl/Server = /}
>   _srcurl=${_srcurl/\/\$repo\/os\/\$arch/}
>   source=($_srcurl/foo/bar)
> Any other idea?  Comments are welcome.

We all started with bash at some point. Use quotes for all these
lines, and don't use backticks but the more convenient bourne $().
_srcurl="$(grep -m 1 "^Server" /etc/pacman.d/mirrorlist)"
_srcurl="${_srcurl#*= }"

Now, I'm nost sure why you have to download anything from arch's
mirrors in a PKGBUILD. It feels like it doesn't belong into something
that would potentially be delivered from there, and the question hence
it seems a bit off.... If you need multilib packages, just put them
into the depends=() array?


More information about the aur-general mailing list