From 1dc188444db5138929d86d5e57a6a6d8aecb3339 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 13 Nov 2009 17:21:30 +0100 Subject: [PATCH] upgradeFromGit : fix bug and improve some thing --- config.local/.gitignore | 3 +-- config.local/local.sh.example | 1 - upgradeFromGit.sh | 10 +++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config.local/.gitignore b/config.local/.gitignore index 4021b540..2f634303 100644 --- a/config.local/.gitignore +++ b/config.local/.gitignore @@ -1,6 +1,5 @@ *.php -*.php~ *.tpl -*.tpl~ *.orig *.sh +*~ diff --git a/config.local/local.sh.example b/config.local/local.sh.example index 4ea8ad4a..73436aa6 100644 --- a/config.local/local.sh.example +++ b/config.local/local.sh.example @@ -4,7 +4,6 @@ LOCAL_FILES=" " -LOCAL_SAV_DIR="$ROOT_DIR/config.local" LOG_FILE="$ROOT_DIR/upgrade.log" # The theme name to install (optional) diff --git a/upgradeFromGit.sh b/upgradeFromGit.sh index 0fd41e24..f9b62a01 100755 --- a/upgradeFromGit.sh +++ b/upgradeFromGit.sh @@ -2,15 +2,16 @@ ROOT_DIR=$( cd `dirname $0`; pwd ) +LOCAL_SAV_DIR="$ROOT_DIR/config.local" # Import config -if [ ! -f $ROOT_DIR/config.local/local.sh ] +if [ ! -f $LOCAL_SAV_DIR/local.sh ] then echo "Error : You don't have create your own local.sh file in config.local directory. You could rely on the local.sh.example file to create your version." exit 1 fi -source $ROOT_DIR/config.local/local.sh +source $LOCAL_SAV_DIR/local.sh function msg() { echo $2 "$1" | tee -a "$LOG_FILE" @@ -119,10 +120,9 @@ do if [ -f $SRC.orig ] then DIFF=`diff $ROOT_DIR/$i.sav $SRC.orig` - msg "$DIFF" -e if [ "$DIFF" != "" ] then - msg "\n\t\t\t-> Caution : This file changed. Do you want edit this file now ? [y/N] " -en + msg "\n$DIFF\n\t\t\t-> Caution : This file changed. Do you want edit this file now ? [y/N] " -en read a echo "Reponse : $a" >> $LOG_FILE if [ "$a" == "y" -o "$a" == "Y" ] @@ -133,7 +133,7 @@ do msg "No change" fi else - echo + msg "Original backup file does not exist. Pass ..." fi msg "\t\t-> Backup file for next upgrade : " -en cp -f $ROOT_DIR/$i.sav $SRC.orig >> $LOG_FILE 2>&1