source: trunk/install.sh @ 65

Last change on this file since 65 was 52, checked in by pinsard, 16 years ago

bug fix in install.sh

  • Property svn:keywords set to Id
File size: 2.5 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, a specific update
7# is launched.
8#
9# update :
10# $Id$
11# ++ -p should be suppress  it is not any more compulsary (-u is now the good one)
12# fplod 2008-03-28T10:26:58Z aedon.locean-ipsl.upmc.fr (Darwin)
13# new personnal webpages policy at LOCEAN so new command and new parameter (-u)
14# fplod 2007-09-28T09:30:43Z aedon.locean-ipsl.upmc.fr (Darwin)
15# parametrisation and translation
16# smasson 2007-06-07T16:43:42Z arete.locean-ipsl.upmc.fr (Darwin)
17# can give the answer with input parameters
18# fplod 2007-04-26T11:51:42Z aedon.locean-ipsl.upmc.fr (Darwin)
19#
20set -o posix
21command=$(basename ${0} .sh)
22log_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
23log=/tmp/${command}.${log_date}
24#
25usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish"
26#
27minargcount=4
28#echo " narg ${#}"
29if [ ${#} -lt ${minargcount} ]
30then
31  echo "eee : not enought arguments"
32  echo "${usage}"
33  exit 1
34fi
35#
36# default
37dirpublish="none"
38urlpublish="none"
39#
40while [ ! -z "${1}" ]
41do
42 case ${1} in
43 -w)
44  dirwww=${2}
45  shift
46 ;;
47 -p)
48  dirpublish=${2}
49  shift
50 ;;
51 -u )
52  urlpublish=${2}
53  shift
54 ;;
55 esac
56 shift # next flag
57done
58#
59set -u
60#
61# ++ check directories
62#
63answer=${1:-" "}
64case ${answer} in
65    y|Y|n|N)
66        ;;
67    *)
68        if [ "${dirpublish}" != "none" ]
69        then
70          echo "Do you want to install on ${dirpublish}  (y|[n]) ?"
71          read answer
72        fi
73        if [ "${urlpublish}" != "none" ]
74        then
75           echo "Do you want to install on ${urlpublish}  (y|[n]) ?"
76           read answer
77        fi
78        ;;
79esac
80#
81case ${answer} in
82 y|Y)
83        if [ "${dirpublish}" != "none" ]
84 then
85 # copy of ${dirwww} on $dirpublish
86 echo "iii : update of ${dirpublish}"
87 rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish}
88 # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST
89 # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched
90 userhost=${dirpublish%%:*}
91 host=${userhost##*@}
92 user=${userhost%%@*}
93 if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ]
94 then
95    wget -q "http://www.lodyc.jussieu.fr/info_reseau/persoweb/?fastupdate=1&user=${user}" -O /dev/null
96 fi
97else
98    # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit
99    dirpublish=${urlpublish##*~}
100    cd ${dirwww}
101    lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr
102    # ++ log
103fi
104
105 ;;
106 *)
107 echo "no update of ${dirpublish} or ${urlpublish}"
108 ;;
109esac
110#
111# normal exit
112exit 0
Note: See TracBrowser for help on using the repository browser.