From c763f7d9fd680b5f3e785043dd0058b9dc17bb1f Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 26 Aug 2016 19:13:08 +0200 Subject: ch: Inline chroot creation code This removes a confusing error message from archbuild which was caused by it being run in an empty directory. Signed-off-by: Florian Pritz --- ch | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'ch') diff --git a/ch b/ch index f620d0b..23cb533 100755 --- a/ch +++ b/ch @@ -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 } -- cgit v1.2.3-24-g4f1b