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