#! /bin/sh #+ # # .. _install.sh: # # NAME # ==== # # install.sh - publication of HTML files and associated files # # SYNOPSIS # ======== # # :: # # $ install.sh -w dirwww -p dirpublish -u urlpublish -l login # # DESCRIPTION # =========== # # publication (rsync) of dirwww content on dirpublish given in argument # # If the host of publication is cerbere.locean-ipsl.upmc.fr, a specific update # is launched. # # -w input directort # -p output directory # -u output url # -l login used to access on output url # # EXAMPLES # ======== # # EVOLUTIONS # ========== # # $Id$ # # - fplod 2009-04-27T10:21:23Z aedon.locean-ipsl.upmc.fr (Darwin) # # * creation from personnal tool (used for superbib, SAXO, etc.) # #- system=$(uname) case "${system}" in AIX|IRIX64) echo " www : no specific posix checking" ;; *) set -o posix ;; esac # set -u # command=$(basename ${0}) log_date=$(date -u +"%Y%m%dT%H%M%SZ") log=/tmp/$(basename ${command} .sh).log.${log_date} # usage=" Usage : ${command} -w dirwww -p dirpublish -u urlpublish -l login" # minargcount=4 #echo " narg ${#}" if [ ${#} -lt ${minargcount} ] then echo "eee : not enought arguments" echo "${usage}" exit 1 fi # # default dirpublish="none" urlpublish="none" login="none" # while [ ${#} -gt 0 ] do case ${1} in -w) dirwww=${2} shift ;; -p) dirpublish=${2} shift ;; -u) urlpublish=${2} shift ;; -l) login=${2} shift ;; esac # next flag shift done # # ++ check directories # answer=${1:-" "} case ${answer} in y|Y|n|N) ;; *) if [ "${dirpublish}" != "none" ] then echo "Do you want to install ${dirwww} on ${dirpublish} (y|[n]) ?" read answer fi if [ "${urlpublish}" != "none" ] then echo "Do you want to install ${dirwww} on ${urlpublish} (y|[n]) ?" read answer fi ;; esac # case ${answer} in y|Y) if [ "${dirpublish}" != "none" ] then # copy of ${dirwww} on $dirpublish echo "iii : update of ${dirpublish}" rsync -av --exclude=".DS_Store" -e ssh ${dirwww}/ ${dirpublish} # detect if in dirpublish following this pattern [USER@]HOST:SRC, HOST # is cerbere.locean-ipsl.upmc.fr. If so, a specific update is launched userhost=${dirpublish%%:*} host=${userhost##*@} if [ ${login} = "none" ] then user=${userhost%%@*} else user=${login} fi if [ "${host}" = "cerbere.locean-ipsl.upmc.fr" ] then wget -q "http://intranet.locean-ipsl.upmc.fr/persoweb/?fastupdate=1&user=${user}" -O /dev/null fi else # urlpublish=http://www.locean-ipsl.upmc.fr/~ginette/produit dirpublish=${urlpublish##*~} cd ${dirwww} #lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} skyros.locean-ipsl.upmc.fr lftp -e "mirror -R . ${dirpublish};quit" -u ${LOGNAME} www.locean-ipsl.upmc.fr # ++ log fi ;; *) echo "no update of ${dirpublish} or ${urlpublish}" ;; esac # # normal exit exit 0