source: trunk/adm/install.sh @ 74

Last change on this file since 74 was 67, checked in by pinsard, 15 years ago

project homogenization

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