summaryrefslogtreecommitdiff
path: root/src/chroot-tools/buildenv
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-07 00:17:08 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-07 00:17:08 -0500
commite9bc885c355babf7851de31db8e1920dde752993 (patch)
treefd39b7d6401ead53942f66bfc4219a06f386a23f /src/chroot-tools/buildenv
parentc74d072dc83c5e3b3d9462678884cd0411a7d1d0 (diff)
organize the files
Diffstat (limited to 'src/chroot-tools/buildenv')
-rwxr-xr-xsrc/chroot-tools/buildenv28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/chroot-tools/buildenv b/src/chroot-tools/buildenv
new file mode 100755
index 0000000..84a1fc2
--- /dev/null
+++ b/src/chroot-tools/buildenv
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+trap "umount_all" 0 ERR TERM KILL
+
+user=${SUDO_USER:-${1}}
+
+umount_all() {
+ for mp in home/pkgdest home/srcdest home/${user}; do
+ msg "Umounting /$mp"
+ umount $CHROOTDIR/$CHROOT/$mp || error "Couldn't umount"
+ done
+}
+
+source /etc/libretools.conf
+
+for mp in home/pkgdest home/srcdest home/${user} var/lib/toru; do
+ msg "Binding /$mp"
+ mount -o bind /$mp $CHROOTDIR/$CHROOT/$mp || exit 1
+done
+
+for etc in etc/makepkg.conf etc/abs.conf etc/mtab; do
+ msg "Copying config /$etc"
+ cp --remove-destination /$etc $CHROOTDIR/$CHROOT/$etc || exit 1
+done
+
+$(dirname $0)/librechroot $CHROOT
+
+exit $?