1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/mitgcm.org/scripts/bld_manual.sh,v 1.1 2008/03/03 01:47:26 jmc Exp $ |
4 |
|
5 |
#BLDDIR='/u/u0/httpd/html/build_manual' |
6 |
#cd $BLDDIR |
7 |
#retval=$? |
8 |
#if test "x$retval" != x0 ; then |
9 |
# echo "unable to cd to '$BLDDIR' => exit" |
10 |
# exit |
11 |
#fi |
12 |
echo -n "-- Start '"`basename $0`"' at : " ; date |
13 |
|
14 |
export CVSROOT=/u/gcmpack |
15 |
#OUTDIR='/u/u0/httpd/html/r2_manual' |
16 |
#- note: "mv" to relative path below is much faster than using full path above |
17 |
OUTDIR='../r2_manual' |
18 |
|
19 |
echo |
20 |
echo " Removing previous directories..." |
21 |
test -e old && rm -rf old |
22 |
mkdir old |
23 |
mv MITgcm manual mitgcm.org old |
24 |
rm -rf old & |
25 |
|
26 |
if test -e scratch/dev_docs ; then |
27 |
mv scratch/dev_docs "scratch/dev_docs_"`date +%Y%m%d`"_"`date +%H%M` |
28 |
fi |
29 |
|
30 |
echo |
31 |
echo "-- Download from CVS :" |
32 |
rm -f dwn.log |
33 |
echo -n ' MITgcm ... ' |
34 |
cvs -q co -P MITgcm > dwn.log |
35 |
echo "=====================================" >> dwn.log |
36 |
echo -n ', manual ... ' ; |
37 |
cvs -q co -P manual >> dwn.log |
38 |
echo "=====================================" >> dwn.log |
39 |
echo -n ', mitgcm.org ...' |
40 |
cvs -q co -P mitgcm.org >> dwn.log |
41 |
echo -n " : done " ; date |
42 |
|
43 |
( |
44 |
rm -f build.log |
45 |
cd mitgcm.org/devel/buildweb |
46 |
make All | tee ../../../build.log |
47 |
) |
48 |
echo -n '-- Finish building manual at : ' ; date |
49 |
if test -e scratch/dev_docs ; then |
50 |
newbld="dev_docs_"`date +%Y%m%d`"_"`date +%H%M` |
51 |
echo " mv scratch/dev_docs $OUTDIR/$newbld" |
52 |
mv scratch/dev_docs $OUTDIR/$newbld |
53 |
fi |
54 |
#exit |
55 |
|
56 |
( |
57 |
cd $OUTDIR |
58 |
echo -n "-- Install latest in dir: "`pwd` |
59 |
test -e latest && rm -f latest |
60 |
echo -n " ln -s `ls -td dev_docs* | head -1` latest" |
61 |
ln -s `ls -td dev_docs* | head -1` latest |
62 |
n=$(( `ls dev_docs*/index.html | wc -l` - 7 )) |
63 |
if test $n -gt 0 ; then |
64 |
echo -n ' remove dir: ' |
65 |
ls -t dev_docs*/index.html | sed 's/\/index.html//' | tail -"$n" |
66 |
ls -t dev_docs*/index.html | sed 's/\/index.html//' | tail -"$n" | xargs rm -rf |
67 |
fi |
68 |
) |
69 |
|
70 |
echo -n '-- Done at : ' ; date |