Merge branch 'dev' into stable

This commit is contained in:
Djan GICQUEL 2022-04-08 21:25:32 +02:00
commit fc9a65f8c8
17 changed files with 763 additions and 0 deletions

View File

@ -1,15 +1,35 @@
#! /bin/bash
<<<<<<< HEAD
=======
# tests de base
>>>>>>> dev
which zenity
if [ "$?" != "0" ]; then
echo "Zenity n'est pas installé.";exit
exit
fi
<<<<<<< HEAD
=======
which borg
if [ "$?" != "0" ]; then
echo "borgbackup n'est pas installé.";exit
exit
fi
>>>>>>> dev
# META VARIABLES
#################################################################################
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
<<<<<<< HEAD
=======
dossierprofil="$HOME/.config/borg/profils-borg-zenity/"
W="--width=600"
H="--height=500"
iconborg="--window-icon=$HOME/.icons/borg.svg"
>>>>>>> dev
# FONCTIONS
#################################################################################
@ -17,21 +37,33 @@ TestBorgRepo () {
if [ ! -f "config" ]; then
TestBorgErr=1
infoerr=$(echo "Impossible de trouver le fichier de configuration borg.")
<<<<<<< HEAD
zenity --width=500 --error --text="$infoerr"
=======
zenity $W --error --text="$infoerr"
>>>>>>> dev
exit
fi
if [ ! -d "data" ]; then
TestBorgErr=1
infoerr=$(echo "Impossible de trouver le fichier de configuration borg.")
<<<<<<< HEAD
zenity --width=500 --error --text="$infoerr"
=======
zenity $W --error --text="$infoerr"
>>>>>>> dev
exit
fi
if [ -d "lock.exclusive" ]; then
TestBorgErr=1
infoerr=$(echo "Le dépôt est bloqué, une opération est peut-être en cours")
<<<<<<< HEAD
zenity --width=500 --error --text="$infoerr"
=======
zenity $W --error --text="$infoerr"
>>>>>>> dev
exit
fi
}
@ -43,6 +75,7 @@ bobainfoa () {
DossierPresent () {
if [ ! -d "$1" ]; then
<<<<<<< HEAD
inforerror=$(echo "Erreur, le dossier $1 est absent.\nFin du script.")
zenity --width=500 --error --text="$inforerror"
exit
@ -63,12 +96,37 @@ SauvegardeBorg () {
# Profils et tests
#################################################################################
=======
inforerror=$(echo "Erreur, le dossier $1 est absent.")
zenity $W --error --text="$inforerror"
VarDossierPresent="false"
fi
}
ZenityPulsate () {
zenity $W $iconborg --progress --pulsate --auto-close
}
BorgFilter () {
if [ "$filter" = "" ];then
Borg_Archive=$(borg list --short $borg_repo | zenity $H $iconborg --list --title "Listes des archives" --column "Archive")
else
Borg_Archive=$(borg list --short $borg_repo| grep $filter | zenity $H $iconborg --list --title "Listes des archives" --column "Archive")
fi
}
#################################################################################
# Profils et tests
#################################################################################
>>>>>>> dev
# si $1 n'est pas vide fichier de profil = $1
# sinon afficher les profils disponibles
if [ ! $1 = "" ]; then
fichierprofil="$1"
. "$1"
else
<<<<<<< HEAD
fichierprofil=$(ls -1 $HOME/.config/borg/*.txt | zenity --height=500 --width=600 --list --title "Profils" --column "profil") && . $fichierprofil
fi
@ -79,12 +137,35 @@ if [ "$nomsauvegarde" = "" ]; then
elif [ "$borg_repo" = "" ]; then
infoerr=$(echo "Variable \$borg_repo absente")
zenity --width=200 --error --text="$infoerr"
=======
cd $dossierprofil
fichierprofil=$(ls -1 *.conf | cut -d. -f1 | \
zenity $W $H $iconborg --list \
--title "Liste des profils" \
--text "Choisir un profil dans la liste" \
--column "Fichier de profil"\
) && . "$dossierprofil"/"$fichierprofil".conf
fi
if [ "$fichierprofil" = "" ]; then
infoerr=$(echo "Aucun profil choisi.")
zenity $W --error --text="$infoerr"
exit
elif [ "$nomsauvegarde" = "" ]; then
infoerr=$(echo "Nom de sauvegarde non défini.")
zenity $W --error --text="$infoerr"
exit
elif [ "$borg_repo" = "" ]; then
infoerr=$(echo "Variable \$borg_repo absente")
zenity $W --error --text="$infoerr"
>>>>>>> dev
exit
fi
cd $borg_repo
TestBorgRepo
<<<<<<< HEAD
#################################################################################
# MENU PRINCIPAL
#################################################################################
@ -142,4 +223,186 @@ elif [ "$choixmenu" = "afficher_variables_profil" ];then
elif [ "$choixmenu" = "" ];then
zenity --width=500 --info --text="Aucun choix, retour au menu."
fi
=======
#################################################################################
# Fichier de configuration globale
#################################################################################
if [ -f $HOME/.config/borg/borg-zenity.conf ];then
. $HOME/.config/borg/borg-zenity.conf
fi
#################################################################################
# MENU PRINCIPAL Gestion des options du menu
#################################################################################
while [ ! "$quitter" = "yes" ];do
# si aucune archive n'est montée, cacher l'entrée de menu «Démonter une archive»
if [ "$(mount | grep borgfs)" != "" ];then
MenuDemonter="dm\nDemonter une archive\ndmt\nDémonter toutes les archives\n"
else
MenuDemonter=""
fi
# afficher l'espace disque sous condition, la variable vient du fichier borg-zenity.conf
EspaceDisqueUtil=$(df -k --output=pcent $borg_repo | tail -n +2 | cut -d% -f1)
if [ $EspaceDisqueUtil -gt $seuil_alerte_espace_disque ];then
MenuEspaceDisque="ed\n/!\ Espace disque utilisé : $EspaceDisqueUtil %\n"
else
MenuEspaceDisque=""
fi
#################################################################################
# Affichage du menu
#################################################################################
if [ $menu_avance = "true" ];then
choixmenu=$(echo -e "\
cs\nCréer l'archive : $(echo $borg_archive)\n\
ms\nMonter une archive\n\
$(echo $MenuDemonter)\
ss\nSupprimmer une archive\n\
sss\nSupprimmer des archives\n\
is\nInformation archive\n\
fi\nFiltre : "$filter"\n\
--\n------------------------------------------\n\
id\nInformation sur le dépôt\n\
ap\nAfficher le profil\n\
--\n------------------------------------------\n\
$(echo $MenuEspaceDisque)\
qu\nQUITTER\
" | zenity $iconborg --list $H $W --title "BORG GUI : $nomsauvegarde" \
--hide-header --hide-column=1 --column "id" --column "choix")
else
choixmenu=$(echo -e "\
cs\nCréer l'archive : $(echo $borg_archive)\n\
ms\nMonter une archive\n\
$(echo $MenuDemonter)\
ss\nSupprimmer une archive\n\
is\nInformation archive\n\
$(echo $MenuEspaceDisque)\
qu\nQUITTER\
" | zenity $iconborg --list $H $W --title "BORG GUI : $nomsauvegarde" \
--hide-header --hide-column=1 --column "id" --column "choix")
fi
#################################################################################
# Gestion des choix du menu
#################################################################################
if [ "$choixmenu" = "" ];then
echo ""
elif [ "$choixmenu" = "cs" ];then
# Créer une archive
TestBorgRepo
DossierPresent $borg_repo
DossierPresent $borg_dir
borg list --short $borg_repo | grep $borg_archive
if [ "$?" = "0" ];then
zenity --warning $W $iconborg --text "L'archive existe déjà."
else
if [ "$VarDossierPresent" != "false" ];then
borg create $borg_excludes $borg_compress $borg_repo::$borg_archive $borg_dir | ZenityPulsate
sync | ZenityPulsate
zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
zenity $W --info --text "Sauvegarde $nomsauvegarde terminée"
fi
fi
elif [ "$choixmenu" = "ms" ];then
# Monter une archive
BorgFilter
if [ ! "$Borg_Archive" = "" ];then
mkdir $HOME/$Borg_Archive
borg mount $borg_repo::$Borg_Archive $HOME/$Borg_Archive | ZenityPulsate
zenity $W --info --text="La sauvegarde est disponible dans le dossier\n<tt>$HOME/$Borg_Archive</tt>"
fi
elif [ "$choixmenu" = "dm" ];then
# Demonter une archive
ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity $W $H $iconborg --list --title "Liste des points de montages" --column "Archive")
if [ ! "$ptnmontage" = "" ];then
fusermount -u $ptnmontage | ZenityPulsate
sleep 2 | ZenityPulsate
rmdir $ptnmontage | ZenityPulsate
fi
elif [ "$choixmenu" = "dmt" ];then
# Demonter toutes les archives
while [ $(mount | grep borgfs | cut -d" " -f3 | head -n 1) ];do
ptnmontage="$(mount | grep borgfs | cut -d" " -f3 | head -n 1)"
notify-send -i $HOME/.icons/borg.svg "borg-zenity" "Démontage de $ptnmontage"
fusermount -uz $ptnmontage && sleep 2 && rmdir $ptnmontage
done
elif [ "$choixmenu" = "ss" ];then
# Supprimmer une archive
BorgFilter
if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
else
borg delete $borg_repo::$Borg_Archive | ZenityPulsate
zenity $W --info --text="Suppresion de l'archive $Borg_Archive terminée"
fi
elif [ "$choixmenu" = "sss" ];then
# Supprimmer des archives
if [ "$filter" = "" ];then
Borg_Archive=$(borg list --short $borg_repo | sed s/^/\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "Sel" --column "Archive")
else
Borg_Archive=$(borg list --short $borg_repo | grep $filter | sed s/^/S\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "S" --column "Archive")
fi
if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
else
borg delete $borg_repo::$(echo "$Borg_Archive" | sed s/\|/\ /g) | ZenityPulsate
zenity $W --info --text="Suppression des archives terminée.\nArchives supprimmées : $(echo "$Borg_Archive" | sed s/\|/\ /g)"
fi
elif [ "$choixmenu" = "is" ];then
# Information archive
BorgFilter
if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
else
zenity $W --info --text="<tt>$(borg info $borg_repo::$Borg_Archive)</tt>" | ZenityPulsate
fi
elif [ "$choixmenu" = "fi" ];then
#Filtre
filter=$(zenity --entry)
elif [ "$choixmenu" = "id" ];then
# Information sur le dépôt
zenity $W --info --text="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat "$fichierprofil".conf)</tt>"
elif [ "$choixmenu" = "qu" ];then
if [ "$(mount | grep borgfs)" = "" ];then
quitter="yes"
else
zenity $W --warning --text="Une ou des archives sont montées.\nDémontez-le afin de laisser le dépôt dans un état cohérent."
fi
fi
>>>>>>> dev
done

2
borg-zenity.conf Normal file
View File

@ -0,0 +1,2 @@
menu_avance="false"
seuil_alerte_espace_disque="90"

BIN
captures/icone_profils.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Borg Zenity Profils
Exec=bin/profile-manager.sh
Icon=borgzenity-profils
Type=Application
Categories=Utility;

75
icons/borg.svg Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created using Karbon, part of Calligra: http://www.calligra.org/karbon -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200"
height="200"
version="1.1"
id="svg9"
sodipodi:docname="logo.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview11"
showgrid="false"
units="px"
inkscape:zoom="2.96"
inkscape:cx="100"
inkscape:cy="100"
inkscape:current-layer="svg9" />
<defs
id="defs2" />
<path
style="fill:#000200;stroke-width:0.96801603"
inkscape:connector-curvature="0"
id="p0"
d="M 0,99.971756 V 0 H 99.980815 199.96162 V 99.971756 199.94289 H 99.980815 0 Z" />
<path
style="fill:#00dd00;stroke-width:0.69510466"
inkscape:connector-curvature="0"
id="p1"
d="M 35.149415,80.421388 H 23.274734 v -9.593903 h 18.572293 l 9.630118,9.593903 v 9.774909 l -4.815059,4.815059 4.815059,4.81499 v 9.449114 l -9.630118,9.59391 H 23.274734 v -9.59391 H 35.149415 V 99.029895 H 23.274734 V 90.666953 H 35.149415 Z M 4.7385877,70.827485 H 20.740453 V 118.86937 H 4.7385877 Z" />
<path
style="fill:#00dd00;stroke-width:0.69510466"
inkscape:connector-curvature="0"
id="p2"
d="m 101.29293,109.27546 -9.593904,9.59391 h -10.71615 v -8.97846 h 3.982323 V 90.015291 h -3.982323 v -9.593903 h 10.71615 l 9.593904,9.593903 z m -27.007665,0.61545 h 4.163328 v 8.97846 H 67.696228 l -9.593903,-9.59391 V 90.015291 l 9.593903,-9.593903 h 10.752365 v 9.593903 h -4.163328 z" />
<path
style="fill:#00dd00;stroke-width:0.69510466"
inkscape:connector-curvature="0"
id="p3"
d="m 133.91183,90.015291 h -6.80627 v -4.1996 l 5.35815,-5.394303 h 9.70248 l 7.78371,8.978458 V 99.35576 H 133.91183 Z M 108.53327,118.86937 V 80.421388 h 16.00187 v 38.447982 z" />
<path
style="fill:#00dd00;stroke-width:0.69510466"
inkscape:connector-curvature="0"
id="p4"
d="m 180.17979,90.015291 h -7.09583 v -9.593903 h 13.5038 l 9.5939,9.593903 v 32.655399 l -9.5939,9.66633 h -21.10651 l -4.81507,-4.85127 v -3.54788 h 19.51361 z m -2.5342,19.875619 v 4.23583 l -4.77885,4.74263 h -8.72502 l -9.59391,-9.59391 V 90.015291 l 9.59391,-9.593903 h 6.40796 v 29.469522 z" />
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created using Karbon, part of Calligra: http://www.calligra.org/karbon -->
<svg
width="200"
height="200"
version="1.1"
id="svg9"
sodipodi:docname="borgzenity-profils.svg"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview11"
showgrid="false"
units="px"
inkscape:zoom="2.2238918"
inkscape:cx="95.55321"
inkscape:cy="119.83497"
inkscape:current-layer="text9172"
inkscape:pagecheckerboard="0" />
<defs
id="defs2" />
<path
style="fill:#000200;stroke-width:0.96801603"
inkscape:connector-curvature="0"
id="p0"
d="M 0,99.971756 V 0 H 99.980815 199.96162 V 99.971756 199.94289 H 99.980815 0 Z" />
<g
id="g9168"
transform="translate(2.1567573)">
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p1"
d="M 32.532533,18.902607 H 20.657852 V 9.3087043 h 18.572293 l 9.630118,9.5939027 v 9.774909 l -4.815059,4.815059 4.815059,4.81499 v 9.449114 l -9.630118,9.59391 H 20.657852 v -9.59391 H 32.532533 V 37.511114 H 20.657852 V 29.148172 H 32.532533 Z M 2.1217054,9.3087043 H 18.123571 V 57.350589 H 2.1217054 Z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p2"
d="m 98.676048,47.756679 -9.593904,9.59391 h -10.71615 v -8.97846 h 3.982323 V 28.49651 h -3.982323 v -9.593903 h 10.71615 l 9.593904,9.593903 z m -27.007665,0.61545 h 4.163328 v 8.97846 H 65.079346 l -9.593903,-9.59391 V 28.49651 l 9.593903,-9.593903 h 10.752365 v 9.593903 h -4.163328 z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p3"
d="m 131.29495,28.49651 h -6.80627 v -4.1996 l 5.35815,-5.394303 h 9.70248 l 7.78371,8.978458 v 9.955914 H 131.29495 Z M 105.91639,57.350589 V 18.902607 h 16.00187 v 38.447982 z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p4"
d="m 177.56291,28.49651 h -7.09583 v -9.593903 h 13.5038 l 9.5939,9.593903 v 32.655399 l -9.5939,9.66633 h -21.10651 l -4.81507,-4.85127 v -3.54788 h 19.51361 z m -2.5342,19.875619 v 4.23583 l -4.77885,4.74263 h -8.72502 l -9.59391,-9.59391 V 28.49651 l 9.59391,-9.593903 h 6.40796 v 29.469522 z" />
</g>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:126.228px;line-height:125%;font-family:forkawesome;-inkscape-font-specification:forkawesome;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:7.21301px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="246.16104"
y="179.13365"
id="text1157"><tspan
sodipodi:role="line"
id="tspan5559"
x="246.16104"
y="179.13365"
dx="0"
dy="0"
rotate="0 0"
style="fill:#ffffff;fill-opacity:1;stroke-width:7.21301px"></tspan></text>
<g
aria-label=""
id="text9172"
style="font-size:114.826px;line-height:125%;font-family:forkawesome;-inkscape-font-specification:forkawesome;letter-spacing:0px;word-spacing:0px;fill:#ffffff;stroke-width:6.56146px">
<path
d="m 144.85391,93.936257 q 1.79415,1.794157 3.07569,4.869853 1.28154,3.0757 1.28154,5.63878 v 73.81671 q 0,2.56308 -1.79415,4.35723 -1.79416,1.79416 -4.35724,1.79416 H 56.940253 q -2.56308,0 -4.357236,-1.79416 -1.794157,-1.79415 -1.794157,-4.35723 V 75.738387 q 0,-2.56308 1.794157,-4.357236 1.794156,-1.794156 4.357236,-1.794156 h 57.412997 q 2.56308,0 5.63878,1.28154 3.07569,1.28154 4.86985,3.075696 z M 116.40372,78.301468 v 24.092952 h 24.09295 q -0.64077,-1.85823 -1.40969,-2.627155 L 119.03087,79.711162 q -0.76892,-0.768924 -2.62715,-1.409694 z m 24.60557,97.909662 v -65.61485 h -26.65604 q -2.56308,0 -4.35724,-1.79416 -1.79415,-1.79415 -1.79415,-4.35723 V 77.788852 H 58.990717 V 176.21113 Z M 81.545824,118.79814 q 0.512616,-0.70485 1.345617,-0.76893 0.833001,-0.12815 1.537848,0.38446 l 3.267927,2.43493 q 0.704847,0.51262 0.768924,1.34562 0.128154,0.833 -0.384462,1.53785 l -11.662015,15.57071 11.662015,15.57071 q 0.512616,0.70485 0.384462,1.53785 -0.06408,0.833 -0.768924,1.34562 l -3.267927,2.43492 q -0.704847,0.51262 -1.537848,0.44854 -0.833001,-0.12815 -1.345617,-0.833 L 67.06442,140.52024 q -0.897078,-1.21746 0,-2.43492 z m 51.389756,19.28718 q 0.89708,1.21746 0,2.43492 l -14.4814,19.28718 q -0.51262,0.70485 -1.34562,0.833 -0.833,0.0641 -1.53785,-0.44854 l -3.26792,-2.43492 q -0.70485,-0.51262 -0.833,-1.34562 -0.0641,-0.833 0.44853,-1.53785 l 11.66202,-15.57071 -11.66202,-15.57071 q -0.51261,-0.70485 -0.44853,-1.53785 0.12815,-0.833 0.833,-1.34562 l 3.26792,-2.43493 q 0.70485,-0.51261 1.53785,-0.38446 0.833,0.0641 1.34562,0.76893 z m -39.727741,29.5395 q -0.833001,-0.12816 -1.345617,-0.83301 -0.448539,-0.70484 -0.320385,-1.53784 l 8.842623,-53.248 q 0.12816,-0.833 0.833,-1.28154 0.70485,-0.51261 1.53785,-0.38446 l 4.03685,0.64077 q 0.83301,0.12816 1.28154,0.833 0.51262,0.70485 0.38447,1.53785 l -8.84263,53.24799 q -0.128154,0.833 -0.833001,1.34562 -0.704848,0.44854 -1.537849,0.32039 z"
id="path220" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created using Karbon, part of Calligra: http://www.calligra.org/karbon -->
<svg
width="200"
height="200"
version="1.1"
id="svg9"
sodipodi:docname="borgzenity-sauvegarde.svg"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata13">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview11"
showgrid="false"
units="px"
inkscape:zoom="2.2238918"
inkscape:cx="173.11993"
inkscape:cy="120.28463"
inkscape:current-layer="text1157"
inkscape:pagecheckerboard="0" />
<defs
id="defs2" />
<path
style="fill:#000200;stroke-width:0.96801603"
inkscape:connector-curvature="0"
id="p0"
d="M 0,99.971756 V 0 H 99.980815 199.96162 V 99.971756 199.94289 H 99.980815 0 Z" />
<g
id="g9168"
transform="translate(2.1567573)">
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p1"
d="M 32.532533,18.902607 H 20.657852 V 9.3087043 h 18.572293 l 9.630118,9.5939027 v 9.774909 l -4.815059,4.815059 4.815059,4.81499 v 9.449114 l -9.630118,9.59391 H 20.657852 v -9.59391 H 32.532533 V 37.511114 H 20.657852 V 29.148172 H 32.532533 Z M 2.1217054,9.3087043 H 18.123571 V 57.350589 H 2.1217054 Z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p2"
d="m 98.676048,47.756679 -9.593904,9.59391 h -10.71615 v -8.97846 h 3.982323 V 28.49651 h -3.982323 v -9.593903 h 10.71615 l 9.593904,9.593903 z m -27.007665,0.61545 h 4.163328 v 8.97846 H 65.079346 l -9.593903,-9.59391 V 28.49651 l 9.593903,-9.593903 h 10.752365 v 9.593903 h -4.163328 z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p3"
d="m 131.29495,28.49651 h -6.80627 v -4.1996 l 5.35815,-5.394303 h 9.70248 l 7.78371,8.978458 v 9.955914 H 131.29495 Z M 105.91639,57.350589 V 18.902607 h 16.00187 v 38.447982 z" />
<path
style="fill:#00dd00;stroke-width:0.695105"
inkscape:connector-curvature="0"
id="p4"
d="m 177.56291,28.49651 h -7.09583 v -9.593903 h 13.5038 l 9.5939,9.593903 v 32.655399 l -9.5939,9.66633 h -21.10651 l -4.81507,-4.85127 v -3.54788 h 19.51361 z m -2.5342,19.875619 v 4.23583 l -4.77885,4.74263 h -8.72502 l -9.59391,-9.59391 V 28.49651 l 9.59391,-9.593903 h 6.40796 v 29.469522 z" />
</g>
<g
aria-label=""
id="text1157"
style="font-size:126.228px;line-height:125%;font-family:forkawesome;-inkscape-font-specification:forkawesome;letter-spacing:0px;word-spacing:0px;fill:#ffffff;stroke-width:7.21301px">
<path
d="M 72.951143,172.08142 H 127.04886 V 145.03256 H 72.951143 Z m 63.113997,0 h 9.01629 v -63.114 q 0,-0.98615 -0.7044,-2.67671 -0.7044,-1.76099 -1.4088,-2.46539 L 123.17467,84.031758 q -0.7044,-0.704397 -2.39495,-1.408795 -1.69055,-0.704397 -2.74715,-0.704397 v 29.302924 q 0,2.81759 -1.97231,4.78991 -1.97231,1.97231 -4.7899,1.97231 H 70.697072 q -2.81759,0 -4.789902,-1.97231 -1.972312,-1.97232 -1.972312,-4.78991 V 81.918566 h -9.016286 v 90.162854 h 9.016286 v -29.30293 q 0,-2.81759 1.972312,-4.7899 1.972312,-1.97231 4.789902,-1.97231 h 58.605858 q 2.81759,0 4.7899,1.97231 1.97231,1.97231 1.97231,4.7899 z M 109.01628,106.71335 V 84.172637 q 0,-0.915716 -0.70439,-1.549674 -0.63396,-0.704397 -1.54968,-0.704397 H 93.237785 q -0.915716,0 -1.620113,0.704397 -0.633958,0.633958 -0.633958,1.549674 v 22.540713 q 0,0.91572 0.633958,1.62011 0.704397,0.63396 1.620113,0.63396 h 13.524425 q 0.91572,0 1.54968,-0.63396 0.70439,-0.70439 0.70439,-1.62011 z m 45.08143,2.25407 v 65.36807 q 0,2.81759 -1.97231,4.7899 -1.97231,1.97232 -4.7899,1.97232 H 52.664501 q -2.81759,0 -4.789902,-1.97232 -1.972312,-1.97231 -1.972312,-4.7899 V 79.664495 q 0,-2.81759 1.972312,-4.789902 1.972312,-1.972312 4.789902,-1.972312 h 65.368069 q 2.81759,0 6.1987,1.408794 3.3811,1.408795 5.35342,3.381107 l 19.72312,19.723125 q 1.97231,1.972312 3.38111,5.353423 1.40879,3.3811 1.40879,6.19869 z"
id="path28" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

34
install.sh Normal file
View File

@ -0,0 +1,34 @@
#! /bin/bash
# Borg zenity install and update
which zenity
if [ "$?" != "0" ]; then
bash testdistro.sh || exit
fi
which borg
if [ "$?" != "0" ]; then
bash testdistro.sh || exit
fi
mkdir -p $HOME/bin/ $HOME/.icons/ $HOME/.local/share/applications/
# copie des fichiers
cp -fv icons/borg.svg $HOME/.icons/
cp -fv icons/borgzenity-profils.svg $HOME/.icons/
cp -fv icons/borgzenity-sauvegarde.svg $HOME/.icons/
cp -fv sauvegarde-borg.desktop $HOME/.local/share/applications/
cp -fv gestprofilsborgzenity.desktop $HOME/.local/share/applications/
cp -fv borg-gui.sh $HOME/bin/
cp -fv profile-manager.sh $HOME/bin/
cp -fv borg-zenity.conf $HOME/.config/borg/
# réglages des droits
chmod 700 $HOME/bin/borg-gui.sh
chmod 700 $HOME/bin/profile-manager.sh
echo "--------------------"
echo "Installation terminée."

6
profil_exemple.conf Executable file
View File

@ -0,0 +1,6 @@
nomsauvegarde=""
borg_repo=""
borg_archive="$(date +%d_%B_%Y)"
borg_dir=""
borg_excludes=""
borg_compress="--compress zlib,5"

74
profile-manager.sh Normal file
View File

@ -0,0 +1,74 @@
#! /bin/bash
ZenityPulsate () {
zenity $W --window-icon=$HOME/.icons/borg.svg --progress --pulsate --auto-close
}
W="--width=600"
H="--height=500"
dossierprofil="$HOME/.config/borg/"
cd $dossierprofil
# affichage du menu
choixmenu=$(echo -e "\
cp\nCréer un nouveau profil/dépôt\n\
ap\nAfficher les profils\
" | zenity $H $W --window-icon=$HOME/.icons/borg.svg --list \
--column "id" --column "choix")
# gestion des choix du menu
if [ "$choixmenu" = "cp" ];then
# Créer un nouveau profil/dépôt
borg_repo=$(zenity --file-selection --directory)
if [ ! -z "$(ls -A $borg_repo)" ]; then
zenity $W --error --text="Erreur, le dossier n'est pas vide."
exit
fi
zenity $W --question --text "Chiffrer le dépôt ? (fortement recommandé)"
if [ "$?" = "0" ];then
zenity $W --warning --text \
"Le fichier-clé du dépot sera stocké dans le dossier <tt>$HOME/.config/borg/keys/</tt>.\n\n\
Veuillez à sauvegarder ce dossier dans un endroit sûr.\n\n\
Si cette clé ne peut être lue les données ne seront pas récupérables.\n\n\
Notez qu'il n'existe aucun mécanisme de récupération de clé."
borg init $borg_repo | ZenityPulsate
zenity $W --info --text "Un nouveau dépot chiffré a été généré dans <tt>$borg_repo</tt>"
elif [ "$?" = "1" ];then
zenity $W --warning --text \
"Je comprends qu'en ne sécurisant pas mon dépot les données qu'il contient seront librement accessible par toute personne ayant accès aux fichiers du dépôt."
borg init --encryption none $borg_repo | ZenityPulsate
zenity $W --info --text "Un nouveau dépot en clair a été généré dans <tt>$borg_repo</tt>"
fi
borg_dir=$(zenity --title "Dossier à sauvegarder" --file-selection --directory)
vars=$(zenity --forms \
--text "Laisser les champs vides pour les options par défaut" \
--add-entry "Nom de sauvegarde" \
--add-entry "Nom de profil (pas d'espace ni caractères spéciaux)")
nomsauvegarde=$(echo $vars | cut -d\| -f1)
profilename=$(echo $vars | cut -d\| -f2)
cat << EOF >> $HOME/.config/borg/"$profilename".conf
nomsauvegarde="$nomsauvegarde"
borg_repo="$borg_repo"
borg_archive="\$(date +%d_%B_%Y_%H-%M-%S)"
borg_dir="$borg_dir"
borg_excludes=""
borg_compress=""
dryrun=""
EOF
elif [ "$choixmenu" = "ap" ];then
# Afficher les profils
fichierprofil=$(ls -1 *.conf | zenity $H $W --window-icon=$HOME/.icons/borg.svg --list --title "Liste des profils" --text "Choisir un profil dans la liste" --hide-header --column "profil")
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
elif [ "$choixmenu" = "" ];then
exit
fi

44
readme.md Normal file
View File

@ -0,0 +1,44 @@
# Borg Zenity
Une interface graphique en français pour BorgBackup.
Pre-requis : Borg-zeniy utilise `borgbackup` et `zenity` pour fonctionner.
Le script devrait les installer automatiquement en détectant votre distribution.
S'il n'y parvient pas vous devrez les installer manuellement.
## Installation (version de développement)
Avant tout sachez que la version dans la branche `dev` est encore en test.
L'installation devrait pouvoir se faire en une ligne de commande. Copiez ceci dans votre terminal.
```
wget -O borg-zenity.zip https://git.djan-gicquel.fr/borg-zenity/zipball/dev && unzip -d borg-zenity borg-zenity.zip && cd borg-zenity && bash install.sh
```
Cette commande va télécharger les fichiers d'installation et exécuter le script d'installation.
Vous devrez entrer votre mot de passe administrateur et répondre oui ou Y ou YES lorsque le gestionnaire de paquet de votre distribution vous demandera d'installer les paquets `borgbackup` et `zenity`.
Une fois linstallation terminée vous pouvez supprimmer le fichier `borg-zenity.zip` et le dossier `borg-zenity`.
## Gestionnaire de profils
![icône gestionnaire de profils](https://git.djan-gicquel.fr/borg-zenity/raw/dev/captures/icone_profils.png)
Si vous n'utilisez pas encore `borgbackup` (ce qui normalement est le cas), il faudra tout d'abord créer un profil de sauvegarde.
Pour cela utiliser licône "Borg Zenity Profils" dans votre menu principal et sélectionnez «Créer un nouveau profil/dépôt».
Sélectionnez le dossier dans lequel sera créé le dépôt. C'est l'emplacement de votre sauvegarde, en général on utilise un disque dur externe.
Puis répondez à la question concernant le chiffrement du dépôt. Les fichiers du dépôt sont initialisés.
Sélectionnez ensuite un dossier à sauvegarder puis choisissez un nom de profil. Celui-ci sera stocké comme fichier donc évitez si possible les espaces et les caractères spéciaux.
Il n'est pour l'instant pas possible de supprimer un profil via l'interface car la suppression laisserait des traces dans la configuration de borgbackup.
Pour supprimer un dépôt, rendez-vous dans le dossier du dépôt, ouvrez un terminal et tapez `borg delete .` puis validez avec "YES" si vous êtes sur de vous. Le dépôt sera supprimé proprement. Il faudra également supprimer le fichier de profil dans `~/.config/borg/` pour qu'il n'apparaisse plus dans borg-zenity.
## Interface principale
![icône interface principale](https://git.djan-gicquel.fr/borg-zenity/raw/dev/captures/icone_sauvegarde.png)
Pour lancer l'interface principale cliquez sur l'icône «Borg Zenity Sauvegarde» dans le menu et sélectionnez le profil voulu.
En vocabulaire borg, une archive est une sauvegarde.
Pour créer une sauvegarde cliquez sur «Créer une archive». La première sauvegarde prendra du temps, les suivantes seront plus rapide.
Pour voir le contenu d'une archive déjà sauvegardée cliquez sur «Monter une archive». Un nouveau dossier sera créé en lecture seule dans votre dossier maison. Il contiendra les fichiers de l'archive. Pensez à démonter l'archive dans le menu correspondant avant de quitter Borg Zenity.
Pour quitter Borg Zenity sélectionnez «QUITTER» puis validez ceci afin pouvoir faire quelques tests avant de quitter le logiciel.

6
sauvegarde-borg.desktop Normal file
View File

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Borg Zenity Sauvegarde
Exec=bin/borg-gui.sh
Icon=borgzenity-sauvegarde
Type=Application
Categories=Utility;

64
testdistro.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS=Suse
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS=Redhat
else
echo "La distribution n'a pas été détecté."
echo "Installez les paquets \"borgbackup\" et \"zenity\" manuellement."
exit
fi
echo "OS = $OS"
if [[ "$OS" =~ "Fedora" ]];then
echo "Fedora detecté"
sudo dnf install borgbackup zenity
elif [[ "$OS" =~ Mageia ]];then
# non fonctionnel sur Mageia 8, le paquet borgbackup n'existe pas encore
echo "Mageia detecté"
su -c "dnf install borgbackup zenity"
elif [[ "$OS" =~ Debian ]];then
echo "Debian detecté"
su -c apt install -y borgbackup zenity
elif [[ "$OS" =~ Ubuntu ]];then
echo "Ubuntu detecté"
sudo apt install -y borgbackup zenity
elif [[ "$OS" =~ "Linux Mint" ]];then
echo "Linux Mint detecté"
sudo apt install -y borgbackup zenity
elif [[ "$OS" =~ Manjaro ]];then
echo "Manjaro detecté"
sudo pacman -Sy borgbackup zenity
else
echo "La distribution n'a pas été détecté."
echo "Installez les paquets \"borgbackup\" et \"zenity\" manuellement."
exit
fi