4 ROOT_DIR=$( cd `dirname $0`; pwd )
5 LOCAL_SAV_DIR="$ROOT_DIR/config.local"
8 if [ ! -f $LOCAL_SAV_DIR/local.sh ]
10 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."
14 source $LOCAL_SAV_DIR/local.sh
17 echo $2 "$1" | tee -a "$LOG_FILE"
20 function check_file_or_symlink() {
21 [ -f "$1" ] && echo 0 && return 0
24 [ -r "$1" ] && echo 0 && return 0
32 msg "-> Clean git repos : "
38 msg "\n\t\t-> Delete file : " -en
39 rm -fr $i >> $LOG_FILE 2>&1
49 msg "\t\t-> Restore orignal file : " -en
50 mv $i.sav $i >> $LOG_FILE 2>&1
60 msg "file does not exist, pass..."
64 if [ $BUILD_DOC -eq 1 ]
66 msg "-> Clean the doc : " -en
67 cd $ROOT_DIR/doc >> $LOG_FILE && make clean >> $LOG_FILE && cd - >> $LOG_FILE
79 msg "\t\t-> Remove theme : " -en
80 rm -f $ROOT_DIR/public_html/templates/$THEME $ROOT_DIR/public_html/images/$THEME $ROOT_DIR/public_html/css/$THEME >> $LOG_FILE 2>&1
90 msg "-> Verification of git repos state : "
91 git status >> $LOG_FILE 2>&1
94 msg "\n\t-> [Error] Some changes have been made to source code since the last update." -e
99 msg "-> Upgrade git repos : "
105 msg "\t-> [Error] Problem during git repos pull." -e
110 msg "-> Install local files : "
111 for i in $LOCAL_FILES
114 SRC="$LOCAL_SAV_DIR/`basename $i`"
118 if [ -f $ROOT_DIR/$i ]
120 msg "\t\t-> Backup original file : " -en
121 mv $ROOT_DIR/$i $ROOT_DIR/$i.sav >> $LOG_FILE 2>&1
129 msg "\t\t-> Check possible change of the original file since last upgrade : " -en
132 DIFF=`diff $ROOT_DIR/$i.sav $SRC.orig`
135 msg "\n$DIFF\n\t\t\t-> Caution : This file changed. Do you want edit this file now ? [y/N] " -en
137 echo "Reponse : $a" >> $LOG_FILE
138 if [ "$a" == "y" -o "$a" == "Y" ]
140 vi -d $SRC $ROOT_DIR/$i.sav
146 msg "Original backup file does not exist. Pass ..."
148 msg "\t\t-> Backup file for next upgrade : " -en
149 cp -f $ROOT_DIR/$i.sav $SRC.orig >> $LOG_FILE 2>&1
157 msg "\t\t-> Install local file : " -en
158 ln -s $SRC $ROOT_DIR/$i >> $LOG_FILE 2>&1
166 msg "file does not exist. Pass..."
170 if [ "$THEME" != "" ]
172 msg "-> Install theme : "
175 msg "\t- Template : " -e
176 ln -s $LOCAL_SAV_DIR/theme/templates $ROOT_DIR/public_html/templates/$THEME >> $LOG_FILE 2>&1
177 if [ -d $ROOT_DIR/public_html/templates/$THEME_TPL_REF ]
179 msg "\t\t-> Vérification de la présence des fichiers : " -e
180 for i in $ROOT_DIR/public_html/templates/$THEME_TPL_REF/*
183 msg "\t\t\t- $f : " -en
184 if [ `check_file_or_symlink "$ROOT_DIR/public_html/templates/$THEME/$f"` -eq 0 ]
188 ln -s $ROOT_DIR/public_html/templates/$THEME_TPL_REF/$f $ROOT_DIR/public_html/templates/$THEME/$f
195 msg "\t- Images : " -e
196 ln -s $LOCAL_SAV_DIR/theme/images $ROOT_DIR/public_html/images/$THEME >> $LOG_FILE 2>&1
197 if [ -d $ROOT_DIR/public_html/images/$THEME_IMG_REF ]
199 msg "\t\t-> Vérification de la présence des fichiers : " -e
200 for i in $ROOT_DIR/public_html/images/$THEME_IMG_REF/*
203 msg "\t\t\t- $f : " -en
204 if [ `check_file_or_symlink "$ROOT_DIR/public_html/images/$THEME/$f"` -eq 0 ]
208 ln -s $ROOT_DIR/public_html/images/$THEME_IMG_REF/$f $ROOT_DIR/public_html/images/$THEME/$f
216 ln -s $LOCAL_SAV_DIR/theme/css $ROOT_DIR/public_html/css/$THEME >> $LOG_FILE 2>&1
217 if [ -d $ROOT_DIR/public_html/css/$THEME_CSS_REF ]
219 msg "\t\t-> Vérification de la présence des fichiers : " -e
220 for i in $ROOT_DIR/public_html/css/$THEME_CSS_REF/*
223 msg "\t\t\t- $f : " -en
224 if [ `check_file_or_symlink "$ROOT_DIR/public_html/css/$THEME/$f"` -eq 0 ]
228 ln -s $ROOT_DIR/public_html/css/$THEME_CSS_REF/$f $ROOT_DIR/public_html/css/$THEME/$f
235 if [ $BUILD_DOC -eq 1 ]
237 msg "-> Do you want build the documentation (y/N) ? " -en
239 if [ "$a" == "y" -o "$a" == "Y" ]
241 msg "-> Build the doc : " -en
242 cd $ROOT_DIR/doc >> $LOG_FILE 2>&1 && make >> $LOG_FILE 2>&1 && cd - >> $LOG_FILE 2>&1
251 if [ -n "$EXPORT_DOC_DIR" ]
253 $ROOT_DIR/buildDocExports.sh