[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 | # |
---|
| 79 | system=$(uname) |
---|
| 80 | case "${system}" in |
---|
| 81 | AIX|IRIX64) |
---|
| 82 | echo " www : no specific posix checking" |
---|
| 83 | ;; |
---|
| 84 | *) |
---|
| 85 | set -o posix |
---|
| 86 | ;; |
---|
| 87 | esac |
---|
| 88 | # |
---|
[79] | 89 | command=$(basename ${0}) |
---|
[23] | 90 | log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") |
---|
[79] | 91 | log=/tmp/$(basename ${command} .sh).${log_date} |
---|
[2] | 92 | # |
---|
[29] | 93 | usage=" Usage : ${command} -p product -s dirsrc -w dirwww -l lang -mono|-multi -m nmany" |
---|
[23] | 94 | # |
---|
| 95 | minargcount=9 |
---|
[25] | 96 | #echo " narg ${#}" |
---|
[23] | 97 | if [ ${#} -lt ${minargcount} ] |
---|
| 98 | then |
---|
[80] | 99 | echo "eee : not enought arguments (${#} vs ${minargcount})" |
---|
[74] | 100 | echo "${usage}" |
---|
| 101 | exit 1 |
---|
[23] | 102 | fi |
---|
| 103 | # |
---|
[29] | 104 | # default |
---|
[52] | 105 | nmany=0 |
---|
[29] | 106 | # |
---|
[23] | 107 | while [ ! -z "${1}" ] |
---|
| 108 | do |
---|
| 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 |
---|
| 138 | done |
---|
| 139 | # |
---|
| 140 | set -u |
---|
| 141 | # |
---|
[2] | 142 | # destruction of previous installation |
---|
[23] | 143 | /bin/rm -r ${dirwww}/ 2> /dev/null |
---|
[2] | 144 | # |
---|
| 145 | # building of directories |
---|
[26] | 146 | if [ -d ${dirsrc}/images/ ] |
---|
| 147 | then |
---|
[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] | 153 | fi |
---|
| 154 | # |
---|
[74] | 155 | if [ -d ${dirsrc}/documents/ ] |
---|
| 156 | then |
---|
| 157 | mkdir -p ${dirwww}/documents/ |
---|
| 158 | fi |
---|
| 159 | # |
---|
[26] | 160 | list_php="${dirsrc}/phpversion.php ${dirsrc}/server.php ${dirsrc}/timestamp.php" |
---|
| 161 | ls ${list_php} 1> /dev/null 2> /dev/null |
---|
| 162 | exist_php=${?} |
---|
| 163 | if [ ${exist_php} -eq 0 ] |
---|
| 164 | then |
---|
[74] | 165 | mkdir -p ${dirwww}/php/ |
---|
[26] | 166 | fi |
---|
| 167 | # |
---|
[52] | 168 | if [ ${monolingual} -eq 0 ] |
---|
[23] | 169 | then |
---|
| 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] | 181 | else |
---|
| 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] | 192 | fi |
---|
[2] | 193 | # |
---|
[26] | 194 | if [ ${exist_php} -eq 0 ] |
---|
| 195 | then |
---|
[74] | 196 | for file_php in ${list_php} |
---|
| 197 | do |
---|
| 198 | cp ${file_php} ${dirwww}/php/ |
---|
| 199 | done |
---|
[26] | 200 | fi |
---|
[2] | 201 | # |
---|
[74] | 202 | if [ -d ${dirsrc}/images/ ] |
---|
[23] | 203 | then |
---|
[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] | 209 | fi |
---|
[2] | 210 | # |
---|
[74] | 211 | # copy of documents |
---|
[75] | 212 | if [ -d ${dirsrc}/documents/ ] |
---|
[74] | 213 | then |
---|
| 214 | cp ${dirsrc}/documents/* ${dirwww}/documents/ |
---|
| 215 | fi |
---|
| 216 | # |
---|
[2] | 217 | # copy of CSS |
---|
[74] | 218 | ls ${dirsrc}/*.css 1> /dev/null 2> /dev/null |
---|
[51] | 219 | exist_css=${?} |
---|
| 220 | if [ ${exist_css} -eq 0 ] |
---|
| 221 | then |
---|
| 222 | cp ${dirsrc}/*.css ${dirwww}/ |
---|
| 223 | fi |
---|
[52] | 224 | if [ ${nmany} -gt 0 ] |
---|
[29] | 225 | then |
---|
[74] | 226 | cp ${dirsrc}/*.css ${dirwww}/${lang}/ # ++ parce que un niveau de plus que d'haibitude dans les chunck |
---|
[29] | 227 | fi |
---|
[2] | 228 | # |
---|
[23] | 229 | # modification of directory time in order to trigger the generation of HTML |
---|
| 230 | # files |
---|
| 231 | find ${dirwww}/ -type d -exec touch -t 199912310000 {} \; |
---|
[2] | 232 | # |
---|
[23] | 233 | # end |
---|
[2] | 234 | exit 0 |
---|