source: trunk/adm/install.sh @ 35

Last change on this file since 35 was 2, checked in by pinsard, 13 years ago

first commit with original work of Francoise Pinsard

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