source: trunk/tools/livwww @ 793

Last change on this file since 793 was 672, checked in by bcornec, 13 years ago

merge -r651:671 $SVN_M/branches/stable

  • Property svn:executable set to *
File size: 2.1 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=1
19nodoc=0
20
21if [ "$1" = "--keep" ]; then
22        force=0
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=www.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. $TOOLHOME/svn-env
50
51cd ${BASE}/svn
52
53if [ $force -eq 1 ]; then
54    echo "Purging $LOCALDIR"
55    rm -rf $LOCALDIR
56fi
57
58svn export $optsvn ${SVNBRANCH}/website $LOCALDIR
59
60if [ $force -eq 1 ]; then
61    echo "Purging $LOCALDOC"
62    rm -rf $LOCALDOC
63fi
64
65svn export $optsvn ${SVNBRANCH}/mondo-doc $LOCALDOC
66
67#
68# Version handling
69#
70$TOOLHOME/expandver $LOCALDIR/top.shtml $LOCALDOC/mondorescue-howto.sgml $LOCALDOC/*.8
71
72if [ $nodoc -eq 0 ]; then
73    cd $LOCALDOC
74    make -f Makefile.howto
75    make -f Makefile.man
76    mv $LOCALDOC $LOCALDIR/docs
77    #
78    # Man pages corrections
79    #
80    perl -pi -e 's~/man8/~/docs/~g' $LOCALDIR/docs/*.8.html
81    perl -pi -e 's~<A HREF[=./A-z0-9"]*/man1/[^<]*>([A-z0-9]*)</A>~$1~g' $LOCALDIR/docs/*.8.html
82    perl -pi -e 's~/index.html~/index.shtml~' $LOCALDIR/docs/*.8.html
83fi
84find $LOCALDIR -type d | xargs chmod 755
85find $LOCALDIR -type f | xargs chmod 644
86
87cd $LOCALDIR
88#
89# Some links for the Web site
90#
91ln -sf /var/www/html/mediawiki .
92ln -sf /var/www/html/admin .
93
94# Compute News
95$TOOLHOME/mknewshtml.pl $LOCALDIR
96
97if [ _"$1" == _"" ]; then
98        exit 0
99else
100    if [ _"$1" == _"test" ]; then
101        DESTDIR=$TESTDIR
102    else
103        DESTDIR=$MONDODIR
104    fi
105    echo "Delivering to $DESTDIR on ${DESTMACH}"
106fi
107tar cfz /tmp/mondo-www.tgz .
108scp /tmp/mondo-www.tgz ${DESTUSER}@${DESTMACH}:/tmp
109rm -f /tmp/mondo-www.tgz
110ssh ${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.