Ajout d'un script pour la sauvegarde des profiles Thunderbird et Firefox
This commit is contained in:
parent
82084ac2ac
commit
d53d1d258a
|
@ -7,6 +7,7 @@ my $wg = $smb{'Workgroup'};
|
|||
my $name = $SystemName;
|
||||
my $url = "https://auth." . $DomainName;
|
||||
my $comp = $ldap{'defaultCompany'};
|
||||
my $mozbackup = (($wpkg{'MozillaBackup'} || 'no') =~ m/^yes|enabled|on|1$/) ? 'yes':'no';
|
||||
|
||||
$OUT .=<<"EOF";
|
||||
|
||||
|
@ -19,6 +20,7 @@ SET COMPANY=$comp
|
|||
SET SOFTWARE=\\\\%IPASSERELLE_IP%\\wpkg\\softwares
|
||||
SET SETTINGS=\\\\%IPASSERELLE_IP%\\wpkg\\settings
|
||||
SET WPKGLOGS=\\\\%IPASSERELLE_IP%\\wpkglogs
|
||||
SET MOZBACKUP=$mozbackup
|
||||
|
||||
EOF
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
@echo off
|
||||
|
||||
REM Ce script permet de sauvegarder les profiles
|
||||
REM de Thunderbird et Firefox
|
||||
REM Il conserve les 10 dernières version de chaque
|
||||
|
||||
REM Si la fonction n'est pas activée, on s'arrête là
|
||||
IF "%MOZBACKUP%" NEQ "yes" exit
|
||||
|
||||
REM L'archivage des profile va utiliser 7-Zip
|
||||
REM On s'arrête si cet outil n'est pas disponible
|
||||
SET ZIP="%PROGRAMFILES%\7-Zip\7z.exe"
|
||||
IF NOT EXIST %ZIP% exit
|
||||
|
||||
REM Les sauvegardes seront stockées dans un répertoire caché
|
||||
REM du dossier personnel. Un sous répertoire est créé pour chaque
|
||||
REM machine de l'utilisateur
|
||||
SET DEST="\\%IPASSERELLE_IP%\%USERNAME%\.backup\%COMPUTERNAME%"
|
||||
|
||||
IF NOT EXIST "%DEST%" mkdir "%DEST%"
|
||||
IF NOT EXIST "%DEST%" exit
|
||||
|
||||
REM Recherche du répertoire de profile de Thunderbird
|
||||
for /f %%a in ('dir /b "%APPDATA%\Thunderbird\Profiles\*.default"') do SET TBPROFILE=%APPDATA%\Thunderbird\Profiles\%%a
|
||||
|
||||
REM Si le répertoire de profile n'existe pas, on s'arrête
|
||||
IF NOT EXIST "%TBPROFILE%" exit
|
||||
|
||||
REM Rotation des anciennes sauvegardes
|
||||
REM Pas très élégant, mais on fait ce qu'on peut
|
||||
REM souvenez-vous qu'on est qu'en batch ;-)
|
||||
IF EXIST "%DEST%\thunderbird10.7z" DEL /Q /F "%DEST%\thunderbird10.7z"
|
||||
IF EXIST "%DEST%\thunderbird9.7z" REN "%DEST%\thunderbird9.7z" thunderbird10.7z
|
||||
IF EXIST "%DEST%\thunderbird8.7z" REN "%DEST%\thunderbird8.7z" thunderbird9.7z
|
||||
IF EXIST "%DEST%\thunderbird7.7z" REN "%DEST%\thunderbird7.7z" thunderbird8.7z
|
||||
IF EXIST "%DEST%\thunderbird6.7z" REN "%DEST%\thunderbird6.7z" thunderbird7.7z
|
||||
IF EXIST "%DEST%\thunderbird5.7z" REN "%DEST%\thunderbird5.7z" thunderbird6.7z
|
||||
IF EXIST "%DEST%\thunderbird4.7z" REN "%DEST%\thunderbird4.7z" thunderbird5.7z
|
||||
IF EXIST "%DEST%\thunderbird3.7z" REN "%DEST%\thunderbird3.7z" thunderbird4.7z
|
||||
IF EXIST "%DEST%\thunderbird2.7z" REN "%DEST%\thunderbird2.7z" thunderbird3.7z
|
||||
IF EXIST "%DEST%\thunderbird1.7z" REN "%DEST%\thunderbird1.7z" thunderbird2.7z
|
||||
|
||||
REM On compresse tout le profile, sauf le répertoire ImapMail (qui peut être énorme)
|
||||
REM le fichier global-message-db.sqlite (peut faire plusieurs Go) et quelques autres fichiers non essentiels
|
||||
REM On utilise le plus faible taux de compression pour éviter de prendre trop de temps
|
||||
REM vu que ce script sera lancé à l'ouverture de session
|
||||
%ZIP% a -t7z -mx1 "%DEST%\thunderbird1.7z" "%TBPROFILE%\*" -xr!"ImapMail\" -x!global-messages-db.sqlite -x!Cache -x!SOGoImageCache -x!startupCache -x!places.sqlite -x!urlclassifier3.sqlite -x!cookies.sqlite
|
||||
REM Maintenant, on rajoute à l'archive les fichiers .dat contenus dans le répertoire ImapMail
|
||||
REM Ces fichiers contiennent en particulier les filtres des messages
|
||||
REM pas trouvé comment faire ça en une seule passe
|
||||
%ZIP% a -t7z -mx1 -r "%DEST%\thunderbird1.7z" "%TBPROFILE%\*.dat"
|
||||
|
||||
REM Même chose pour Firefox maintenant
|
||||
for /f %%a in ('dir /b "%APPDATA%\Mozilla\Firefox\Profiles\*.default"') do SET FFPROFILE=%APPDATA%\Mozilla\Firefox\Profiles\%%a
|
||||
IF NOT EXIST "%FFPROFILE%" exit
|
||||
|
||||
IF EXIST "%DEST%\firefox10.7z" DEL /Q /F "%DEST%\firefox10.7z"
|
||||
IF EXIST "%DEST%\firefox9.7z" REN "%DEST%\firefox9.7z" firefox10.7z
|
||||
IF EXIST "%DEST%\firefox8.7z" REN "%DEST%\firefox8.7z" firefox9.7z
|
||||
IF EXIST "%DEST%\firefox7.7z" REN "%DEST%\firefox7.7z" firefox8.7z
|
||||
IF EXIST "%DEST%\firefox6.7z" REN "%DEST%\firefox6.7z" firefox7.7z
|
||||
IF EXIST "%DEST%\firefox5.7z" REN "%DEST%\firefox5.7z" firefox6.7z
|
||||
IF EXIST "%DEST%\firefox4.7z" REN "%DEST%\firefox4.7z" firefox5.7z
|
||||
IF EXIST "%DEST%\firefox3.7z" REN "%DEST%\firefox3.7z" firefox4.7z
|
||||
IF EXIST "%DEST%\firefox2.7z" REN "%DEST%\firefox2.7z" firefox3.7z
|
||||
IF EXIST "%DEST%\firefox1.7z" REN "%DEST%\firefox1.7z" firefox2.7z
|
||||
|
||||
%ZIP% a -t7z -mx1 "%DEST%\firefox1.7z" "%FFPROFILE%\*" -x!Cache -x!OfflineCache -x!mozilla-media-cache
|
Loading…
Reference in New Issue