File: upload-cvs-tarball.sh

package info (click to toggle)
plplot 5.3.1-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 26,248 kB
  • ctags: 11,687
  • sloc: ansic: 86,045; xml: 17,249; sh: 12,400; tcl: 8,113; cpp: 6,824; perl: 4,383; python: 3,915; makefile: 2,899; java: 2,788; fortran: 290; sed: 5; awk: 1
file content (74 lines) | stat: -rwxr-xr-x 1,760 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#
# Script for uploading the CVS snapshot tarball to the PLplot web site
#
# Copyright (C) 2004  Rafael Laboissiere
# This script in the public domain

# GPG signing is disabled by setting the environment variable NOGPG
# If the gpg command fails, then no mention to the detached signature
# is included in the tarball.

WWW_HOST=${WWW_HOST:-plplot.sf.net}
WWW_USER=${WWW_USER:-rlaboiss}
WWW_DIR=${WWW_DIR:-/home/groups/p/pl/plplot/htdocs/cvs-tarball}
GPGKEY=${GPGKEY:-0x4A5D72FE}

function run () {
    echo $*
    $*
}

if test $# != 1 ; then
    echo "Usage: $0 tarball.tar.gz"
    exit 1
fi

TARBALL=$1
TARBALL_NAME=`basename $TARBALL`

gpg_successful=no
test -z "$NOGPG" \
    && gpg --default-key $GPGKEY --detach-sign --armor $TARBALL \
    && gpg_successful=yes

INDEX=`tempfile --mode=0644`
DATE=`date --utc +"%Y-%m-%d %H:%M UTC"`

cat > $INDEX <<EOF
<html>
<head>
<title>PLplot CVS tarball</title>
</head>
<body>
<h2>Latest PLplot CVS snapshot distribution</h2>

<p> Tarball: <a href="$TARBALL_NAME">$TARBALL_NAME</a>.</p>
EOF

test "$gpg_successful" = yes && cat >> $INDEX <<EOF
<p> Detached GPG signature: <a href="$TARBALL_NAME.asc">$TARBALL_NAME.asc</a>
(signed with key
<a href="http://wwwkeys.pgp.net:11371/pks/lookup?op=index&search=$GPGKEY">$GPGKEY</a>)
</p>
EOF

cat >> $INDEX <<EOF
<p> Uploaded by <a href="http://sf.net/users/$WWW_USER">$WWW_USER</a>
on $DATE</p>

</body>
</html>
EOF

HOST=$WWW_USER@$WWW_HOST

run ssh $HOST rm -rf $WWW_DIR
run ssh $HOST mkdir $WWW_DIR
run scp $TARBALL $TARBALL.asc $HOST:$WWW_DIR
test "$gpg_successful" = yes && run scp $TARBALL.asc $HOST:$WWW_DIR
run scp $INDEX $HOST:$WWW_DIR/index.html
run ssh $HOST chgrp -R plplot $WWW_DIR
run ssh $HOST chmod -R g=u $WWW_DIR

rm -f $TARBALL.asc $INDEX