filtre dans une fonction BorgFilter

This commit is contained in:
Djan GICQUEL 2021-08-04 20:32:21 +02:00
parent 79e1c4c520
commit a0b56b55f0
1 changed files with 23 additions and 40 deletions

View File

@ -64,6 +64,14 @@ ZenityPulsate () {
zenity $W $iconborg --progress --pulsate --auto-close 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 # Profils et tests
################################################################################# #################################################################################
# si $1 n'est pas vide fichier de profil = $1 # si $1 n'est pas vide fichier de profil = $1
@ -139,24 +147,15 @@ qu\nQUITTER\
elif [ "$choixmenu" = "ms" ];then elif [ "$choixmenu" = "ms" ];then
# Monter une archive # Monter une archive
if [ "$filter" = "" ];then BorgFilter
BorgList="borg list --short $borg_repo" if [ ! "$borg_archive" = "" ];then
else mkdir $HOME/$borg_archive
BorgList="borg list --short $borg_repo | grep $filter" 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 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<tt>$HOME/$borg_archive</tt>"
#fi
elif [ "$choixmenu" = "dm" ];then 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") ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity $W $H $iconborg --list --title "Liste des points de montages" --column "Archive")
if [ ! "$ptnmontage" = "" ];then if [ ! "$ptnmontage" = "" ];then
fusermount -u $ptnmontage | ZenityPulsate fusermount -u $ptnmontage | ZenityPulsate
@ -165,15 +164,8 @@ qu\nQUITTER\
fi fi
elif [ "$choixmenu" = "ss" ];then elif [ "$choixmenu" = "ss" ];then
# Supprimmer une archive # Supprimmer une archive
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
if [ "$borg_archive" = "" ];then 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 else
@ -183,33 +175,24 @@ qu\nQUITTER\
elif [ "$choixmenu" = "is" ];then elif [ "$choixmenu" = "is" ];then
# Information archive # Information archive
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
if [ "$borg_archive" = "" ];then 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 else
zenity $W --info --text="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | ZenityPulsate zenity $W --info --text="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | ZenityPulsate
fi fi
elif [ "$choixmenu" = "fi" ];then elif [ "$choixmenu" = "fi" ];then
#Filtre #Filtre
filter=$(zenity --entry) filter=$(zenity --entry)
elif [ "$choixmenu" = "id" ];then elif [ "$choixmenu" = "id" ];then
# Information sur le dépôt # Information sur le dépôt
zenity $W --info --text="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate zenity $W --info --text="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then elif [ "$choixmenu" = "ap" ];then
# Afficher le profil # Afficher le profil
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>" zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
fi fi