source: trunk/adm/install.sh @ 199

Last change on this file since 199 was 199, checked in by pinsard, 11 years ago

fix svn properties

  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 3.2 KB
Line 
1#! /bin/sh
2#+
3#
4# .. _install.sh:
5#
6# ==========
7# install.sh
8# ==========
9#
10# NAME
11# ====
12#
13# install.sh - publication of HTML files and associated files
14#
15# SYNOPSIS
16# ========
17#
18# ::
19#
20#  $ install.sh -w dirwww -p dirpublish -u urlpublish -l login
21#
22# DESCRIPTION
23# ===========
24#
25# publication (rsync) of dirwww content on dirpublish given in argument
26#
27# If the host of publication is cerbere.locean-ipsl.upmc.fr, a specific update
28# is launched.
29#
30# -w  input directort
31# -p  output directory
32# -u  output url
33# -l  login used to access on output url
34#
35# EXAMPLES
36# ========
37#
38# TODO
39# ====
40#
41# destroy. use fptools one's instead
42#
43# EVOLUTIONS
44# ==========
45#
46# $Id$
47#
48# - fplod 2009-04-27T10:21:23Z aedon.locean-ipsl.upmc.fr (Darwin)
49#
50#   * creation from personnal tool (used for superbib, SAXO, etc.)
51#
52#-
53system=$(uname)
54case "${system}" in
55   AIX|IRIX64)
56      echo " www : no specific posix checking"
57   ;;
58   *)
59      set -o posix
60   ;;
61esac
62#
63set -u
64#
65command=$(basename ${0})
66log_date=$(date -u +"%Y%m%dT%H%M%SZ")
67log=/tmp/$(basename ${command} .sh).log.${log_date}
68#
69usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish -l login"
70#
71minargcount=4
72#echo " narg ${#}"
73if [ ${#} -lt ${minargcount} ]
74then
75   echo "eee : not enought arguments"
76   echo "${usage}"
77   exit 1
78fi
79#
80# default
81dirpublish="none"
82urlpublish="none"
83login="none"
84#
85while [ ${#} -gt 0 ]
86do
87   case ${1} in
88      -w)
89         dirwww=${2}
90         shift
91      ;;
92      -p)
93         dirpublish=${2}
94         shift
95      ;;
96      -u)
97         urlpublish=${2}
98         shift
99      ;;
100      -l)
101         login=${2}
102         shift
103      ;;
104   esac
105   # next flag
106   shift
107done
108#
109# ++ check directories
110#
111answer=${1:-" "}
112case ${answer} in
113   y|Y|n|N)
114   ;;
115   *)
116      if [ "${dirpublish}" != "none" ]
117      then
118         echo "Do you want to install ${dirwww} on ${dirpublish} (y|[n]) ?"
119         read answer
120      fi
121      if [ "${urlpublish}" != "none" ]
122      then
123         echo "Do you want to install ${dirwww} on ${urlpublish} (y|[n]) ?"
124         read answer
125      fi
126   ;;
127esac
128#
129case ${answer} in
130   y|Y)
131      if [ "${dirpublish}" != "none" ]
132      then
133         # copy of ${dirwww} on $dirpublish
134         echo "iii : update of ${dirpublish}"
135         rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish}
136         # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST
137         # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched
138         userhost=${dirpublish%%:*}
139         host=${userhost##*@}
140         if [ ${login} = "none" ]
141         then
142            user=${userhost%%@*}
143         else
144            user=${login}
145         fi
146         if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ]
147         then
148           wget -q "http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}" -O /dev/null
149         fi
150      else
151         # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit
152         dirpublish=${urlpublish##*~}
153         cd ${dirwww}
154         #lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr
155         lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} www.locean-ipsl.upmc.fr
156         # ++ log
157      fi
158   ;;
159   *)
160      echo "no update of ${dirpublish} or ${urlpublish}"
161   ;;
162esac
163#
164# normal exit
165exit 0
Note: See TracBrowser for help on using the repository browser.