source: trunk/before.sh @ 58

Last change on this file since 58 was 52, checked in by pinsard, 16 years ago

bug fix in install.sh

  • Property svn:keywords set to Id
File size: 3.0 KB
Line 
1#! /bin/sh
2#
3# module :
4# preparation of temporary (before deployement) of superbib results directory
5# - tree;
6# - copy of constant images copie des images;
7# - copy of CSS style sheet;
8# - etc.
9#
10# update :
11# $Id$
12# fplod 2007-10-17T12:22:57Z aedon.locean-ipsl.upmc.fr (Darwin)
13# parametrisation of number of "many" presentation
14# fplod 2007-09-28T08:43:10Z aedon.locean-ipsl.upmc.fr (Darwin)
15# parametrisation and translation
16# fplod 2007-03-30T09:55:49Z aedon.locean-ipsl.upmc.fr (Darwin)
17# création
18#
19#
20set -o posix
21command=$(basename ${0} .sh)
22log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
23log=/tmp/${command}.${log_date}
24#
25usage=" Usage : ${command} -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany"
26#
27minargcount=9
28#echo " narg ${#}"
29if [ ${#} -lt ${minargcount} ]
30then
31  echo "eee : not enought arguments"
32  echo "${usage}"
33  exit 1
34fi
35#
36# default
37nmany=0
38#
39while [ ! -z "${1}" ]
40do
41 case ${1} in
42 -p) # product
43  product=${2}
44  shift
45 ;;
46 -s) # dirsrc
47  dirsrc=${2}
48  shift
49 ;;
50 -w) # dirwww
51  dirwww=${2}
52  shift
53 ;;
54 -l) # lang
55  lang=${2}
56  shift
57 ;;
58 -mono) # monolingual
59  monolingual=1
60 ;;
61 -multi) # multilingual
62  monolingual=0
63 ;;
64 -m)
65  nmany=${2}
66  shift
67 ;;
68 esac
69 shift # next flag
70done
71#
72set -u
73#
74# destruction of previous installation
75/bin/rm -r ${dirwww}/ 2> /dev/null
76#
77# building of directories
78if [ -d ${dirsrc}/images/ ]
79then
80   mkdir -p ${dirwww}/images/
81   if [ ${nmany} -gt 0 ]
82   then
83      mkdir -p ${dirwww}/${lang}/images/ # ++ parce que un niveau de plus que d'haibitude dans les chunck
84   fi
85fi
86#
87list_php="${dirsrc}/phpversion.php ${dirsrc}/server.php ${dirsrc}/timestamp.php"
88ls ${list_php} 1> /dev/null 2> /dev/null
89exist_php=${?}
90if [ ${exist_php} -eq 0 ]
91then
92   mkdir -p ${dirwww}/php/
93fi
94#
95if [ ${monolingual} -eq 0 ]
96then
97 mkdir -p ${dirwww}/${lang}/one/
98 if [ ${nmany} -gt 0 ]
99 then
100    mkdir -p ${dirwww}/${lang}/many/
101    imany=1
102    while [ ${imany} -le ${nmany} ]
103    do
104       mkdir -p ${dirwww}/${lang}/many/${product}$(printf "%2.2d" ${imany})/
105       imany=$(( ${imany} + 1 ))
106    done
107 fi
108else
109 mkdir -p ${dirwww}/one/
110 if [ ${nmany} -gt 0 ]
111 then
112    mkdir -p ${dirwww}/many/
113    imany=1
114    while [ ${imany} -le ${nmany} ]
115    do
116       mkdir -p ${dirwww}/many/${product}$(printf "%2.2d" ${imany})/
117    done
118 fi
119fi
120#
121if [ ${exist_php} -eq 0 ]
122then
123   for file_php in ${list_php}
124   do
125     cp ${file_php} ${dirwww}/php/
126   done
127fi
128#
129if [ -d ${dirsrc}/images ]
130then
131   cp ${dirsrc}/images/* ${dirwww}/images/
132   if [ ${nmany} -gt 0 ]
133   then
134      cp ${dirsrc}/images/* ${dirwww}/${lang}/images/ # ++ parce que un niveau de plus que d'habitude dans les chunck
135   fi
136fi
137#
138# copy of CSS
139ls *.css 1> /dev/null 2> /dev/null
140exist_css=${?}
141if [ ${exist_css} -eq 0 ]
142then
143 cp ${dirsrc}/*.css ${dirwww}/
144fi
145if [ ${nmany} -gt 0 ]
146then
147  cp ${dirsrc}/*.css ${dirwww}/${lang}/ # ++ parce que un niveau de plus que d'haibitude dans les chunck
148fi
149#
150# modification of directory time in order to trigger the generation of HTML
151# files
152find ${dirwww}/ -type d -exec touch -t 199912310000 {} \;
153#
154# end
155exit 0
Note: See TracBrowser for help on using the repository browser.