source: trunk/adm/install.sh @ 53

Last change on this file since 53 was 37, checked in by pinsard, 13 years ago

prepare products info on website

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