From a0b56b55f0ff56c28a67742bbd07fc946632990d Mon Sep 17 00:00:00 2001
From: Djan GICQUEL <>
Date: Wed, 4 Aug 2021 20:32:21 +0200
Subject: [PATCH] filtre dans une fonction BorgFilter
---
borg-gui.sh | 63 +++++++++++++++++++----------------------------------
1 file changed, 23 insertions(+), 40 deletions(-)
diff --git a/borg-gui.sh b/borg-gui.sh
index 613a535..20d4076 100755
--- a/borg-gui.sh
+++ b/borg-gui.sh
@@ -64,6 +64,14 @@ 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
#################################################################################
# si $1 n'est pas vide fichier de profil = $1
@@ -139,24 +147,15 @@ qu\nQUITTER\
elif [ "$choixmenu" = "ms" ];then
# Monter une archive
- if [ "$filter" = "" ];then
- BorgList="borg list --short $borg_repo"
- else
- BorgList="borg list --short $borg_repo | grep $filter"
+ 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$HOME/$borg_archive"
fi
- echo $BorgList
- #borg_archive=$($BorgList | zenity $H $iconborg --list --title "Listes des archives" --column "Archive")
-
- #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$HOME/$borg_archive"
- #fi
-
elif [ "$choixmenu" = "dm" ];then
- # Demonter une archive
-
+ # 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
@@ -165,15 +164,8 @@ qu\nQUITTER\
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
-
-
+ # Supprimmer une archive
+ BorgFilter
if [ "$borg_archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
else
@@ -183,33 +175,24 @@ qu\nQUITTER\
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
-
+ # Information archive
+ BorgFilter
if [ "$borg_archive" = "" ];then
- zenity $W --info --text "Aucune archive choisie, retour au menu"
+ zenity $W --info --text "Aucune archive choisie, retour au menu"
else
- zenity $W --info --text="$(borg info $borg_repo::$borg_archive)" | ZenityPulsate
+ zenity $W --info --text="$(borg info $borg_repo::$borg_archive)" | ZenityPulsate
fi
elif [ "$choixmenu" = "fi" ];then
- #Filtre
-
+ #Filtre
filter=$(zenity --entry)
elif [ "$choixmenu" = "id" ];then
- # Information sur le dépôt
-
+ # Information sur le dépôt
zenity $W --info --text="$(borg info $borg_repo)" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then
- # Afficher le profil
-
+ # Afficher le profil
zenity $W $H --info --text="$(cd $dossierprofil && cat $fichierprofil)"
fi