source: trunk/install.sh @ 23

Last change on this file since 23 was 23, checked in by pinsard, 17 years ago

improvement of before and after tasks parametrization

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#!/bin/sh
2#
3# module :
4# publication (rsync) of dirwww content on dirpublish given in argument
5#
6# If the host of publication is cerbere.locean-ipsl.upmc.fr, update_web is
7# launched.
8#
9# update
10# $Id$
11# fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin)
12# parametrisation and translation
13# smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin)
14# can give the answer with input parameters
15# fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin)
16#
17set -o posix
18command=$(basename ${0} .sh)
19log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
20log=/tmp/${command}.${log_date}
21#
22usage=" Usage : ${command} -w dirwww -p dirpublish"
23#
24minargcount=4
25echo " narg ${#}"
26if [ ${#} -lt ${minargcount} ]
27then
28  echo "eee : not enought arguments"
29  echo "${usage}"
30  exit 1
31fi
32#
33while [ ! -z "${1}" ]
34do
35 case ${1} in
36 -w)
37  dirwww=${2}
38  shift
39 ;;
40 -p)
41  dirpublish=${2}
42  shift
43 ;;
44 esac
45 shift # next flag
46done
47#
48set -u
49#
50# ++ check directories
51#
52answer=${1:-" "}
53case ${answer} in
54    y|Y|n|N)
55        ;;
56    *)
57        echo "Do you want to install on ${dirpublish}  (y|[n]) ?"
58        read answer
59        ;;
60esac
61case ${answer} in
62 y|Y)
63 # copy of ${dirwww} on $dirpublish
64 echo "iii : update of ${dirpublish}"
65 rsync -av -e ssh ${dirwww}/ ${dirpublish}
66 # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST
67 # is cerbere.locean-ipsl.upmc.fr. If so, update_web is launched
68 userhost=${dirpublish%%:*}
69 host=${userhost##*@}
70 if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ]
71 then
72  ssh ${userhost} /usr/local_linux/bin/update_web
73 fi
74 ;;
75 *)
76 echo "no update of ${dirpublish}"
77 ;;
78esac
79#
80# normal exit
81exit 0
Note: See TracBrowser for help on using the repository browser.