#! /bin/sh
REP_SOURCE="/mnt/live/mnt/" # Dossier à explorer
# On cherche le dossier salixlive pour obtenir l’emplacement de la clé (sda, sdb, sdc ?)
# Normalement il n’y a qu’un dossier /mnt/live/mnt/sdx1
# alors qu’il peut y en avoir plusieurs dans /mnt/
find ${REP_SOURCE} -type d -name salixlive | while read A ; do
FFPATH=${A%\\/*}/Apps/FramafoxPortable/Data/profile
FBPATH=${A%\\/*}/Apps/FramabirdPortable/Data/profile
DDPATH=${A%\\/*}/Data/Documents
DIPATH=${A%\\/*}/Data/Images
DMPATH=${A%\\/*}/Data/Music
DTPATH=${A%\\/*}/Data/Telechargements
DVPATH=${A%\\/*}/Data/Videos
# Mise à jour des liens symboliques
# (on supprime l’ancien et on recrée le nouveau)
# Profiles Firefox et Thunderbird
if [ -d $FFPATH ] ; then {
    rm ${HOME}/.mozilla/firefox/Profile
    ln -s -f -d ${FFPATH} ${HOME}/.mozilla/firefox/Profile
} fi
if [ -d $FBPATH ] ; then {
    rm ${HOME}/.thunderbird/Profile
    ln -s -f -d ${FBPATH} ${HOME}/.thunderbird/Profile
} fi
# Syncronisation des dossiers (/home/one de la session locale et Data sur la clé)
#  et ajout aux raccourcis (.gtk-bookmarks)
if [ -d $DDPATH ] ; then {
    rm ${HOME}/Documents
    ln -s -f -d ${DDPATH} ${HOME}/Documents
    grep file://${HOME}/Documents ${HOME}/.gtk-bookmarks
    if [ $? = 1 ] ; then {
    echo file://${HOME}/Documents &gt;&gt; ${HOME}/.gtk-bookmarks
    } fi
} fi
if [ -d $DIPATH ] ; then {
    rm ${HOME}/Images
    ln -s -f -d ${DIPATH} ${HOME}/Images
    grep file://${HOME}/Images ${HOME}/.gtk-bookmarks
    if [ $? = 1 ] ; then {
        echo file://${HOME}/Images &gt;&gt; ${HOME}/.gtk-bookmarks
    } fi
} fi
if [ -d $DMPATH ] ; then {
    rm ${HOME}/Musique
    ln -s -f -d ${DMPATH} ${HOME}/Musique
    grep file://${HOME}/Musique ${HOME}/.gtk-bookmarks
    if [ $? = 1 ] ; then {
        echo file://${HOME}/Musique &gt;&gt; ${HOME}/.gtk-bookmarks
    } fi
} fi
if [ -d $DTPATH ] ; then {
    rm ${HOME}/Téléchargements
    ln -s -f -d ${DTPATH} ${HOME}/Téléchargements
    grep file://${HOME}/T%C3%A9l%C3%A9chargements ${HOME}/.gtk-bookmarks
    if [ $? = 1 ] ; then {
        echo file://${HOME}/T%C3%A9l%C3%A9chargements &gt;&gt; ${HOME}/.gtk-bookmarks
    } fi
} fi
if [ -d $DVPATH ] ; then {
    rm ${HOME}/Vidéos
    ln -s -f -d ${DVPATH} ${HOME}/Vidéos
    grep file://${HOME}/Vid%C3%A9os ${HOME}/.gtk-bookmarks
    if [ $? = 1 ] ; then {
        echo file://${HOME}/Vid%C3%A9os &gt;&gt; ${HOME}/.gtk-bookmarks
    } fi
} fi
done
