From 7edad8ab932ab27d7f7be5bd44ac4854861cdf8e Mon Sep 17 00:00:00 2001 From: merakor Date: Thu, 10 Sep 2020 09:52:39 +0000 Subject: cpt-chbuild: run as_root() only if we aren't root. FossilOrigin-Name: 414282edfd26e36f326ea599d3328f53e617946c03e77595d4339ce56e174231 --- contrib/cpt-chbuild | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib/cpt-chbuild') 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 -- cgit v1.2.3