source: trunk/install.sh @ 95

Last change on this file since 95 was 95, checked in by pinsard, 14 years ago

add rest2web for manuals production (and start sphinx but not yet ok)

  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1#!/bin/sh -x
2#+
3#
4# ==========
5# install.sh
6# ==========
7#
8# ----------------------------------------------
9# publication of HTML files and associated files
10# ----------------------------------------------
11#
12# SYNOPSIS
13# ========
14#
15# ::
16#
17#  $ install.sh -w dirwww -p dirpublish -u urlpublish -l login
18#
19# DESCRIPTION
20# ===========
21#
22# publication (rsync) of dirwww content on dirpublish given in argument
23#
24# If the host of publication is cerbere.locean-ipsl.upmc.fr, a specific update
25# is launched.
26#
27# -w  input directort
28# -p  output directory
29# -u  output url
30# -l  login used to access on output url
31#
32# If needed, existing directories might be removed before (to erase obsolete
33# files), using ncftp tool :
34#
35# For example, to clean directory on LOCEAN web server :
36#
37# ::
38#
39#  $ ncftp -u fplod www.locean-ipsl.upmc.fr
40#  ncftp> cd fplod
41#  ncftp> rm -f pageperso/.DS_Store
42#  ncftp> rm -rf pageperso
43#  ncftp> exit
44#
45# EXAMPLES
46# ========
47#
48# EVOLUTIONS
49# ==========
50#
51# $Id$
52#
53# - fplod 2008-09-16T15:24:26Z aedon.locean-ipsl.upmc.fr (Darwin)
54#
55#   * comments in ReStructured Text
56#
57# - fplod 2008-06-17T09:10:19Z aedon.locean-ipsl.upmc.fr (Darwin)
58#
59#   * add -l parameter only used in specific case at LOCEAN when user
60#     parameter of persoweb must be different tthan login (ex: acmo vs fplod)
61#   * replace http://www.lodyc.jussieu.fr/info_reseau/persoweb/?fastupdate=1&user=${user}" by
62#     http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}
63#
64# - fplod 2008-03-28T10:26:58Z aedon.locean-ipsl.upmc.fr (Darwin)
65#
66#   * new personnal webpages policy at LOCEAN so new command and new parameter (-u)
67#
68# - fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin)
69#
70#   * parametrisation and translation
71#
72# - smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin)
73#
74#   * can give the answer with input parameters
75#
76# - fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin)
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})
90        log_date=$(date -u +"%Y%m%dT%H%M%SZ")
91log=/tmp/$(basename ${command} .sh).log.${log_date}
92#
93usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish -l login"
94#
95minargcount=4
96#echo " narg ${#}"
97if [ ${#} -lt ${minargcount} ]
98then
99 echo "eee : not enought arguments"
100 echo "${usage}"
101 exit 1
102fi
103#
104# default
105dirpublish="none"
106urlpublish="none"
107login="none"
108#
109while [ ! -z "${1}" ]
110do
111 case ${1} in
112 -w)
113  dirwww=${2}
114  shift
115 ;;
116 -p)
117  dirpublish=${2}
118  shift
119 ;;
120 -u )
121  urlpublish=${2}
122  shift
123 ;;
124 -l )
125  login=${2}
126  shift
127 ;;
128 esac
129 shift # next flag
130done
131#
132set -u
133#
134# ++ check directories
135#
136answer=${1:-" "}
137case ${answer} in
138 y|Y|n|N)
139 ;;
140 *)
141 if [ "${dirpublish}" != "none" ]
142 then
143  echo "Do you want to install on ${dirpublish} (y|[n]) ?"
144  read answer
145 fi
146 if [ "${urlpublish}" != "none" ]
147 then
148  echo "Do you want to install on ${urlpublish} (y|[n]) ?"
149  read answer
150 fi
151 ;;
152esac
153#
154case ${answer} in
155 y|Y)
156  if [ "${dirpublish}" != "none" ]
157  then
158   # copy of ${dirwww} on $dirpublish
159   echo "iii : update of ${dirpublish}"
160   rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish}
161   # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST
162   # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched
163   userhost=${dirpublish%%:*}
164   host=${userhost##*@}
165   if [ ${login} = "none" ]
166   then
167    user=${userhost%%@*}
168   else
169    user=${login}
170   fi
171   if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ]
172   then
173    wget -q "http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}" -O /dev/null
174   fi
175  else
176   # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit
177   dirpublish=${urlpublish##*~}
178   cd ${dirwww}
179   #lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr
180   lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} www.locean-ipsl.upmc.fr
181# pour acmo a la main ++
182#++lftp -e 'mirror -R . acmo/nouveaux/;quit' -u fplod www.locean-ipsl.upmc.fr
183
184   # ++ log
185  fi
186 ;;
187 *)
188  echo "no update of ${dirpublish} or ${urlpublish}"
189 ;;
190esac
191#
192# normal exit
193exit 0
Note: See TracBrowser for help on using the repository browser.