diff options
-rwxr-xr-x | ch | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -86,16 +86,28 @@ __chrootalias_resolve() { __chrootalias_resolve_create() { __chrootalias_resolve "$1" + local -a packages=(base-devel) + local chroot_repo=${chroot%-*} + + if [[ $chroot = multilib* ]]; then + packages+=(multilib-devel) + fi + + local arch + case "$chroot_arch" in + 32) arch=i686;; + 64) arch=x86_64;; + esac + # create chroot if necessary if [[ ! -d "$chrootdir/root" ]]; then - # fix command for multilib - case $chroot in - multilib*) chroot_cmd="${chroot%%-x86_64}";; - *) chroot_cmd="$chroot";; - esac - cd /var/empty - sudo "${chroot_cmd}-build" -c -r "$CHROOTS" || true - cd - + # from archbuild (devtools) + sudo mkdir -p "$chrootdir" + setarch "${arch}" mkarchroot \ + -C "/usr/share/devtools/pacman-${chroot_repo}.conf" \ + -M "/usr/share/devtools/makepkg-${arch}.conf" \ + "$chrootdir/root" \ + "${packages[@]}" fi } |