From: Adam Dickmeiss Date: Wed, 3 Aug 2011 12:52:42 +0000 (+0200) Subject: Separate, privileged, script for id-pbuild.sh. X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=5800761f8be3c0ec6fddf74327d75b5505e14a89;p=git-tools-moved-to-github.git Separate, privileged, script for id-pbuild.sh. The separate script, id-pbuild-root.sh, might be specified in /etc/sudoers as follows, to prevent interactive password typing.. For example, for "adam": adam ALL=NOPASSWD: /home/adam/proj/git-tools/id-deb-build/id-pbuild-root.sh --- diff --git a/id-deb-build/id-pbuild-root.sh b/id-deb-build/id-pbuild-root.sh new file mode 100755 index 0000000..f1f8239 --- /dev/null +++ b/id-deb-build/id-pbuild-root.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +usage() +{ + cat <&2 fi -if test "$REMOTE"; then - if test ! -d deb-src; then - echo "deb-src not in current directory" - exit 1 - fi - cd deb-src - PRODUCT=`echo *.dsc|sed 's/_.*//g'` - cd .. - ssh $REMOTE "mkdir -p $PRODUCT/deb-src" - scp IDMETA $REMOTE:$PRODUCT - scp deb-src/*.gz deb-src/*.dsc $REMOTE:$PRODUCT/deb-src - if $upload; then - ssh $REMOTE "cd $PRODUCT; \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload" - else - ssh $REMOTE "cd $PRODUCT; sudo \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh" - fi - exit 0 +PBUILDROOT=`dirname $0`/id-pbuild-root.sh +if test ! -x $PBUILDROOT; then + echo "$PBUILDROOT not found" + exit 1 fi + if test -d deb-src; then cd deb-src fi + for f in *.dsc; do if test -f "$f"; then PKG=$f @@ -95,9 +81,8 @@ if test ! -e "$PKG"; then echo "${PKG} does not exist" exit 1 fi -PBUILDER=/usr/sbin/pbuilder if test -z "$PRODUCT"; then - PRODUCT=`echo *.dsc|sed 's/_.*//g'` + PRODUCT=`echo *.dsc|sed 's/_.*//g'` fi ARCHS="i386 amd64" if grep "Architecture: all" $PKG >/dev/null; then @@ -126,12 +111,6 @@ if $upload; then echo "====================================================" exit 0 fi -# remove existing package directories -for f in [a-z]*; do - if test -d $f; then - rm -fr $f - fi -done rm -f *.log i=0 @@ -139,18 +118,18 @@ date for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do for arch in ${USE_ARCHS}; do - rm -fr ${dist}-${arch} - ( - if test ! -f /var/cache/pbuilder/${dist}-${arch}-base.tgz; then - DIST=$dist ARCH=$arch $PBUILDER create - fi - DIST=$dist ARCH=$arch $PBUILDER update --override-config - DIST=$dist ARCH=$arch $PBUILDER --build $PKG - ) >${dist}-${arch}.log 2>&1 & + sudo -n $PBUILDROOT \ + --dist=$dist --arch=$arch --dsc=$PKG >${dist}-${arch}.log 2>&1 & i=`expr $i + 1` if test $i -eq $concurrency; then i=0 wait + if test -f ${dist}-${arch}/*.dsc; then + : + else + echo "No .dsc file for ${dist}-${arch}" + exit 1 + fi fi done done