From: Ludovic CHEVALIER Date: Tue, 25 Jun 2013 13:12:37 +0000 (+0200) Subject: [SCRIPTS] +script de maj de spip X-Git-Tag: v3.3.0~139 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/data/%40%20%27info_date_publication_anterieure%27%20=%3E%20%27Previously%20published%20on:%27%2C%20%27info_date_referencement%27%20=%3E%20%27THIS%20SITE%20REFERENCED%20ON:%27%2C%20%27info_derniere_etape%27%20=%3E%20%27Done%21%27%2C-%27info_derniers_articles_publies%27%20=%3E%20%27Your%20most%20recently%20published%20articles%27%2C-%27info_desactiver_messagerie_personnelle%27%20=%3E%20%27You%20can%20enable%20or%20disable%20your%20personal%20messaging%20on%20this%20site.%27%2C%20%27info_descriptif%27%20=%3E%20%27Description:%27%2C%20%27info_desinstaller_plugin%27%20=%3E%20%27%20deactivates%20the%20plugin%20and%20deletes%20the%20data%27%2C%20%27info_discussion_cours%27%20=%3E%20%27Current%20discussions%27%2C%40%40%20-332%2C7%20%20284%2C6%20%40%40%20Do%20not%20submit%20this%20import%20request.%3Cp%3EFor%20more%20information%2C%20please%20see%20%3Ca%20href=?a=commitdiff_plain;h=8ed9bb762bd42e6262d417333a5a42c2c15a79e0;p=lhc%2Fweb%2Fwww.git [SCRIPTS] +script de maj de spip --- diff --git a/scripts/maj.sh b/scripts/maj.sh new file mode 100755 index 00000000..ee9e51e5 --- /dev/null +++ b/scripts/maj.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# +# Ce script a pour objectif de mettre à jour un spip en protégeant les chemins +# variables. +# +# TODO: vérifier les vérsions, et ne faire la maj que si nécessaire + +set -e + +BASE_DIR="$(readlink -e "$(dirname "$0")/..")" +TMP_DIR="$(mktemp -d)" +NEW_SPIP_DIR="$TMP_DIR/spip" +CUR_SPIP_DIR="$BASE_DIR/www" +EXCLUDED= \ + +cmd() { + notice " * running cmd:" "$@" + "$@" || { notice " ! command failed ret=$?" ; exit 1 ; } +} + +notice() { + if [ "$LOGLVL" -gt 0 ] + then + echo "$@" + fi +} + +cleanup() { + [ ! -d "$TMP_DIR" ] || cmd rm -rf "$TMP_DIR" +} + +trap cleanup INT QUIT STOP TERM KILL EXIT + +# Traitement des arguments +SOURCE="" +LOGLVL=1 +while [ $# -gt 0 ] +do + case "$1" in + -s|--source) + shift + SOURCE="$1" + ;; + -v|--verbose) + LOGLVL=2 + ;; + -q|--quiet) + LOGLVL=0 + ;; + esac + shift +done + +if [ ! "$SOURCE" ] +then + # Par default on prend la branche 3.0 + SOURCE="http://files.spip.org/spip/stable/spip-3.0.zip" +fi + +cmd wget \ + $( [ "$LOGLVL" -gt 1 ] || echo -n '-q') \ + "$SOURCE" -O "$TMP_DIR/spip.zip" + +cmd unzip \ + $( [ "$LOGLVL" -gt 1 ] || echo -n '-q') \ + ${VERBOSE:+-q} "$TMP_DIR/spip.zip" -d "$TMP_DIR" + +[ -d "$CUR_SPIP_DIR" ] || cmd mkdir -p "$CUR_SPIP_DIR" + +cmd rsync -a --delete \ + --exclude /IMG/ \ + --exclude /config/chmod.php \ + --exclude /config/connect.php \ + --exclude /config/mes_options.php \ + --exclude /lib/ \ + --exclude /local/ \ + --exclude /plugins/ \ + --exclude /themes/ \ + --exclude /tmp/ \ + "$NEW_SPIP_DIR/" \ + "$CUR_SPIP_DIR/" + +chmod 777 "$CUR_SPIP_DIR/IMG" +chmod 777 "$CUR_SPIP_DIR/config" +chmod 777 "$CUR_SPIP_DIR/local" +chmod 777 "$CUR_SPIP_DIR/tmp"