Updates for CentOS 6.
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 25 Oct 2012 11:11:19 +0000 (07:11 -0400)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 25 Oct 2012 11:11:19 +0000 (07:11 -0400)
id-rpm-build/upload-rpms.sh

index ee83ce9..bc4e6c7 100755 (executable)
@@ -1,9 +1,9 @@
+#!/bin/sh
 PWD=`pwd`
 UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub}
 UPLOAD_HOST=${UPLOAD_HOST:=ftp.indexdata.dk}
-DISTRO=${DISTRO:="centos/5.5"}
 specfile=$1
-if test ! -f ${specfile}; then
+if test ! -f "${specfile}"; then
        echo "Missing .spec file argument."
        exit 1
 fi
@@ -11,9 +11,20 @@ if test ! -x /bin/rpm; then
         echo "$0: /bin/rpm missing. Install rpm"
         exit 1
 fi
+if test ! -f /etc/redhat-release; then
+       echo "/etc/redhat-release missing"
+       exit 1
+fi
+if test -z "$DISTRO"; then
+       if grep 'release 6' /etc/redhat-release >/dev/null; then
+               DISTRO="centos/6"
+       else
+               DISTRO="centos/5.5"
+       fi
+fi
 topdir=`rpm --eval "%{_topdir}"`
 BUILD_DIR=${BUILD_DIR:=${topdir}}
-pkg_names=`rpm -q --specfile ${specfile}`
+pkg_names=`rpm -q --specfile ${specfile} --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"`
 pkg_short=`rpm -q --specfile ${specfile} --queryformat "%{NAME};" | cut -d ";" -f1`
 
 UPLOAD_DIR=${UPLOAD_DIR:=${pkg_short}}