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 |
|
---|
12 | LOCALDIR=/var/www/html/mondo
|
---|
13 | LOCALDOC=/var/www/html/mondo-doc
|
---|
14 | DESTUSER=apache
|
---|
15 | MONDODIR=/mondo/www/html/mondo
|
---|
16 | TESTDIR=/mondo/www/html/test
|
---|
17 |
|
---|
18 | force=1
|
---|
19 | nodoc=0
|
---|
20 |
|
---|
21 | if [ "$1" = "--keep" ]; then
|
---|
22 | force=0
|
---|
23 | optsvn=""
|
---|
24 | shift
|
---|
25 | elif [ "$1" = "-nodoc" ]; then
|
---|
26 | nodoc=1
|
---|
27 | optsvn="--force"
|
---|
28 | shift
|
---|
29 | else
|
---|
30 | optsvn="--force"
|
---|
31 | fi
|
---|
32 |
|
---|
33 | dname=`dirname $0`
|
---|
34 | prem=`echo $dname |cut -c1`
|
---|
35 | if [ ${prem} == "/" ]; then
|
---|
36 | export TOOLHOME=$dname
|
---|
37 | else
|
---|
38 | export TOOLHOME=${PWD}/$dname
|
---|
39 | fi
|
---|
40 |
|
---|
41 | . $TOOLHOME/common-env
|
---|
42 | . $TOOLHOME/svn-env
|
---|
43 | . $TOOLHOME/ftp-env
|
---|
44 |
|
---|
45 | # To be safe for SVN commands
|
---|
46 | cd ${TOOLHOME}/..
|
---|
47 |
|
---|
48 | if [ $force -eq 1 ]; then
|
---|
49 | echo "Purging $LOCALDIR"
|
---|
50 | rm -rf $LOCALDIR/* $LOCALDIR/.??*
|
---|
51 | fi
|
---|
52 |
|
---|
53 | svn export $optsvn ${TOOLHOME}/../website $LOCALDIR
|
---|
54 |
|
---|
55 | if [ $force -eq 1 ]; then
|
---|
56 | echo "Purging $LOCALDOC"
|
---|
57 | rm -rf $LOCALDOC/* $LOCALDOC/.??*
|
---|
58 | fi
|
---|
59 |
|
---|
60 | svn export $optsvn ${TOOLHOME}/../mondo-doc $LOCALDOC
|
---|
61 |
|
---|
62 | #
|
---|
63 | # Version handling
|
---|
64 | #
|
---|
65 | $TOOLHOME/expandver $LOCALDIR/top.shtml $LOCALDOC/mondorescue-howto.sgml $LOCALDOC/*.8
|
---|
66 |
|
---|
67 | if [ $nodoc -eq 0 ]; then
|
---|
68 | cd $LOCALDOC
|
---|
69 | make -f Makefile.howto
|
---|
70 | make -f Makefile.man
|
---|
71 | mkdir -p $LOCALDIR/docs
|
---|
72 | mv $LOCALDOC/* $LOCALDIR/docs
|
---|
73 | #
|
---|
74 | # Man pages corrections
|
---|
75 | #
|
---|
76 | perl -pi -e 's~/man8/~/docs/~g' $LOCALDIR/docs/*.8.html
|
---|
77 | perl -pi -e 's~<A HREF[=./A-z0-9"]*/man1/[^<]*>([A-z0-9]*)</A>~$1~g' $LOCALDIR/docs/*.8.html
|
---|
78 | perl -pi -e 's~/index.html~/index.shtml~' $LOCALDIR/docs/*.8.html
|
---|
79 | fi
|
---|
80 | find $LOCALDIR -type d | xargs chmod 755
|
---|
81 | find $LOCALDIR -type f | xargs chmod 644
|
---|
82 |
|
---|
83 | cd $LOCALDIR
|
---|
84 | #
|
---|
85 | # Some links for the Web site
|
---|
86 | #
|
---|
87 | ln -sf /var/www/html/mediawiki .
|
---|
88 | ln -sf /var/www/html/admin .
|
---|
89 |
|
---|
90 | # Compute News
|
---|
91 | $TOOLHOME/mknewshtml.pl $LOCALDIR
|
---|
92 |
|
---|
93 | if [ _"$1" == _"" ]; then
|
---|
94 | exit 0
|
---|
95 | else
|
---|
96 | if [ _"$1" == _"test" ]; then
|
---|
97 | DESTDIR=$TESTDIR
|
---|
98 | else
|
---|
99 | DESTDIR=$MONDODIR
|
---|
100 | fi
|
---|
101 | echo "Delivering to $DESTDIR on ${DESTMACH}"
|
---|
102 | fi
|
---|
103 | tar cfz /tmp/mondo-www.tgz .
|
---|
104 | scp /tmp/mondo-www.tgz ${DESTUSER}@${DESTMACH}:/tmp
|
---|
105 | rm -f /tmp/mondo-www.tgz
|
---|
106 | ssh ${DESTUSER}@${DESTMACH} "rm -rf ${DESTDIR} ; mkdir ${DESTDIR} ; cd ${DESTDIR} ; tar xfz /tmp/mondo-www.tgz"
|
---|