summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-26 19:13:08 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-26 19:13:08 +0200
commitc763f7d9fd680b5f3e785043dd0058b9dc17bb1f (patch)
tree8baccee84542f1e1e3bac5f3e6f3e0065ab43ca4
parentf1dbb24d1b93adb9b76f1bfed2c619a4e71c447b (diff)
downloadbin-c763f7d9fd680b5f3e785043dd0058b9dc17bb1f.tar.gz
bin-c763f7d9fd680b5f3e785043dd0058b9dc17bb1f.tar.xz
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 <bluewind@xinu.at>
-rwxr-xr-xch28
1 files changed, 20 insertions, 8 deletions
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
}