From 4daa435a1c71f35a6ee193895c92bb975ac326be Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Wed, 7 Jul 2010 05:38:16 -0400 Subject: [PATCH] Add RPM upload script --- id-rpm-build/upload-rpms.sh | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 id-rpm-build/upload-rpms.sh diff --git a/id-rpm-build/upload-rpms.sh b/id-rpm-build/upload-rpms.sh new file mode 100755 index 0000000..471d249 --- /dev/null +++ b/id-rpm-build/upload-rpms.sh @@ -0,0 +1,47 @@ +BUILD_DIR=/usr/src/redhat/ +PWD=`pwd` +UPLOAD_PATH=/home/ftp/pub +UPLOAD_HOST=flurry +UPLOAD_DIR=`basename $PWD` +UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${UPLOAD_DIR} +DISTRO="centos/5.5" +project=`basename $PWD` +if test ! -f ${project}.spec; then + echo "Missing ${project}.spec file. Are you in the project directory?" + exit 1 +fi +if test ! -x /bin/rpm; then + echo "$0: /bin/rpm missing. Install rpm" + exit 1 +fi +pkg_names=`rpm -q --specfile ${project}.spec` +inc_src=true +if test ! -d ${BUILD_DIR}/SRPMS; then + echo "No SRPMS dir under ${BUILD_DIR}" + inc_src=false +fi +inc_bin=true +if test ! -d ${BUILD_DIR}/RPMS; then + echo "No RPMS dir under ${BUILD_DIR}" + inc_bin=false +fi + +for pkg in ${pkg_names}; do + if $inc_src; then + if test ! -f ${BUILD_DIR}/SRPMS/${pkg}.src.rpm; then + echo "No SRPM for ${pkg}" + else + scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/ + fi + fi + if $inc_bin; then + for dir in ${BUILD_DIR}/RPMS/*; do + arch=`basename ${dir}` + if test -f ${dir}/${pkg}.${arch}.rpm; then + scp ${dir}/${pkg}.${arch}.rpm ${UPLOAD_URI}/redhat/${DISTRO}/RPMS/${arch}/ + else + echo "No ${pkg} in arch ${arch}" + fi + done + fi +done -- 1.7.10.4