From 73bbf1f4dbaa7af73c73477241c057a68bdd32b9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 14 Mar 2013 11:38:01 +0100 Subject: [PATCH] id-pbuild.sh builds for CentOS only if host system is not Debian/Ubuntu. Before, deb-src stuff was required. --- id-deb-build/id-pbuild.sh | 102 ++++++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/id-deb-build/id-pbuild.sh b/id-deb-build/id-pbuild.sh index 004f892..ce96760 100755 --- a/id-deb-build/id-pbuild.sh +++ b/id-deb-build/id-pbuild.sh @@ -55,7 +55,7 @@ while test $# -gt 0; do -*) do_help=yes ;; - esac + esac shift done @@ -63,6 +63,12 @@ if test "$do_help" = "yes"; then usage 1 1>&2 fi +if test "$DEBIAN_DIST" -o "$UBUNTU_DIST"; then + debian=true +else + debian=false +fi + D0=`dirname $0` ID_DEB_BUILD=`cd $D0; pwd` PBUILDROOT=${ID_DEB_BUILD}/id-pbuild-root.sh @@ -80,60 +86,78 @@ fi if $upload; then : else - if test "${SUDO_USER}"; then - if test ! -d deb-src; then + if $debian; then + if test "${SUDO_USER}"; then + if test ! -d deb-src; then + $MKDEBSRC + fi + else + if test -d deb-src; then + rm -f deb-src/*.gz + if test $? -ne 0; then + echo "deb-src could not be removed. Remove deb-src manually" + exit 1 + fi + fi $MKDEBSRC fi else - if test -d deb-src; then - rm -f deb-src/*.gz - if test $? -ne 0; then - echo "deb-src could not be removed. Remove deb-src manually" - exit 1 - fi - fi - $MKDEBSRC + mkdir -p deb-src fi fi + cd deb-src -for f in *.dsc; do - if test -f "$f"; then - PKG=$f +if $debian; then + for f in *.dsc; do + if test -f "$f"; then + PKG=$f + fi + done + if test -z "$PKG"; then + echo "Specify .dsc file" + exit 1 + fi + if test ! -e "$PKG"; then + echo "${PKG} does not exist" + exit 1 + fi + if grep "Architecture: all" $PKG >/dev/null; then + USE_ARCHS=i386 + else + USE_ARCHS=$ARCHS fi -done -if test -z "$PKG"; then - echo "Specify .dsc file" - exit 1 -fi -if test ! -e "$PKG"; then - echo "${PKG} does not exist" - exit 1 fi + if test -z "$PRODUCT"; then - PRODUCT=`echo *.dsc|sed 's/_.*//g'` + PRODUCT=$NAME fi -if grep "Architecture: all" $PKG >/dev/null; then - USE_ARCHS=i386 -else - USE_ARCHS=$ARCHS +if test -z "$PRODUCT"; then + if $debian; then + PRODUCT=`echo *.dsc|sed 's/_.*//g'` + else + PRODUCT=`cd ..;rpm -q --specfile *.spec --queryformat "%{NAME};" | cut -d ";" -f1` + fi fi echo "Dsc $PKG . Product $PRODUCT" echo "Ubuntu distros: $UBUNTU_DIST" echo "Debian distros: $DEBIAN_DIST" echo "Centos distros: $CENTOS_DIST" -if test "${SUDO_USER}"; then - echo "Running as sudo." - echo "Tip: You can avoid it by adding the following in /etc/sudoers" - echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh" - HOME_EXPORT=/home/${SUDO_USER} -else - sudo -k - HOME_EXPORT=$HOME -fi -if test ! -f ${HOME_EXPORT}/.pbuilderrc; then - echo "${HOME_EXPORT}/.pbuilderrc missing" - exit 1 + +if $debian; then + if test "${SUDO_USER}"; then + echo "Running as sudo." + echo "Tip: You can avoid it by adding the following in /etc/sudoers" + echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh" + HOME_EXPORT=/home/${SUDO_USER} + else + sudo -k + HOME_EXPORT=$HOME + fi + if test ! -f ${HOME_EXPORT}/.pbuilderrc; then + echo "${HOME_EXPORT}/.pbuilderrc missing" + exit 1 + fi fi if $upload; then -- 1.7.10.4