r52 - in forge-tools/sys: . chorem.org codelutin.com nuiton.org
Author: maven-release Date: 2014-03-01 19:22:28 +0100 (Sat, 01 Mar 2014) New Revision: 52 Url: http://codelutin.com/projects/adminsys/repository/revisions/52 Log: add automatic tomcat download script Added: forge-tools/sys/check-get-tomcat.sh Modified: forge-tools/sys/chorem.org/tomcat-init.d forge-tools/sys/codelutin.com/tomcat-init.d forge-tools/sys/nuiton.org/tomcat-init.d Added: forge-tools/sys/check-get-tomcat.sh =================================================================== --- forge-tools/sys/check-get-tomcat.sh (rev 0) +++ forge-tools/sys/check-get-tomcat.sh 2014-03-01 18:22:28 UTC (rev 52) @@ -0,0 +1,88 @@ +#!/bin/sh + +# +# USAGE: check-get-tomcat.sh [debug] +# +# verifie s'il y a ou non une nouvelle version tomcat par rapport a celle installee +# si c'est le cas: +# - telecharge le fichier +# - le decompresse +# - le met en place pour les diffentes instances souhaite +# - affiche le chemin des nouvelles instances mise en place si besoin +# +# l'administrateur devra alors redemarrer les tomcat des forges +# - service tomcat-nuiton.org restart +# - service tomcat-chorem.org restart +# - service tomcat-codelutin.com restart +# + +DEBUG=false +MIRROR=http://mirrors.linsrv.net/apache/tomcat +TARGET_DIR=/opt/repository +LINK_DIR=/opt + +if [ "$1" = "debug" ]; then + export DEBUG=true +fi + +debug () { + if [ "$DEBUG" = "true" ]; then + echo "$1" + fi +} + +getFileURL () { + local RELEASE=$2 + local VERSION=${2%%.*} + local result="$MIRROR/tomcat-$VERSION/v$RELEASE/bin/apache-tomcat-$RELEASE.tar.gz" + debug "getFileURL: $result" + eval $1=\$result +} + +# get the last release for specified tomcat version +# @param $1 returned value +# @param $2 tomcat version 6, 7 or 8 +getLastRelease () { + local VERSION=$2 + local result=$(curl -s http://mirrors.linsrv.net/apache/tomcat/tomcat-$VERSION/ |grep "href=.v" |sed -re 's/.*>v([0-9]+.[0-9]+.[0-9]+).*/\1/') + debug "last version is $result" + eval $1=\$result +} + +getCurrentRelease () { + local VERSION=$2 + local LINK=$(readlink $LINK_DIR/apache-tomcat-$VERSION) + local DIR=$(basename $LINK) + local result=${DIR##*-} + debug "getCurrentRelease: $result" + eval $1="$result" +} + +installRelease () { + local RELEASE=$1 + local VERSION=${RELEASE%%.*} + local URL + getFileURL URL $RELEASE + mkdir -p $TARGET_DIR + curl -s "$URL" | tar --no-same-owner -C "$TARGET_DIR" -xz + local DIR=$(basename $URL .tar.gz) + local UNPACK_DIR=$TARGET_DIR/$DIR + local LINK=$LINK_DIR/${DIR%%.*} + sed -i 's/<Connector /<Connector URIEncoding="UTF-8" /g' $UNPACK_DIR/conf/server.xml + rm -f $LINK + ln -s $UNPACK_DIR $LINK + echo "new release installed in $LINK -> $UNPACK_DIR" +} + +update () { + local VERSION=$1 + local CURRENT_RELEASE + local LAST_RELEASE + getCurrentRelease CURRENT_RELEASE $VERSION + getLastRelease LAST_RELEASE $VERSION + if [ "$CURRENT_RELEASE" != "$LAST_RELEASE" ]; then + installRelease $LAST_RELEASE + fi +} + +update 7 Property changes on: forge-tools/sys/check-get-tomcat.sh ___________________________________________________________________ Added: svn:executable + * Modified: forge-tools/sys/chorem.org/tomcat-init.d =================================================================== --- forge-tools/sys/chorem.org/tomcat-init.d 2014-02-28 16:59:28 UTC (rev 51) +++ forge-tools/sys/chorem.org/tomcat-init.d 2014-03-01 18:22:28 UTC (rev 52) @@ -27,7 +27,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Tomcat servlet engine" DAEMON=/usr/bin/jsvc -CATALINA_HOME=/opt/apache-tomcat +CATALINA_HOME=/opt/apache-tomcat-7 DEFAULT=/etc/default/$NAME LOG=/var/log/$NAME.log CATALINA_BASE=/var/local/forge/exec/$NAME Modified: forge-tools/sys/codelutin.com/tomcat-init.d =================================================================== --- forge-tools/sys/codelutin.com/tomcat-init.d 2014-02-28 16:59:28 UTC (rev 51) +++ forge-tools/sys/codelutin.com/tomcat-init.d 2014-03-01 18:22:28 UTC (rev 52) @@ -27,7 +27,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Tomcat servlet engine" DAEMON=/usr/bin/jsvc -CATALINA_HOME=/opt/apache-tomcat +CATALINA_HOME=/opt/apache-tomcat-7 DEFAULT=/etc/default/$NAME LOG=/var/log/$NAME.log CATALINA_BASE=/var/local/forge/exec/$NAME Modified: forge-tools/sys/nuiton.org/tomcat-init.d =================================================================== --- forge-tools/sys/nuiton.org/tomcat-init.d 2014-02-28 16:59:28 UTC (rev 51) +++ forge-tools/sys/nuiton.org/tomcat-init.d 2014-03-01 18:22:28 UTC (rev 52) @@ -27,7 +27,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Tomcat servlet engine" DAEMON=/usr/bin/jsvc -CATALINA_HOME=/opt/apache-tomcat +CATALINA_HOME=/opt/apache-tomcat-7 DEFAULT=/etc/default/$NAME LOG=/var/log/$NAME.log CATALINA_BASE=/var/local/forge/exec/$NAME
participants (1)
-
maven-releaseļ¼ users.forge.codelutin.com