upgradeFromGit : fix bug and improve some thing

This commit is contained in:
Benjamin Renard 2009-11-13 17:21:30 +01:00
parent 2325989b62
commit 1dc188444d
3 changed files with 6 additions and 8 deletions

View file

@ -1,6 +1,5 @@
*.php *.php
*.php~
*.tpl *.tpl
*.tpl~
*.orig *.orig
*.sh *.sh
*~

View file

@ -4,7 +4,6 @@
LOCAL_FILES=" LOCAL_FILES="
" "
LOCAL_SAV_DIR="$ROOT_DIR/config.local"
LOG_FILE="$ROOT_DIR/upgrade.log" LOG_FILE="$ROOT_DIR/upgrade.log"
# The theme name to install (optional) # The theme name to install (optional)

View file

@ -2,15 +2,16 @@
ROOT_DIR=$( cd `dirname $0`; pwd ) ROOT_DIR=$( cd `dirname $0`; pwd )
LOCAL_SAV_DIR="$ROOT_DIR/config.local"
# Import config # Import config
if [ ! -f $ROOT_DIR/config.local/local.sh ] if [ ! -f $LOCAL_SAV_DIR/local.sh ]
then 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." 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 exit 1
fi fi
source $ROOT_DIR/config.local/local.sh source $LOCAL_SAV_DIR/local.sh
function msg() { function msg() {
echo $2 "$1" | tee -a "$LOG_FILE" echo $2 "$1" | tee -a "$LOG_FILE"
@ -119,10 +120,9 @@ do
if [ -f $SRC.orig ] if [ -f $SRC.orig ]
then then
DIFF=`diff $ROOT_DIR/$i.sav $SRC.orig` DIFF=`diff $ROOT_DIR/$i.sav $SRC.orig`
msg "$DIFF" -e
if [ "$DIFF" != "" ] if [ "$DIFF" != "" ]
then 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 read a
echo "Reponse : $a" >> $LOG_FILE echo "Reponse : $a" >> $LOG_FILE
if [ "$a" == "y" -o "$a" == "Y" ] if [ "$a" == "y" -o "$a" == "Y" ]
@ -133,7 +133,7 @@ do
msg "No change" msg "No change"
fi fi
else else
echo msg "Original backup file does not exist. Pass ..."
fi fi
msg "\t\t-> Backup file for next upgrade : " -en msg "\t\t-> Backup file for next upgrade : " -en
cp -f $ROOT_DIR/$i.sav $SRC.orig >> $LOG_FILE 2>&1 cp -f $ROOT_DIR/$i.sav $SRC.orig >> $LOG_FILE 2>&1