index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-06-22 10:55:51 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-31 16:09:42 +0200 |
commit | 4a577c242cc01e686d575a079830b277b0f54da5 (patch) | |
tree | bfea68b06d163a4fa8508fb01850f6f74aee0ffd /arch-nspawn.in | |
parent | 52b58b0f8e1a4ccde39b6ce1f41167d8a22d093f (diff) |
-rw-r--r-- | arch-nspawn.in | 26 |
diff --git a/arch-nspawn.in b/arch-nspawn.in index 56e75eb..8a3989e 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -58,10 +58,29 @@ else cache_dirs=("$cache_dir") fi +if [[ -n $makepkg_conf ]]; then + eval "$(grep -a '^CARCH=' "$makepkg_conf")" +else + eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")" +fi + pacconf_cmd=$(command -v pacman-conf || command -v pacconf) +if [[ "$CARCH" = 'i'*'86' ]]; then + host_mirror="$( + sed -n ' + /^\s*Server\s*=/{ + s/^.*=\s*// + s/\s*\(#.*\)\?$// + p + q + }' \ + '/etc/pacman.d/mirrorlist32' + )" +else # shellcheck disable=2016 -host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;s#(.*/)[^/]+/extra/[^/]+#\1$arch/$repo#') + host_mirror=$($pacconf_cmd --repo extra Server 2> /dev/null | head -1 | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#;s#(.*/)[^/]+/extra/[^/]+#\1$arch/$repo#') # shellcheck disable=2016 +fi [[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g') # {{{ functions @@ -81,7 +100,9 @@ build_mount_args() { copy_hostconf () { cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d" - echo "Server = $host_mirror" >"$working_dir/etc/pacman.d/mirrorlist" + echo "Server = $host_mirror" | \ + tee "$working_dir/etc/pacman.d/mirrorlist" > \ + "$working_dir/etc/pacman.d/mirrorlist32" [[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf" [[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf" @@ -93,7 +114,6 @@ copy_hostconf () { done sed -r "s|^#?\\s*CacheDir.+|CacheDir = ${cache_dirs[*]}|g" -i "$working_dir/etc/pacman.conf" - eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")" sed -i '/^Architecture = /s| auto$| '"$CARCH|" "$working_dir/etc/pacman.conf" } # }}} |