LSattr_html_select_list : Added translation of possiblies values labels. Updated...
[ldapsaisie.git] / upgradeFromGit.sh
index d439ba7..7213b8a 100755 (executable)
@@ -17,6 +17,16 @@ function msg() {
     echo $2 "$1" | tee -a "$LOG_FILE"
 }
 
+function check_file_or_symlink() {
+    [ -f "$1" ] && echo 0 && return 0
+    if [ -L "$1" ]
+    then
+        [ -r "$1" ] && echo 0 && return 0
+        rm -f "$1"
+    fi
+    echo 1 && return 1
+}
+
 cd $ROOT_DIR
 
 msg "-> Clean git repos : "
@@ -156,22 +166,79 @@ 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 [ `check_file_or_symlink "$ROOT_DIR/public_html/templates/$THEME/$f"` -eq 0 ]
+                       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 [ `check_file_or_symlink "$ROOT_DIR/public_html/images/$THEME/$f"` -eq 0 ]
+                       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 [ `check_file_or_symlink "$ROOT_DIR/public_html/css/$THEME/$f"` -eq 0 ]
+                       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 ]
 then
-       msg "-> Do you want export the documentation (y/N) ? " -en
+       msg "-> Do you want build the documentation (y/N) ? " -en
        read a
        if [ "$a" == "y" -o "$a" == "Y" ]
        then
-        msg "-> Export the doc : " -en
+        msg "-> Build the doc : " -en
                cd $ROOT_DIR/doc >> $LOG_FILE 2>&1 && make >> $LOG_FILE 2>&1 && cd - >> $LOG_FILE 2>&1
                if [ $? -gt 0 ]
                then