Skip to content
Snippets Groups Projects
apidoc.publish 1.21 KiB
#! /bin/bash

#set -x

OPTVAL=`getopt -o -b:l:du:v -n 'apidoc.publish' -- "$@"`

# Note the quotes around `$OPTVAL': they are essential!
eval set -- "$OPTVAL"

if [ -d lustre/CVS ] ;then
    if [ -r lustre/CVS/Tag ] ;then
        branch=$(cut -c2- lustre/CVS/Tag)
    else
        branch=HEAD
    fi
else
    branch=''
fi

verbose=0
label=''
user=$USER

while true ;do
	case "$1" in
		-b)
			branch="$2"
			shift 2
		;;
		-l)
			label="$label$2"
			shift 2
		;;
		-u)
			user="$2"
			shift 2
		;;
		-d)
			label="$label$(date '+%Y.%m.%d')"
			shift
		;;
		-v)
			verbose=$(($verbose + 1))
			shift
		;;
		--) 
			shift 
			break 
		;;
		*) 
			echo "Internal error!" 
			exit 1 
		;;
	esac
done

if [ x$branch = x ] ;then
    echo "No branch specified"
    exit 1
fi

echo "Updating documentation for branch \`$branch'"
if [ x$label != x ] ;then
    echo "Label: $label"
fi

dst="$user@shell.lustre.sun.com:/home/www/apidoc/$branch$label"

opt="-rltvzp --delete"
sshopt="ssh -l $user -oPort=922"
if [ -d apidoc.api/html ] ;then
	chmod -R a+rx apidoc.api/html
    rsync $opt --rsh="$sshopt" apidoc.api/html $dst/api
fi
if [ -d apidoc.ref/html ] ;then
	chmod -R a+rx apidoc.ref/html
    rsync $opt --rsh="$sshopt" apidoc.ref/html $dst/ref
fi