source: trunk/before.sh @ 87

Last change on this file since 87 was 87, checked in by pinsard, 15 years ago

add journals thanks to REGYNA project (redo)

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