New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
install.sh in branches/UKMO/AMM15_v3_6_STABLE_package_collate/ADM/DOC_SCRIPTS – NEMO

source: branches/UKMO/AMM15_v3_6_STABLE_package_collate/ADM/DOC_SCRIPTS/install.sh @ 10237

Last change on this file since 10237 was 8058, checked in by jgraham, 8 years ago

Clear keywords

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.5 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#  $ ncftp -u fplod www.locean-ipsl.upmc.fr
38#  ncftp> cd fplod
39#  ncftp> rm -f pageperso/.DS_Store
40#  ncftp> rm -rf pageperso
41#  ncftp> exit
42#
43# EXAMPLES
44# ========
45#
46# EVOLUTIONS
47# ==========
48#
49# $Id: install.sh 2246 2010-10-13 09:47:23Z rblod $
50#
51# - fplod 2008-09-16T15:24:26Z aedon.locean-ipsl.upmc.fr (Darwin)
52#
53#   * comments in ReStructured Text
54#
55# - fplod 2008-06-17T09:10:19Z aedon.locean-ipsl.upmc.fr (Darwin)
56#
57#   * add -l parameter only used in specific case at LOCEAN when user
58#     parameter of persoweb must be different tthan login (ex: acmo vs fplod)
59#   * replace http://www.lodyc.jussieu.fr/info_reseau/persoweb/?fastupdate=1&user=${user}" by
60#     http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}
61#
62# - fplod 2008-03-28T10:26:58Z aedon.locean-ipsl.upmc.fr (Darwin)
63#
64#   * new personnal webpages policy at LOCEAN so new command and new parameter (-u)
65#
66# - fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin)
67#
68#   * parametrisation and translation
69#
70# - smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin)
71#
72#   * can give the answer with input parameters
73#
74# - fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin)
75#
76#-
77system=$(uname)
78case "${system}" in
79   AIX|IRIX64)
80      echo " www : no specific posix checking"
81   ;;
82   *)
83      set -o posix
84   ;;
85esac
86unset system
87#
88command=$(basename ${0})
89log_date=$(date -u +"%Y%m%dT%H%M%SZ")
90log=/tmp/$(basename ${command} .sh).log.${log_date}
91#
92usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish -l login"
93#
94minargcount=4
95#echo " narg ${#}"
96if [ ${#} -lt ${minargcount} ]
97then
98   echo "eee : not enought arguments"
99   echo "${usage}"
100   exit 1
101fi
102unset minargcount
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   # next flag
130   shift
131done
132#
133set -u
134#
135# ++ check directories
136#
137answer=${1:-" "}
138case ${answer} in
139   y|Y|n|N)
140   ;;
141   *)
142      if [ "${dirpublish}" != "none" ]
143      then
144         echo "Do you want to install on ${dirpublish} (y|[n]) ?"
145         read answer
146      fi
147      if [ "${urlpublish}" != "none" ]
148      then
149         echo "Do you want to install on ${urlpublish} (y|[n]) ?"
150         read answer
151      fi
152   ;;
153esac
154#
155case  ${answer} in
156   y|Y)
157      if [ "${dirpublish}" != "none" ]
158      then
159         # copy of ${dirwww} on $dirpublish
160         echo "iii : update of ${dirpublish}"
161         rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish}
162         # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST
163         # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched
164         userhost=${dirpublish%%:*}
165         host=${userhost##*@}
166         if [ ${login} = "none" ]
167         then
168            user=${userhost%%@*}
169         else
170            user=${login}
171         fi
172         if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ]
173         then
174            wget -q "http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}" -O /dev/null
175         fi
176      else
177         # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit
178         dirpublish=${urlpublish##*~}
179         cd ${dirwww}
180         #lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr
181         lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} localhost
182         # pour acmo a la main ++
183         #++lftp -e 'mirror -R . acmo/nouveaux/;quit' -u fplod www.locean-ipsl.upmc.fr
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.