From 07daeaf25741a1af542672ae115dc1a715df6ef8 Mon Sep 17 00:00:00 2001
From: Djan GICQUEL <>
Date: Mon, 19 Jul 2021 20:16:02 +0200
Subject: [PATCH 1/2] prise en charge du bouton annuler dans les menus
---
borg-gui.sh | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/borg-gui.sh b/borg-gui.sh
index 7c46568..4e7c9b1 100755
--- a/borg-gui.sh
+++ b/borg-gui.sh
@@ -130,23 +130,34 @@ if [ "$choixmenu" = "cs" ] ;then
elif [ "$choixmenu" = "ms" ];then
# Monter une archive
- if [ "$filter" = "" ];then
- borg_archive=$(borg list --short $borg_repo | zenity --height=500 --list --title "Listes des archives" --column "Archive")
- else
- borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=500 --list --title "Listes des archives" --column "Archive")
- fi
+ if [ "$filter" = "" ];then
+ borg_archive=$(borg list --short $borg_repo | zenity --height=500 --list --title "Listes des archives" --column "Archive")
+ else
+ borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=500 --list --title "Listes des archives" --column "Archive")
+ fi
+
+ if [ "$borg_archive" = "" ];then
+ zenity --width=600 --info --text "Aucune archive choisie, retour au menu"
+ else
+
+ mkdir $HOME/$borg_archive
+ borg mount $borg_repo::$borg_archive $HOME/$borg_archive | zenity --width=600 --progress --pulsate --auto-close
+ zenity --width=600 --info --text="La sauvegarde est disponible dans le dossier\n$HOME/$borg_archive"
+ fi
- mkdir $HOME/$borg_archive
- borg mount $borg_repo::$borg_archive $HOME/$borg_archive | zenity --width=600 --progress --pulsate --auto-close
- zenity --width=600 --info --text="La sauvegarde est disponible dans le dossier\n$HOME/$borg_archive"
elif [ "$choixmenu" = "dm" ];then
# Demonter une archive
ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity --width=500 --height=400 --list --title "Liste des points de montages" --column "Archive")
- fusermount -u $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
- sleep 5 | zenity --width=600 --progress --pulsate --auto-close
- rmdir $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
+
+ if [ "$ptnmontage" = "" ];then
+ zenity --width=600 --info --text "Aucune option choisie, retour au menu"
+ else
+ fusermount -u $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
+ sleep 5 | zenity --width=600 --progress --pulsate --auto-close
+ rmdir $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
+ fi
elif [ "$choixmenu" = "ss" ];then
# Supprimmer une archive
@@ -197,6 +208,6 @@ elif [ "$choixmenu" = "ap" ];then
zenity --width=600 --height=400 --info --text="$(cd $dossierprofil && cat $fichierprofil)"
elif [ "$choixmenu" = "" ];then
- zenity --width=600 --info --text="Aucun choix, retour au menu."
+ exit
fi
done
From 710bbe08b9a47066a681ce3763d6afc22492293a Mon Sep 17 00:00:00 2001
From: Djan GICQUEL <>
Date: Wed, 21 Jul 2021 17:45:46 +0200
Subject: [PATCH 2/2] indentation du code
---
borg-gui.sh | 37 +++++++++++++++++--------------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/borg-gui.sh b/borg-gui.sh
index 4e7c9b1..0dace44 100755
--- a/borg-gui.sh
+++ b/borg-gui.sh
@@ -92,8 +92,7 @@ TestBorgRepo
#################################################################################
# Gestion des options du menu
#################################################################################
-while [ ! "$choixmenu" = "qu" ]
-do
+
choixmenu=$(echo -e "\
cs\nCréer une archive\n\
ms\nMonter une archive\n\
@@ -106,13 +105,16 @@ id\nInformation sur le dépôt\n\
ap\nAfficher le profil\n\
--\n------------------------------------------\n\
ed\nEspace disque utilisé : $(df -k --output=pcent $borg_repo | tail -n +2)\n\
-qu\nQuitter\
" | zenity --list \
--height=400 --width=400 \
--title "BORG GUI : $nomsauvegarde" \
+--cancel-label "Quitter" \
--hide-header --hide-column=1 --column "id" --column "choix")
-if [ "$choixmenu" = "cs" ] ;then
+if [ "$choixmenu" = "" ];then
+
+
+elif [ "$choixmenu" = "cs" ] ;then
# Créer une archive
TestBorgRepo
@@ -121,10 +123,10 @@ if [ "$choixmenu" = "cs" ] ;then
DossierPresent $borg_dir
if [ "$VarDossierPresent" != "false" ];then
- borg create $borg_excludes $borg_compress $borg_repo::$borg_archive $borg_dir | zenity --width=600 --progress --pulsate --auto-close --title="Sauvegarde en cours..."
- sync | zenity --width=600 --progress --pulsate --auto-close --title="Synchronisation des écritures..."
- zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
- zenity --width=600 --info --text "Sauvegarde $nomsauvegarde terminée"
+ borg create $borg_excludes $borg_compress $borg_repo::$borg_archive $borg_dir | zenity --width=600 --progress --pulsate --auto-close --title="Sauvegarde en cours..."
+ sync | zenity --width=600 --progress --pulsate --auto-close --title="Synchronisation des écritures..."
+ zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
+ zenity --width=600 --info --text "Sauvegarde $nomsauvegarde terminée"
fi
elif [ "$choixmenu" = "ms" ];then
@@ -139,7 +141,6 @@ elif [ "$choixmenu" = "ms" ];then
if [ "$borg_archive" = "" ];then
zenity --width=600 --info --text "Aucune archive choisie, retour au menu"
else
-
mkdir $HOME/$borg_archive
borg mount $borg_repo::$borg_archive $HOME/$borg_archive | zenity --width=600 --progress --pulsate --auto-close
zenity --width=600 --info --text="La sauvegarde est disponible dans le dossier\n$HOME/$borg_archive"
@@ -151,13 +152,13 @@ elif [ "$choixmenu" = "dm" ];then
ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity --width=500 --height=400 --list --title "Liste des points de montages" --column "Archive")
- if [ "$ptnmontage" = "" ];then
- zenity --width=600 --info --text "Aucune option choisie, retour au menu"
- else
- fusermount -u $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
- sleep 5 | zenity --width=600 --progress --pulsate --auto-close
- rmdir $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
- fi
+ if [ "$ptnmontage" = "" ];then
+ zenity --width=600 --info --text "Aucune option choisie, retour au menu"
+ else
+ fusermount -u $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
+ sleep 5 | zenity --width=600 --progress --pulsate --auto-close
+ rmdir $ptnmontage | zenity --width=600 --progress --pulsate --auto-close
+ fi
elif [ "$choixmenu" = "ss" ];then
# Supprimmer une archive
@@ -206,8 +207,4 @@ elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
zenity --width=600 --height=400 --info --text="$(cd $dossierprofil && cat $fichierprofil)"
-
-elif [ "$choixmenu" = "" ];then
- exit
fi
-done