aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-buildpackage
diff options
context:
space:
mode:
Diffstat (limited to 'pbuilder-buildpackage')
-rwxr-xr-xpbuilder-buildpackage10
1 files changed, 4 insertions, 6 deletions
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index db9dd9f..5c1cd24 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -139,12 +139,10 @@ trap cleanbuildplace exit
umountproc
if [ -d "${BUILDRESULT}" ]; then
- if [ -n "${BUILDRESULTUID}" ]; then
- chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
- fi
- if [ -n "${BUILDRESULTGID}" ]; then
- chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
- fi
+ BUILDRESULTUID="${BUILDRESULTUID:-${SUDO_UID:-0}}"
+ chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
+ BUILDRESULTGID="${BUILDRESULTGID:-${SUDO_GID:-0}}"
+ chgrp "${BUILDRESULTGID}" "${BUILDPLACE}"/tmp/buildd/*
cp -p "${BUILDPLACE}"/tmp/buildd/* "${BUILDRESULT}" 2>/dev/null || true
else
echo "E: BUILDRESULT=[$BUILDRESULT] is not a directory." >&2