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