source: trunk/install.sh @ 74

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

add documents in before.sh, add -l parameter in install.sh, several improvement for bibtex bibliography

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