source: trunk/install.sh @ 87

Last change on this file since 87 was 83, checked in by pinsard, 16 years ago

bug fixes, add guides sources and tools

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