From 07daeaf25741a1af542672ae115dc1a715df6ef8 Mon Sep 17 00:00:00 2001 From: Djan GICQUEL <> Date: Mon, 19 Jul 2021 20:16:02 +0200 Subject: [PATCH] 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