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 | # |
---|
20 | set -o posix |
---|
21 | command=$(basename ${0} .sh) |
---|
22 | log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") |
---|
23 | log=/tmp/${command}.${log_date} |
---|
24 | # |
---|
25 | usage=" Usage : ${command} -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany" |
---|
26 | # |
---|
27 | minargcount=9 |
---|
28 | #echo " narg ${#}" |
---|
29 | if [ ${#} -lt ${minargcount} ] |
---|
30 | then |
---|
31 | echo "eee : not enought arguments" |
---|
32 | echo "${usage}" |
---|
33 | exit 1 |
---|
34 | fi |
---|
35 | # |
---|
36 | # default |
---|
37 | nmany=1 |
---|
38 | # |
---|
39 | while [ ! -z "${1}" ] |
---|
40 | do |
---|
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) # multiingual |
---|
62 | monolingual=0 |
---|
63 | ;; |
---|
64 | -m) |
---|
65 | nmany=${2} |
---|
66 | shift |
---|
67 | ;; |
---|
68 | esac |
---|
69 | shift # next flag |
---|
70 | done |
---|
71 | # |
---|
72 | set -u |
---|
73 | # |
---|
74 | # destruction of previous installation |
---|
75 | /bin/rm -r ${dirwww}/ 2> /dev/null |
---|
76 | # |
---|
77 | # building of directories |
---|
78 | if [ -d ${dirsrc}/images/ ] |
---|
79 | then |
---|
80 | mkdir -p ${dirwww}/images/ |
---|
81 | if [ ${nmany} -gt 1 ] |
---|
82 | then |
---|
83 | mkdir -p ${dirwww}/${lang}//images/ # ++ parce que un niveau de plus que d'haibitude dans les chunck |
---|
84 | fi |
---|
85 | fi |
---|
86 | # |
---|
87 | list_php="${dirsrc}/phpversion.php ${dirsrc}/server.php ${dirsrc}/timestamp.php" |
---|
88 | ls ${list_php} 1> /dev/null 2> /dev/null |
---|
89 | exist_php=${?} |
---|
90 | if [ ${exist_php} -eq 0 ] |
---|
91 | then |
---|
92 | mkdir -p ${dirwww}/php/ |
---|
93 | fi |
---|
94 | # |
---|
95 | if [ ${monolingual} = 0 ] |
---|
96 | then |
---|
97 | mkdir -p ${dirwww}/${lang}/one/ |
---|
98 | mkdir -p ${dirwww}/${lang}/many/ |
---|
99 | if [ ${nmany} -gt 1 ] |
---|
100 | then |
---|
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 |
---|
108 | else |
---|
109 | mkdir -p ${dirwww}/one/ |
---|
110 | mkdir -p ${dirwww}/many/ |
---|
111 | if [ ${nmany} -gt 1 ] |
---|
112 | then |
---|
113 | imany=1 |
---|
114 | while [ ${imany} -le ${nmany} ] |
---|
115 | do |
---|
116 | mkdir -p ${dirwww}/many/${product}$(printf "%2.2d" ${imany})/ |
---|
117 | done |
---|
118 | fi |
---|
119 | fi |
---|
120 | # |
---|
121 | if [ ${exist_php} -eq 0 ] |
---|
122 | then |
---|
123 | for file_php in ${list_php} |
---|
124 | do |
---|
125 | cp ${file_php} ${dirwww}/php/ |
---|
126 | done |
---|
127 | fi |
---|
128 | # |
---|
129 | if [ -d ${dirsrc}/images ] |
---|
130 | then |
---|
131 | cp ${dirsrc}/images/* ${dirwww}/images/ |
---|
132 | if [ ${nmany} -gt 1 ] |
---|
133 | then |
---|
134 | cp ${dirsrc}/images/* ${dirwww}/${lang}/images/ # ++ parce que un niveau de plus que d'habitude dans les chunck |
---|
135 | fi |
---|
136 | fi |
---|
137 | # |
---|
138 | # copy of CSS |
---|
139 | cp ${dirsrc}/*.css ${dirwww}/ |
---|
140 | if [ ${nmany} -gt 1 ] |
---|
141 | then |
---|
142 | cp ${dirsrc}/*.css ${dirwww}/${lang}/ # ++ parce que un niveau de plus que d'haibitude dans les chunck |
---|
143 | fi |
---|
144 | # |
---|
145 | # modification of directory time in order to trigger the generation of HTML |
---|
146 | # files |
---|
147 | find ${dirwww}/ -type d -exec touch -t 199912310000 {} \; |
---|
148 | # |
---|
149 | # end |
---|
150 | exit 0 |
---|