Bugfix: The initial pacstrap in a new chroot always use the host branch, this workaround fixes it.

This commit is contained in:
Ramon Buldó 2015-06-03 12:11:17 +02:00
parent e2afa0dc76
commit ee2c393383

View file

@ -81,8 +81,22 @@ 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}/#")
pac_base="$working_dir/pacman-pacstrap.conf"
sed "s#Include = /etc/pacman.d/mirrorlist#Server = ${host_mirror}#g" $pac_conf > $pac_base
basestrap -GMcd ${pac_base:+-C "$pac_base"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "firefox" || die 'Failed to install all packages'
else
basestrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "firefox" || die 'Failed to install all packages'
fi
[[ -f "$working_dir/pacman-pacstrap.conf" ]] && rm "$working_dir/pacman-pacstrap.conf"
echo "$version" > "$working_dir/.manjaro-tools"