[mkchroot] test without getting build mirror again; build_mirror var is already passed and known

This commit is contained in:
udeved 2015-06-03 16:08:51 +02:00
parent 296b21635e
commit 3a51ccc287

View file

@ -81,8 +81,25 @@ if [[ $(stat -f -c %T "$working_dir") == btrfs ]]; then
chmod 0755 "$working_dir"
fi
basestrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
# Workaround when creating a chroot in a branch different of the host
if [[ -n $pac_conf ]] && [[ -n $mirrors_conf ]]; then
#host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -E "s#(.*/)(.*/)extra/.*#\1branch/\$repo/\$arch#")
#[[ $host_mirror == *file://* ]] && host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
#branch=$(cat "$mirrors_conf" | grep '^Branch=' | sed 's/Branch=\s*//g')
#host_mirror=$(echo "$host_mirror" | sed -E "s#/branch/#/${branch}/#")
url=${build_mirror}'/$repo/$arch'
#branch=${build_mirror##*/}
pac_base="$working_dir/pacman-pacstrap.conf"
sed "s#Include = /etc/pacman.d/mirrorlist#Server = ${url}#g" $pac_conf > $pac_base
basestrap -GMcd ${pac_base:+-C "$pac_base"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
else
basestrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
fi
[[ -f "$pac_base" ]] && rm "$pac_base"
echo "$version" > "$working_dir/.manjaro-tools"