From 18de43b52f19943c84efa3239e4d0140aa896e52 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 15 Dec 2009 18:33:22 +0100 Subject: [PATCH] upgradeFromGit/theme : added support to linking original theme files to avoid copying of files. --- config.local/local.sh.example | 5 +++ upgradeFromGit.sh | 61 +++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/config.local/local.sh.example b/config.local/local.sh.example index a08c5a6c..8ebd4801 100644 --- a/config.local/local.sh.example +++ b/config.local/local.sh.example @@ -9,6 +9,11 @@ LOG_FILE="$ROOT_DIR/upgrade.log" # The theme name to install (optional) #THEME="mytheme" +# The theme name in reference for template/CSS/image files +THEME_TPL_REF="default" +THEME_CSS_REF="default" +THEME_IMG_REF="default" + # Do doc export ? BUILD_DOC=1 diff --git a/upgradeFromGit.sh b/upgradeFromGit.sh index a3e0d6b8..93557571 100755 --- a/upgradeFromGit.sh +++ b/upgradeFromGit.sh @@ -156,13 +156,70 @@ do msg "file does not exist. Pass..." fi done + if [ "$THEME" != "" ] then - msg "-> Install theme : " -en + msg "-> Install theme : " + + # TPL + msg "\t- Template : " -e ln -s $LOCAL_SAV_DIR/theme/templates $ROOT_DIR/public_html/templates/$THEME >> $LOG_FILE 2>&1 + if [ -d $ROOT_DIR/public_html/templates/$THEME_TPL_REF ] + then + msg "\t\t-> Vérification de la présence des fichiers : " -e + for i in $ROOT_DIR/public_html/templates/$THEME_TPL_REF/* + do + f=`basename $i` + msg "\t\t\t- $f : " -en + if [ -f $ROOT_DIR/public_html/templates/$THEME/$f ] + then + msg "present." + else + ln -s $ROOT_DIR/public_html/templates/$THEME_TPL_REF/$f $ROOT_DIR/public_html/templates/$THEME/$f + msg "link." + fi + done + fi + + # IMG + msg "\t- Images : " -e ln -s $LOCAL_SAV_DIR/theme/images $ROOT_DIR/public_html/images/$THEME >> $LOG_FILE 2>&1 + if [ -d $ROOT_DIR/public_html/images/$THEME_IMG_REF ] + then + msg "\t\t-> Vérification de la présence des fichiers : " -e + for i in $ROOT_DIR/public_html/images/$THEME_IMG_REF/* + do + f=`basename $i` + msg "\t\t\t- $f : " -en + if [ -f $ROOT_DIR/public_html/images/$THEME/$f ] + then + msg "present." + else + ln -s $ROOT_DIR/public_html/images/$THEME_IMG_REF/$f $ROOT_DIR/public_html/images/$THEME/$f + msg "link." + fi + done + fi + + # CSS + msg "\t- CSS : " -e ln -s $LOCAL_SAV_DIR/theme/css $ROOT_DIR/public_html/css/$THEME >> $LOG_FILE 2>&1 - msg "Ok" + if [ -d $ROOT_DIR/public_html/css/$THEME_CSS_REF ] + then + msg "\t\t-> Vérification de la présence des fichiers : " -e + for i in $ROOT_DIR/public_html/css/$THEME_CSS_REF/* + do + f=`basename $i` + msg "\t\t\t- $f : " -en + if [ -f $ROOT_DIR/public_html/css/$THEME/$f ] + then + msg "present." + else + ln -s $ROOT_DIR/public_html/css/$THEME_CSS_REF/$f $ROOT_DIR/public_html/css/$THEME/$f + msg "link." + fi + done + fi fi if [ $BUILD_DOC -eq 1 ]