File indexing completed on 2024-06-16 08:28:25

0001 #!/bin/sh
0002 
0003 scriptdir=$(dirname $0)
0004 cd $scriptdir
0005 
0006 srcdir=..
0007 
0008 if test -n "$1"; then
0009     if [[ "$1" != /* ]]; then
0010        relsrcdir="$(revpath $scriptdir)/$1"
0011     else
0012        relsrcdir="$1"
0013     fi
0014 else
0015     relsrcdir=
0016 fi
0017 
0018 if test -n "$2"; then
0019     dstdir=$2
0020     if test -z "$3"; then
0021         echo "If destination directory is given in command line,"
0022              "server root must be given as well."
0023         exit 1
0024     fi
0025     srvroot=$3
0026 else
0027     # Expects www-pology entry in SSH config.
0028     dstdir=www-pology:pology.nedohodnik.net
0029     srvroot=http://pology.nedohodnik.net
0030 fi
0031 
0032 echo "Copying base files..."
0033 cp -aLf base tmpwww
0034 find tmpwww -type f | xargs grep -lI '@srvroot@' \
0035 | xargs sed -i -r "s|@srvroot@|$srvroot|g"
0036 
0037 if test -n "$relsrcdir"; then
0038     echo "Building release documentation:"
0039     rm -rf $relsrcdir/doc-html
0040     echo "- user manual..."
0041     $relsrcdir/doc/user/local.sh build
0042     echo "- language support manuals..."
0043     for locbld in $relsrcdir/lang/*/doc/local.sh; do
0044         $locbld build || exit 1
0045     done
0046     echo "- API documentation..."
0047     $relsrcdir/doc/api/local.sh build
0048     cp -aL $relsrcdir/doc-html/* tmpwww/doc/
0049     excldoc=
0050 else
0051     excldoc="--exclude doc/"
0052 fi
0053 
0054 echo "Syncing with web site..."
0055 rsync -rav --delete \
0056       --cvs-exclude --exclude release/ $excldoc \
0057       tmpwww/ $dstdir/
0058 rm -rf tmpwww
0059 
0060 echo "All done."