From d3681acba66f1e4ef1fac29ecc5ea1187843c15a Mon Sep 17 00:00:00 2001
From: Djan GICQUEL <>
Date: Wed, 4 Aug 2021 15:46:06 +0200
Subject: [PATCH] =?UTF-8?q?correction=20menu=20principal=20du=20d=C3=A9p?=
=?UTF-8?q?=C3=B4t=20avec=20boucle=20while?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
borg-gui.sh | 181 ++++++++++++++++++++++++++--------------------------
1 file changed, 90 insertions(+), 91 deletions(-)
diff --git a/borg-gui.sh b/borg-gui.sh
index da79b4d..93a75cc 100755
--- a/borg-gui.sh
+++ b/borg-gui.sh
@@ -97,6 +97,7 @@ TestBorgRepo
# MENU PRINCIPAL Gestion des options du menu
#################################################################################
+while [ ! "$choixmenu" = "qu" ];do
choixmenu=$(echo -e "\
cs\nCréer une archive\n\
ms\nMonter une archive\n\
@@ -108,101 +109,99 @@ fi\nFiltre : "$filter"\n\
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)" \
-| zenity $iconborg --list \
-$H $W \
---title "BORG GUI : $nomsauvegarde" \
+ed\nEspace disque utilisé : $(df -k --output=pcent $borg_repo | tail -n +2)\n\
+qu\nQUITTER\
+" | zenity $iconborg --list $H $W --title "BORG GUI : $nomsauvegarde" \
--hide-header --hide-column=1 --column "id" --column "choix")
-if [ "$choixmenu" = "" ];then
-exit
+ if [ "$choixmenu" = "" ];then
+ echo ""
-elif [ "$choixmenu" = "cs" ];then
-# Créer une archive
+ elif [ "$choixmenu" = "cs" ];then
+ # Créer une archive
- TestBorgRepo
+ TestBorgRepo
- DossierPresent $borg_repo
- DossierPresent $borg_dir
+ DossierPresent $borg_repo
+ DossierPresent $borg_dir
+
+ 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
+
+ elif [ "$choixmenu" = "ms" ];then
+ # Monter une archive
+
+ 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
+
+ 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$HOME/$borg_archive"
+
+ elif [ "$choixmenu" = "dm" ];then
+ # Demonter une archive
+
+ ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity --width=500 $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" = "ss" ];then
+ # Supprimmer une archive
+
+ 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
+
+
+ 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" = "is" ];then
+ # Information archive
+
+ 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
+
+ if [ "$borg_archive" = "" ];then
+ zenity $W --info --text "Aucune archive choisie, retour au menu"
+ else
+ zenity $W --info --text="$(borg info $borg_repo::$borg_archive)" | ZenityPulsate
+ fi
+
+ elif [ "$choixmenu" = "fi" ];then
+ #Filtre
+
+ filter=$(zenity --entry)
+
+ elif [ "$choixmenu" = "id" ];then
+ # Information sur le dépôt
+
+ zenity $W --info --text="$(borg info $borg_repo)" | ZenityPulsate
+
+ elif [ "$choixmenu" = "ap" ];then
+ # Afficher le profil
+
+ zenity $W $H --info --text="$(cd $dossierprofil && cat $fichierprofil)"
- 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
-
-elif [ "$choixmenu" = "ms" ];then
-# Monter une archive
-
- 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
-
- 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$HOME/$borg_archive"
-
-elif [ "$choixmenu" = "dm" ];then
-# Demonter une archive
-
- ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity --width=500 $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" = "ss" ];then
-# Supprimmer une archive
-
- 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
-
-
- 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" = "is" ];then
-# Information archive
-
- 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
-
- if [ "$borg_archive" = "" ];then
- zenity $W --info --text "Aucune archive choisie, retour au menu"
- else
- zenity $W --info --text="$(borg info $borg_repo::$borg_archive)" | ZenityPulsate
- fi
-
-elif [ "$choixmenu" = "fi" ];then
-#Filtre
-
- filter=$(zenity --entry)
-
-elif [ "$choixmenu" = "id" ];then
-# Information sur le dépôt
-
- zenity $W --info --text="$(borg info $borg_repo)" | ZenityPulsate
-
-elif [ "$choixmenu" = "ap" ];then
-# Afficher le profil
-
- zenity $W $H --info --text="$(cd $dossierprofil && cat $fichierprofil)"
-
-elif [ "$choixmenu" = "qu" ];then
- exit
-fi
+done