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
}
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<tt>$HOME/$borg_archive</tt>"
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
# 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="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | ZenityPulsate
zenity $W --info --text="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | 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="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
# Afficher le profil
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
fi