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 | LOCALDIR=/var/www/html/mondo
|
---|
11 | LOCALDOC=/var/www/html/mondo-doc
|
---|
12 | DESTUSER=apache
|
---|
13 | MONDODIR=/mondo/www/html/mondo
|
---|
14 | TESTDIR=/mondo/www/html/test
|
---|
15 |
|
---|
16 | force=0
|
---|
17 |
|
---|
18 | if [ "$1" = "-f" ]; then
|
---|
19 | force=1
|
---|
20 | shift
|
---|
21 | fi
|
---|
22 |
|
---|
23 | /sbin/ifconfig | grep -q 10.3 2>&1 > /dev/null
|
---|
24 | if [ $? = 0 ]; then
|
---|
25 | DESTMACH=mondo.hpintelco.org
|
---|
26 | else
|
---|
27 | DESTMACH=www1.mondorescue.org
|
---|
28 | fi
|
---|
29 |
|
---|
30 | dname=`dirname $0`
|
---|
31 | prem=`echo $dname |cut -c1`
|
---|
32 | if [ ${prem} == "/" ]; then
|
---|
33 | export TOOLHOME=$dname
|
---|
34 | else
|
---|
35 | export TOOLHOME=${PWD}/$dname
|
---|
36 | fi
|
---|
37 |
|
---|
38 | . $TOOLHOME/common-env
|
---|
39 |
|
---|
40 | cd ${BASE}/svn
|
---|
41 |
|
---|
42 | rm -rf $LOCALDIR
|
---|
43 | svn export ${VER}/website $LOCALDIR
|
---|
44 |
|
---|
45 | rm -rf $LOCALDOC
|
---|
46 | svn export ${VER}/documentation $LOCALDOC
|
---|
47 | cd $LOCALDOC
|
---|
48 | make -f Makefile.howto
|
---|
49 | make -f Makefile.man
|
---|
50 | mv $LOCALDOC $LOCALDIR/docs
|
---|
51 | #
|
---|
52 | # Man pages corrections
|
---|
53 | #
|
---|
54 | perl -pi -e 's~/man8/~/docs/~g' $LOCALDIR/docs/*.8.html
|
---|
55 | perl -pi -e 's~<A HREF[=./A-z0-9"]*/man1/[^<]*>([A-z0-9]*)</A>~$1~g' $LOCALDIR/docs/*.8.html
|
---|
56 | perl -pi -e 's~/index.html~/index.shtml~' $LOCALDIR/docs/*.8.html
|
---|
57 | #
|
---|
58 | # Version handling
|
---|
59 | #
|
---|
60 | perl -pi -e "s~VVV-rRRR~${VER}-r${REVISION}~g" $LOCALDIR/head.shtml
|
---|
61 |
|
---|
62 | find $LOCALDIR -type d | xargs chmod 755
|
---|
63 | find $LOCALDIR -type f | xargs chmod 644
|
---|
64 | cd $LOCALDIR
|
---|
65 | if [ _"$1" == _"" ]; then
|
---|
66 | exit 0
|
---|
67 | else
|
---|
68 | if [ _"$1" == _"test" ]; then
|
---|
69 | DESTDIR=$TESTDIR
|
---|
70 | else
|
---|
71 | DESTDIR=$MONDODIR
|
---|
72 | fi
|
---|
73 | fi
|
---|
74 | tar cfz /tmp/mondo-www.tgz .
|
---|
75 | ssh ${DESTUSER}@${DESTMACH} "rm -rf ${DESTDIR} ; mkdir ${DESTDIR}"
|
---|
76 | scp /tmp/mondo-www.tgz ${DESTUSER}@${DESTMACH}:/tmp
|
---|
77 | rm -f /tmp/mondo-www.tgz
|
---|
78 | ssh ${DESTUSER}@${DESTMACH} "cd ${DESTDIR} ; tar xfz /tmp/mondo-www.tgz"
|
---|