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
25 topdir=`rpm --eval "%{_topdir}"`
26 BUILD_DIR=${BUILD_DIR:=${topdir}}
27 pkg_names=`rpm -q --specfile ${specfile} --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"`
28 pkg_short=`rpm -q --specfile ${specfile} --queryformat "%{NAME};" | cut -d ";" -f1`
30 UPLOAD_DIR=${UPLOAD_DIR:=${pkg_short}}
31 UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${UPLOAD_DIR}
32 echo "Uploading to ${UPLOAD_URI}..."
34 if test ! -d ${BUILD_DIR}/SRPMS; then
35 echo "No SRPMS dir under ${BUILD_DIR}"
39 if test ! -d ${BUILD_DIR}/RPMS; then
40 echo "No RPMS dir under ${BUILD_DIR}"
44 for pkg in ${pkg_names}; do
46 if test ! -f ${BUILD_DIR}/SRPMS/${pkg}.src.rpm; then
47 echo "No SRPM for ${pkg}"
49 scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/
53 for dir in ${BUILD_DIR}/RPMS/*; do
54 arch=`basename ${dir}`
55 if test -f ${dir}/${pkg}.${arch}.rpm; then
56 scp ${dir}/${pkg}.${arch}.rpm ${UPLOAD_URI}/redhat/${DISTRO}/RPMS/${arch}/
58 echo "No ${pkg} in arch ${arch}"