r2195: *** empty log message ***
[clsql.git] / debian / upload.sh
1 #!/bin/sh
2
3 set -e # abort on error
4
5 PKG=clsql
6 DEBPKG=cl-sql
7
8
9 WORK_DIR=/usr/local/src/Work/${PKG}
10 PKG_DIR=/usr/local/src/Packages/${DEBPKG}
11
12 UPSTREAM_DIR=ftp.med-info.com:/home/ftp/pub/${PKG}/.
13 FTP_DEBDIR=ftp.med-info.com:/home/ftp/pub/debian/UploadQueue
14
15
16 usage () {
17     progname="`basename \"$0\"`"
18     
19     cat >&2 <<EOF
20 Usage: $progname [options]
21 Creates upstream archives
22 Options:
23   -u   Upload only upstream packages
24   -d   Upload only debian packages
25   -h   Print this brief help
26 EOF
27 }
28
29 opt_debian=1
30 opt_upstream=1
31
32 # Command line
33 while [ $# != 0 ]; do
34     value="`echo x\"$1\" | sed -e 's/^x-.//'`"
35     case "$1" in
36         -h)  usage; exit 0           ;;
37         -u)  opt_debian=0            ;;
38         -d)  opt_upstream=0          ;;
39          *)  usage; exit 0           ;;
40     esac
41     shift
42 done
43
44 VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9.]).*/\1/p" < debian/changelog  |head -1`
45 DEBVERSION=`sed -n -e "s/${DEBPKG} (\(.*\)).*/\1/p" < debian/changelog  |head -1`
46
47 pushd ${PKG_DIR} > /dev/null
48
49 if [ "${opt_upstream}" == "1" ]; then
50   echo "Uploading upstream files to web site"
51   scp ${PKG}-${VERSION}.tar.gz ${UPSTREAM_DIR}
52   scp ${PKG}-${VERSION}.zip ${UPSTREAM_DIR}
53   ssh ftp.med-info.com "(cd /opt/apache/htdocs/${PKG}.med-info.com; make)" &
54 fi
55
56 echo "Uploading to Debian site"
57
58 if [ "${opt_upstream}" == "1" ]; then
59   echo "...Uploading original upstream archive"
60   scp ${DEBPKG}_${VERSION}.orig.tar.gz ${FTP_DEBDIR}
61 fi
62 scp ${DEBPKG}_${DEBVERSION}.diff.gz ${FTP_DEBDIR}
63 scp ${DEBPKG}_${DEBVERSION}.dsc ${FTP_DEBDIR}
64 scp ${DEBPKG}_${DEBVERSION}_*.deb ${FTP_DEBDIR}
65 scp ${DEBPKG}-*_${DEBVERSION}_*.deb ${FTP_DEBDIR}
66 scp ${DEBPKG}_${DEBVERSION}_*.changes ${FTP_DEBDIR} # upload last
67
68 popd > /dev/null
69
70