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
RevLine 
[2]1#! /bin/sh
[80]2#+
[2]3#
[75]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#
[23]20# preparation of temporary (before deployement) of superbib results directory
[75]21#  - tree;
22#  - copy of constant images copie des images;
23#  - copy of CSS style sheet;
24#  - etc.
[2]25#
[83]26# -s  source directory
27# -w  output directory
28# -l  language
29# -mono   ++
30# -multi   ++
31# -m  ++
32#
[75]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#
[87]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#
[75]52# EVOLUTIONS
53# ==========
54#
[23]55# $Id$
[2]56#
[75]57# - fplod 2008-09-16T15:19:59Z aedon.locean-ipsl.upmc.fr (Darwin)
[2]58#
[82]59#   * comments in ReStructured Text
[75]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#
[79]89command=$(basename ${0})
[23]90log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
[79]91log=/tmp/$(basename ${command} .sh).${log_date}
[2]92#
[29]93usage=" Usage : ${command} -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany"
[23]94#
95minargcount=9
[25]96#echo " narg ${#}"
[23]97if [ ${#} -lt ${minargcount} ]
98then
[80]99 echo "eee : not enought arguments (${#} vs ${minargcount})"
[74]100 echo "${usage}"
101 exit 1
[23]102fi
103#
[29]104# default
[52]105nmany=0
[29]106#
[23]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 ;;
[29]126 -mono) # monolingual
[23]127  monolingual=1
128 ;;
[52]129 -multi) # multilingual
[23]130  monolingual=0
131 ;;
[29]132 -m)
133  nmany=${2}
134  shift
135 ;;
[23]136 esac
137 shift # next flag
138done
139#
140set -u
141#
[2]142# destruction of previous installation
[23]143/bin/rm -r ${dirwww}/ 2> /dev/null
[2]144#
145# building of directories
[26]146if [ -d ${dirsrc}/images/ ]
147then
[74]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
[26]153fi
154#
[74]155if [ -d ${dirsrc}/documents/ ]
156then
157 mkdir -p ${dirwww}/documents/
158fi
159#
[26]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
[74]165 mkdir -p ${dirwww}/php/
[26]166fi
167#
[52]168if [ ${monolingual} -eq 0 ]
[23]169then
170 mkdir -p ${dirwww}/${lang}/one/
[52]171 if [ ${nmany} -gt 0 ]
[29]172 then
[74]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
[29]180 fi
[23]181else
182 mkdir -p ${dirwww}/one/
[52]183 if [ ${nmany} -gt 0 ]
[29]184 then
[74]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
[29]191 fi
[23]192fi
[2]193#
[26]194if [ ${exist_php} -eq 0 ]
195then
[74]196 for file_php in ${list_php}
197 do
198  cp ${file_php} ${dirwww}/php/
199 done
[26]200fi
[2]201#
[74]202if [ -d ${dirsrc}/images/ ]
[23]203then
[74]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
[23]209fi
[2]210#
[74]211# copy of documents
[75]212if [ -d ${dirsrc}/documents/ ]
[74]213then
214 cp ${dirsrc}/documents/* ${dirwww}/documents/
215fi
216#
[2]217# copy of CSS
[74]218ls ${dirsrc}/*.css 1> /dev/null 2> /dev/null
[51]219exist_css=${?}
220if [ ${exist_css} -eq 0 ]
221then
222 cp ${dirsrc}/*.css ${dirwww}/
223fi
[52]224if [ ${nmany} -gt 0 ]
[29]225then
[74]226 cp ${dirsrc}/*.css ${dirwww}/${lang}/ # ++ parce que un niveau de plus que d'haibitude dans les chunck
[29]227fi
[2]228#
[23]229# modification of directory time in order to trigger the generation of HTML
230# files
231find ${dirwww}/ -type d -exec touch -t 199912310000 {} \;
[2]232#
[23]233# end
[2]234exit 0
Note: See TracBrowser for help on using the repository browser.