source: branches/stable/tools/livwww @ 436

Last change on this file since 436 was 436, checked in by bcornec, 14 years ago

Remove the old web site content after scp

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Delivery of the Web site in a DocumentRoot
6#
7#
8# Please replace with your destination
9#
10
11
12LOCALDIR=/var/www/html/mondo
13LOCALDOC=/var/www/html/mondo-doc
14DESTUSER=apache
15MONDODIR=/mondo/www/html/mondo
16TESTDIR=/mondo/www/html/test
17
18force=0
19nodoc=0
20
21if [ "$1" = "-f" ]; then
22        force=1
23        optsvn=""
24        shift
25elif [ "$1" = "-nodoc" ]; then
26        nodoc=1
27        optsvn="--force"
28        shift
29else
30        optsvn="--force"
31fi
32
33/sbin/ifconfig | egrep -q '10\.3' 2>&1 > /dev/null
34if [ $? = 0 ]; then
35    DESTMACH=mondo.hpintelco.org
36else
37    DESTMACH=www1.mondorescue.org
38fi
39
40dname=`dirname $0`
41prem=`echo $dname |cut -c1`
42if [ ${prem} == "/" ]; then
43        export TOOLHOME=$dname
44else
45        export TOOLHOME=${PWD}/$dname
46fi
47
48. $TOOLHOME/common-env
49
50cd ${BASE}/svn
51
52if [ $force -eq 1 ]; then
53    echo "Purging $LOCALDIR"
54    rm -rf $LOCALDIR
55fi
56
57svn export $optsvn ${VER}/website $LOCALDIR
58
59if [ $force -eq 1 ]; then
60    echo "Purging $LOCALDOC"
61    rm -rf $LOCALDOC
62fi
63
64svn export $optsvn ${VER}/documentation $LOCALDOC
65
66#
67# Version handling
68#
69$TOOLHOME/expandver $LOCALDIR/top.shtml $LOCALDOC/mondorescue-howto.sgml $LOCALDOC/*.8
70
71if [ $nodoc -eq 0 ]; then
72    cd $LOCALDOC
73    make -f Makefile.howto
74    make -f Makefile.man
75    mv $LOCALDOC $LOCALDIR/docs
76    #
77    # Man pages corrections
78    #
79    perl -pi -e 's~/man8/~/docs/~g' $LOCALDIR/docs/*.8.html
80    perl -pi -e 's~<A HREF[=./A-z0-9"]*/man1/[^<]*>([A-z0-9]*)</A>~$1~g' $LOCALDIR/docs/*.8.html
81    perl -pi -e 's~/index.html~/index.shtml~' $LOCALDIR/docs/*.8.html
82fi
83find $LOCALDIR -type d | xargs chmod 755
84find $LOCALDIR -type f | xargs chmod 644
85
86cd $LOCALDIR
87#
88# Some links for the Web site
89#
90ln -sf /var/www/html/mediawiki .
91ln -sf /var/www/html/admin .
92
93if [ _"$1" == _"" ]; then
94        exit 0
95else
96    if [ _"$1" == _"test" ]; then
97        DESTDIR=$TESTDIR
98    else
99        DESTDIR=$MONDODIR
100    fi
101    echo "Delivering to $DESTDIR on ${DESTMACH}"
102fi
103tar cfz /tmp/mondo-www.tgz .
104scp /tmp/mondo-www.tgz ${DESTUSER}@${DESTMACH}:/tmp
105rm -f /tmp/mondo-www.tgz
106ssh ${DESTUSER}@${DESTMACH} "rm -rf ${DESTDIR} ; mkdir ${DESTDIR} ; cd ${DESTDIR} ; tar xfz /tmp/mondo-www.tgz"
Note: See TracBrowser for help on using the repository browser.