From a976381e4c2ba6c2837fa01d6775b5dd3f88fc1a Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 13 Apr 2010 15:11:46 +0200 Subject: [PATCH] id-pbuild-all invokes sudo itself. Note about sudosers --- id-deb-build/id-pbuild-all.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/id-deb-build/id-pbuild-all.sh b/id-deb-build/id-pbuild-all.sh index e86e5d3..c88ec51 100755 --- a/id-deb-build/id-pbuild-all.sh +++ b/id-deb-build/id-pbuild-all.sh @@ -1,4 +1,12 @@ #!/bin/sh +# This script builds Debian packages for one or more distributions +# in i386/amd64 architectures. It uses pbuilder. pbuilder requires root +# privilege and is invoked with sudo. +# +# In order to avoid having to type-in the password for it, you might +# use something like this in sudoers +# user ALL=NOPASSWD,SETENV: /usr/sbin/pbuilder +# where user is your username. usage() { @@ -72,8 +80,9 @@ if test ! -e "$PKG"; then echo "${PKG} does not exist" exit 1 fi +PBUILDER=/usr/sbin/pbuilder PRODUCT=`echo *.dsc|sed 's/_.*//g'` - +ARCHS="i386 amd64" echo "Dsc $PKG . Product $PRODUCT" echo "Ubuntu distros: $UBUNTU_DIST" echo "Debian distros: $DEBIAN_DIST" @@ -93,16 +102,16 @@ fi i=0 date for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do - for arch in i386 amd64; do + for arch in ${ARCHS}; do rm -fr ${dist}-${arch} ( if test ! -f /var/cache/pbuilder/${dist}-${arch}-base.tgz; then - DIST=$dist ARCH=$arch pbuilder create + sudo DIST=$dist ARCH=$arch $PBUILDER create fi if $update; then - DIST=$dist ARCH=$arch pbuilder update --override-config + sudo DIST=$dist ARCH=$arch $PBUILDER update --override-config fi - DIST=$dist ARCH=$arch pbuilder --build $PKG + sudo DIST=$dist ARCH=$arch $PBUILDER --build $PKG ) >${dist}-${arch}.log 2>&1 & i=`expr $i + 1` if test $i -eq $concurrency; then @@ -113,8 +122,7 @@ for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do done wait for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do - for arch in i386 amd64; do - + for arch in ${ARCHS}; do if test -f ${dist}-${arch}/*.dsc; then : else -- 1.7.10.4