From 03fe53317b305cac19716e6209a4ac60cba7d1fc Mon Sep 17 00:00:00 2001 From: dancer Date: Sat, 4 Jun 2005 05:29:21 +0000 Subject: + * pdebuild-internal: implement with user-adding. + --- pdebuild-internal | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'pdebuild-internal') diff --git a/pdebuild-internal b/pdebuild-internal index 4a997f3..88f5f0d 100644 --- a/pdebuild-internal +++ b/pdebuild-internal @@ -34,12 +34,48 @@ apt-get install -y pbuilder # I'm not going to have the same LOGNAME as outside, I'm root. export LOGNAME=root -if [ "$2" = "--debbuildopts" ]; then - echo "Setting DEBBUILDOPTS=$3" - DEBBUILDOPTS="$3" -fi - cd "$1" +shift; + +while [ -n "$1" ]; do + case "$1" in + --debbuildopts) + echo "Setting DEBBUILDOPTS=$2" + DEBBUILDOPTS="$2" + shift; shift; + ;; + --uid) + BUILDRESULTUID=$2 + shift; shift; + ;; + --gid) + BUILDRESULTGID=$2 + shift; shift; + ;; + --debug) + PBUILDER_DEBUGMODE=yes + set -x + shift; + ;; + --*) + echo "Error: Unknown option [$1] was specified " >&2 + exit 1; + ;; + *) + break; + ;; + esac +done + export PBCURRENTCOMMANDLINEOPERATION="pdebuild" /usr/lib/pbuilder/pbuilder-satisfydepends -/usr/bin/dpkg-buildpackage -us -uc ${DEBBUILDOPTS} +apt-get install -y --force-yes fakeroot + +# create the user similar to that used outside +groupadd -g "${BUILDRESULTGID}" -o pbgroup +useradd -g pbgroup -u "${BUILDRESULTUID}" -o pbuser + +# what about id -G output? if other groups than the designated is used, we're stuffed. + +# do build with that user. +echo /usr/bin/dpkg-buildpackage -rfakeroot -us -uc '${DEBBUILDOPTS}' | su pbuser -- cgit v1.2.3