Commit 0c868a1e authored by udeved's avatar udeved

chroot-run: use new pacman-mirrors api feature

parent 7b7f2354
......@@ -95,14 +95,17 @@ copy_hostconf () {
done
if [[ -n ${build_mirror} ]];then
build_mirror=${build_mirror}'/$repo/$arch'
local branch=$(pacman-mirrors -a --prefix "$1" -G)
if ${keep_mirrors}; then
set_branch "$1" "$(get_branch $1)"
# set_branch "$1" "$(get_branch $1)"
pacman-mirrors -a -p "$1" -S "${branch}" -R
else
echo "Server = ${build_mirror}" > "$1/etc/pacman.d/mirrorlist"
local mirror=${build_mirror}'/$repo/$arch'
echo "Server = ${mirror}" > "$1/etc/pacman.d/mirrorlist"
fi
else
set_branch "$1" "$(get_branch $1)"
# set_branch "$1" "$(get_branch $1)"
pacman-mirrors -a -p "$1" -S "$branch" -R
fi
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$1/etc/pacman.conf"
......
......@@ -139,17 +139,17 @@ prepare_dir(){
[[ ! -d $1 ]] && mkdir -p $1
}
# $1: chroot
get_branch(){
echo $(cat "$1/etc/pacman-mirrors.conf" | grep '^Branch = ' | sed 's/Branch = \s*//g')
}
# $1: chroot
# $2: branch
set_branch(){
info "Setting mirrorlist branch: %s" "$2"
sed -e "s|/stable|/$2|g" -i "$1/etc/pacman.d/mirrorlist"
}
# # $1: chroot
# get_branch(){
# echo $(cat "$1/etc/pacman-mirrors.conf" | grep '^Branch = ' | sed 's/Branch = \s*//g')
# }
#
# # $1: chroot
# # $2: branch
# set_branch(){
# info "Setting mirrorlist branch: %s" "$2"
# sed -e "s|/stable|/$2|g" -i "$1/etc/pacman.d/mirrorlist"
# }
init_common(){
[[ -z ${target_branch} ]] && target_branch='stable'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment