Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / build / apidoc.publish
1 #! /bin/bash
2
3 #set -x
4
5 OPTVAL=`getopt -o -b:l:du:v -n 'apidoc.publish' -- "$@"`
6
7 # Note the quotes around `$OPTVAL': they are essential!
8 eval set -- "$OPTVAL"
9
10 if [ -d lustre/CVS ] ;then
11     if [ -r lustre/CVS/Tag ] ;then
12         branch=$(cut -c2- lustre/CVS/Tag)
13     else
14         branch=HEAD
15     fi
16 else
17     branch=''
18 fi
19
20 verbose=0
21 label=''
22 user=$USER
23
24 while true ;do
25         case "$1" in
26                 -b)
27                         branch="$2"
28                         shift 2
29                 ;;
30                 -l)
31                         label="$label$2"
32                         shift 2
33                 ;;
34                 -u)
35                         user="$2"
36                         shift 2
37                 ;;
38                 -d)
39                         label="$label$(date '+%Y.%m.%d')"
40                         shift
41                 ;;
42                 -v)
43                         verbose=$(($verbose + 1))
44                         shift
45                 ;;
46                 --) 
47                         shift 
48                         break 
49                 ;;
50                 *) 
51                         echo "Internal error!" 
52                         exit 1 
53                 ;;
54         esac
55 done
56
57 if [ x$branch = x ] ;then
58     echo "No branch specified"
59     exit 1
60 fi
61
62 echo "Updating documentation for branch \`$branch\'"
63 if [ x$label != x ] ;then
64     echo "Label: $label"
65 fi
66
67 dst="$user@shell.lustre.sun.com:/home/www/apidoc/$branch$label"
68
69 opt="-rltvzp --delete"
70 sshopt="ssh -l $user -oPort=922"
71 if [ -d apidoc.api/html ] ;then
72         chmod -R a+rx apidoc.api/html
73     rsync $opt --rsh="$sshopt" apidoc.api/html $dst/api
74 fi
75 if [ -d apidoc.ref/html ] ;then
76         chmod -R a+rx apidoc.ref/html
77     rsync $opt --rsh="$sshopt" apidoc.ref/html $dst/ref
78 fi
79