source: trunk/install.sh @ 76

Last change on this file since 76 was 75, checked in by pinsard, 16 years ago

comments in shell scripts in ReStructured? Text

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