correction menu principal du dépôt avec boucle while

This commit is contained in:
Djan GICQUEL 2021-08-04 15:46:06 +02:00
parent 15b08837a4
commit d3681acba6

View File

@ -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<tt>$HOME/$borg_archive</tt>"
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="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | ZenityPulsate
fi
elif [ "$choixmenu" = "fi" ];then
#Filtre
filter=$(zenity --entry)
elif [ "$choixmenu" = "id" ];then
# Information sur le dépôt
zenity $W --info --text="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
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<tt>$HOME/$borg_archive</tt>"
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="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | ZenityPulsate
fi
elif [ "$choixmenu" = "fi" ];then
#Filtre
filter=$(zenity --entry)
elif [ "$choixmenu" = "id" ];then
# Information sur le dépôt
zenity $W --info --text="<tt>$(borg info $borg_repo)</tt>" | ZenityPulsate
elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
zenity $W $H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
elif [ "$choixmenu" = "qu" ];then
exit
fi
done