source: trunk/before.sh @ 105

Last change on this file since 105 was 103, checked in by pinsard, 14 years ago

modif. of headers for manuals hyperlinks improvements

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1#! /bin/sh
2#+
3#
4# .. _before.sh:
5#
6# =========
7# before.sh
8# =========
9#
10# --------------------------------
11# preparation of results directory
12# --------------------------------
13#
14# SYNOPSIS
15# ========
16#
17# ::
18#
19#  $ before.sh -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany
20#
21# DESCRIPTION
22# ===========
23#
24# preparation of temporary (before deployement) of superbib results directory
25#  - tree;
26#  - copy of constant images copie des images;
27#  - copy of CSS style sheet;
28#  - etc.
29#
30# -s  source directory
31# -w  output directory
32# -l  language
33# -mono   +todo+
34# -multi   +todo+
35# -m  +todo+
36#
37# EXAMPLES
38# ========
39#
40# TODO
41# ====
42#
43# il faudrait autoriser plusieurs fois -l lang et utiliser un tableau de
44# langues pour créer autant de répertoires qu'il faut.
45#
46# EVOLUTIONS
47# ==========
48#
49# $Id$
50#
51# - fplod 2008-09-16T15:19:59Z aedon.locean-ipsl.upmc.fr (Darwin)
52#
53#   * comments in ReStructured Text
54#
55# - fplod 2008-06-16T09:48:22Z aedon.locean-ipsl.upmc.fr (Darwin)
56#
57#   * add copy of documents
58#
59# - fplod 2007-10-17T12:22:57Z aedon.locean-ipsl.upmc.fr (Darwin)
60#
61#   * parametrisation of number of "many" presentation
62#
63# - fplod 2007-09-28T08:43:10Z aedon.locean-ipsl.upmc.fr (Darwin)
64#
65#   * parametrisation and translation
66#
67# - fplod 2007-03-30T09:55:49Z aedon.locean-ipsl.upmc.fr (Darwin)
68#
69#   * création
70#
71#-
72#
73system=$(uname)
74case "${system}" in
75   AIX|IRIX64)
76      echo " www : no specific posix checking"
77   ;;
78   *)
79      set -o posix
80   ;;
81esac
82unset system
83#
84command=$(basename ${0})
85log_date=$(date -u +"%Y%m%dT%H%M%SZ")
86log=/tmp/$(basename ${command} .sh).log.${log_date}
87#
88usage=" Usage : ${command} -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany"
89#
90minargcount=9
91#echo " narg ${#}"
92if [ ${#} -lt ${minargcount} ]
93then
94   echo "eee : not enought arguments (${#} vs ${minargcount})"
95   echo "${usage}"
96   exit 1
97fi
98unset minargcount
99#
100# default
101nmany=0
102#
103set +u
104while [ ! -z "${1}" ]
105do
106   case ${1} in
107      -p)
108         product=${2}
109         shift
110      ;;
111      -s)
112         dirsrc=${2}
113         shift
114      ;;
115      -w)
116         dirwww=${2}
117         shift
118      ;;
119      -l)
120         lang=${2}
121         shift
122      ;;
123      -mono)
124         monolingual=1
125       ;;
126      -multi)
127         monolingual=0
128      ;;
129      -m)
130         nmany=${2}
131         shift
132      ;;
133   esac
134   # next flag
135   shift
136done
137unset usage
138#
139set -u
140#
141# destruction of previous installation
142/bin/rm -r ${dirwww}/ 2> /dev/null
143#
144# building of directories
145if [ -d ${dirsrc}/images/ ]
146then
147   mkdir -p ${dirwww}/images/
148   if [ ${nmany} -gt 0 ]
149   then
150      mkdir -p ${dirwww}/${lang}/images/ # ++ parce que un niveau de plus que d'haibitude dans les chunck
151   fi
152fi
153#
154if [ -d ${dirsrc}/documents/ ]
155then
156   mkdir -p ${dirwww}/documents/
157fi
158#
159list_php="${dirsrc}/phpversion.php ${dirsrc}/server.php ${dirsrc}/timestamp.php"
160ls ${list_php} 1> /dev/null 2> /dev/null
161exist_php=${?}
162if [ ${exist_php} -eq 0 ]
163then
164   mkdir -p ${dirwww}/php/
165fi
166#
167if [ ${monolingual} -eq 0 ]
168then
169   mkdir -p ${dirwww}/${lang}/one/
170   if [ ${nmany} -gt 0 ]
171   then
172      mkdir -p ${dirwww}/${lang}/many/
173      imany=1
174      while [ ${imany} -le ${nmany} ]
175      do
176         mkdir -p ${dirwww}/${lang}/many/${product}$(printf "%2.2d" ${imany})/
177         imany=$(( ${imany} + 1 ))
178      done
179   fi
180else
181   mkdir -p ${dirwww}/one/
182   if [ ${nmany} -gt 0 ]
183   then
184      mkdir -p ${dirwww}/many/
185      imany=1
186      while [ ${imany} -le ${nmany} ]
187      do
188         mkdir -p ${dirwww}/many/${product}$(printf "%2.2d" ${imany})/
189      done
190   fi
191fi
192#
193if [ ${exist_php} -eq 0 ]
194then
195   for file_php in ${list_php}
196   do
197      cp ${file_php} ${dirwww}/php/
198   done
199fi
200unset exist_php
201#
202if [ -d ${dirsrc}/images/ ]
203then
204   cp ${dirsrc}/images/* ${dirwww}/images/
205   if [ ${nmany} -gt 0 ]
206   then
207      cp ${dirsrc}/images/* ${dirwww}/${lang}/images/ # ++ parce que un niveau de plus que d'habitude dans les chunck
208   fi
209fi
210#
211# copy of documents
212if [ -d ${dirsrc}/documents/ ]
213then
214   cp ${dirsrc}/documents/* ${dirwww}/documents/
215fi
216#
217# copy of CSS
218ls ${dirsrc}/*.css 1> /dev/null 2> /dev/null
219exist_css=${?}
220if [ ${exist_css} -eq 0 ]
221then
222   cp ${dirsrc}/*.css ${dirwww}/
223fi
224unset exist_css
225if [ ${nmany} -gt 0 ]
226then
227   cp ${dirsrc}/*.css ${dirwww}/${lang}/ # ++ parce que un niveau de plus que d'haibitude dans les chunck
228fi
229#
230# modification of directory time in order to trigger the generation of HTML
231# files
232find ${dirwww}/ -type d -exec touch -t 199912310000 {} \;
233#
234# end
235exit 0
Note: See TracBrowser for help on using the repository browser.