summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-09-21 13:26:21 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-09-21 13:26:21 -0300
commit6082f831bbacb174c050915d3b301910fb2ea261 (patch)
treede6535895d4ce1615ba40fb2a3d3ce1b87587509
parentd3056495cdab4c03e1a5a73c303b4cc25337597d (diff)
Use SUDO_USER or specified user on $1
-rwxr-xr-xbuildenv6
1 files changed, 4 insertions, 2 deletions
diff --git a/buildenv b/buildenv
index dc41e19..1cb07de 100755
--- a/buildenv
+++ b/buildenv
@@ -2,8 +2,10 @@
trap "umount_all" 0 ERR TERM KILL
+user=${SUDO_USER:-${1}}
+
umount_all() {
- for mp in home/pkgdest home/srcdest home/${USER}; do
+ for mp in home/pkgdest home/srcdest home/${user}; do
msg "Umounting /$mp"
umount $CHROOTDIR/$CHCOPY/$mp || error "Couldn't umount"
done
@@ -11,7 +13,7 @@ umount_all() {
source /etc/libretools.conf
-for mp in home/pkgdest home/srcdest home/${USER} var/lib/toru; do
+for mp in home/pkgdest home/srcdest home/${user} var/lib/toru; do
msg "Binding /$mp"
mount -o bind /$mp $CHROOTDIR/$CHCOPY/$mp || exit 1
done