diff options
author | merakor <cem@ckyln.com> | 2020-09-10 09:52:39 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-09-10 09:52:39 +0000 |
commit | 7edad8ab932ab27d7f7be5bd44ac4854861cdf8e (patch) | |
tree | e37d3288ff7ae91a77ab60f0dc7fe011184e3de4 /contrib | |
parent | 8938f2a8412948c67e41b9b1aa8751b39b696e67 (diff) | |
download | cpt-7edad8ab932ab27d7f7be5bd44ac4854861cdf8e.tar.gz |
cpt-chbuild: run as_root() only if we aren't root.
FossilOrigin-Name: 414282edfd26e36f326ea599d3328f53e617946c03e77595d4339ce56e174231
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/cpt-chbuild | 7 |
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 |