3 UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub}
4 UPLOAD_HOST=${UPLOAD_HOST:=ftp.indexdata.dk}
6 if test ! -f "${specfile}"; then
7 echo "Missing .spec file argument."
10 if test ! -x /bin/rpm; then
11 echo "$0: /bin/rpm missing. Install rpm"
14 if test ! -f /etc/redhat-release; then
15 echo "/etc/redhat-release missing"
18 if test -z "$DISTRO"; then
19 if grep 'release 6' /etc/redhat-release >/dev/null; then
21 elif grep 'release 7' /etc/redhat-release > /dev/null; then
27 topdir=`rpm --eval "%{_topdir}"`
28 BUILD_DIR=${BUILD_DIR:=${topdir}}
29 pkg_names=`rpm -q --specfile ${specfile} --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"`
30 pkg_short=`rpm -q --specfile ${specfile} --queryformat "%{NAME};" | cut -d ";" -f1`
32 UPLOAD_DIR=${UPLOAD_DIR:=${pkg_short}}
33 UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${UPLOAD_DIR}
34 echo "Uploading to ${UPLOAD_URI}..."
36 if test ! -d ${BUILD_DIR}/SRPMS; then
37 echo "No SRPMS dir under ${BUILD_DIR}"
41 if test ! -d ${BUILD_DIR}/RPMS; then
42 echo "No RPMS dir under ${BUILD_DIR}"
46 for pkg in ${pkg_names}; do
49 if test -f ${BUILD_DIR}/SRPMS/${pkg}.src.rpm; then
50 scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/
55 for dir in ${BUILD_DIR}/RPMS/*; do
56 arch=`basename ${dir}`
57 if test -f ${dir}/${pkg}.${arch}.rpm; then
59 scp ${dir}/${pkg}.${arch}.rpm ${UPLOAD_URI}/redhat/${DISTRO}/RPMS/${arch}/
63 echo "FAILED: No RPM copied for: ${pkg}"