From ee2c393383c30e49ec9e3b957fde4b638e733896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramon=20Buld=C3=B3?= Date: Wed, 3 Jun 2015 12:11:17 +0200 Subject: [PATCH] Bugfix: The initial pacstrap in a new chroot always use the host branch, this workaround fixes it. --- bin/mkchroot.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/mkchroot.in b/bin/mkchroot.in index 9838a84..b28dfbc 100644 --- a/bin/mkchroot.in +++ b/bin/mkchroot.in @@ -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"