aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/cpt-chbuild7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/cpt-chbuild b/contrib/cpt-chbuild
index bff9a34..923a7fa 100755
--- a/contrib/cpt-chbuild
+++ b/contrib/cpt-chbuild
@@ -55,4 +55,9 @@ cp -a carbs-chroot "chroot-$pid"
run_hook pre-chroot "" "$PWD/chroot-$pid"
log "Entering chroot"
-as_root sh -c "cpt-chroot chroot-$pid; rm -rf chroot-$pid"
+if [ "$(id -u)" -eq 0 ]; then
+ cpt-chroot "chroot-$pid"
+ rm -rf "chroot-$pid"
+else
+ as_root sh -c "cpt-chroot chroot-$pid; rm -rf chroot-$pid"
+fi