ajout des variables pour la hauteur et la largeur des boites de dialogue

This commit is contained in:
Djan GICQUEL 2021-07-24 12:24:38 +02:00
parent bde056f5ee
commit bc05a6cb0a
1 changed files with 34 additions and 32 deletions

View File

@ -17,6 +17,8 @@ fi
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
dossierprofil="$HOME/.config/borg/"
W="600"
H="500"
# FONCTIONS
#################################################################################
@ -24,21 +26,21 @@ TestBorgRepo () {
if [ ! -f "config" ]; then
TestBorgErr=1
infoerr=$(echo "Impossible de trouver le fichier de configuration borg.")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
fi
if [ ! -d "data" ]; then
TestBorgErr=1
infoerr=$(echo "Impossible de trouver le fichier de configuration borg.")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
fi
if [ -d "lock.exclusive" ]; then
TestBorgErr=1
infoerr=$(echo "Le dépôt est bloqué, une opération est peut-être en cours")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
fi
}
@ -51,7 +53,7 @@ bobainfoa () {
DossierPresent () {
if [ ! -d "$1" ]; then
inforerror=$(echo "Erreur, le dossier $1 est absent.")
zenity --width=600 --error --text="$inforerror"
zenity --width=$W --error --text="$inforerror"
VarDossierPresent="false"
fi
}
@ -65,20 +67,20 @@ if [ ! $1 = "" ]; then
. "$1"
else
cd $dossierprofil
fichierprofil=$(ls -1 *.txt | zenity --height=500 --width=600 --window-icon=$HOME/.icons/borg.svg --list --title "Liste des profils" --text "Choisir un profil dans la liste" --hide-header --column "profil") && . $fichierprofil
fichierprofil=$(ls -1 *.txt | zenity --height=$H --width=$W --window-icon=$HOME/.icons/borg.svg --list --title "Liste des profils" --text "Choisir un profil dans la liste" --hide-header --column "profil") && . $fichierprofil
fi
if [ "$fichierprofil" = "" ]; then
infoerr=$(echo "Aucun profil choisi.")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
elif [ "$nomsauvegarde" = "" ]; then
infoerr=$(echo "Nom de sauvegarde non défini.")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
elif [ "$borg_repo" = "" ]; then
infoerr=$(echo "Variable \$borg_repo absente")
zenity --width=600 --error --text="$infoerr"
zenity --width=$W --error --text="$infoerr"
exit
fi
@ -108,7 +110,7 @@ ap\nAfficher le profil\n\
ed\nEspace disque utilisé : $(df -k --output=pcent $borg_repo | tail -n +2)\n\
qu\nQuitter\
" | zenity --window-icon=$HOME/.icons/borg.svg --list \
--height=400 --width=400 \
--height=$H --width=$W \
--title "BORG GUI : $nomsauvegarde" \
--hide-header --hide-column=1 --column "id" --column "choix")
@ -121,48 +123,48 @@ if [ "$choixmenu" = "cs" ] ;then
DossierPresent $borg_dir
if [ "$VarDossierPresent" != "false" ];then
borg create $borg_excludes $borg_compress $borg_repo::$borg_archive $borg_dir | zenity --width=600 --window-icon=$HOME/.icons/borg.svg --progress --pulsate --auto-close --title="Sauvegarde en cours..."
sync | zenity --width=600 --window-icon=$HOME/.icons/borg.svg --progress --pulsate --auto-close --title="Synchronisation des écritures..."
borg create $borg_excludes $borg_compress $borg_repo::$borg_archive $borg_dir | zenity --width=$W --window-icon=$HOME/.icons/borg.svg --progress --pulsate --auto-close --title="Sauvegarde en cours..."
sync | zenity --width=$W --window-icon=$HOME/.icons/borg.svg --progress --pulsate --auto-close --title="Synchronisation des écritures..."
zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
zenity --width=600 --info --text "Sauvegarde $nomsauvegarde terminée"
zenity --width=$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 --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
else
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "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<tt>$HOME/$borg_archive</tt>"
borg mount $borg_repo::$borg_archive $HOME/$borg_archive | zenity --width=$W --progress --pulsate --auto-close
zenity --width=$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 --height=400 --window-icon=$HOME/.icons/borg.svg --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
ptnmontage=$(mount | grep borgfs | cut -d" " -f3 | zenity --width=500 --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Liste des points de montages" --column "Archive")
fusermount -u $ptnmontage | zenity --width=$W --progress --pulsate --auto-close
sleep 5 | zenity --width=$W --progress --pulsate --auto-close
rmdir $ptnmontage | zenity --width=$W --progress --pulsate --auto-close
elif [ "$choixmenu" = "ss" ];then
# Supprimmer une archive
if [ "$filter" = "" ];then
borg_archive=$(borg list --short $borg_repo | zenity --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
else
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
fi
if [ "$borg_archive" = "" ];then
zenity --width=600 --info --text "Aucune archive choisie, retour au menu"
zenity --width=$W --info --text "Aucune archive choisie, retour au menu"
else
borg delete $borg_repo::$borg_archive | zenity --width=600 --progress --pulsate --auto-close
zenity --width=600 --info --text="Suppresion de l'archive $borg_archive terminée"
borg delete $borg_repo::$borg_archive | zenity --width=$W --progress --pulsate --auto-close
zenity --width=$W --info --text="Suppresion de l'archive $borg_archive terminée"
fi
@ -170,15 +172,15 @@ elif [ "$choixmenu" = "is" ];then
# Information archive
if [ "$filter" = "" ];then
borg_archive=$(borg list --short $borg_repo | zenity --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
else
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=500 --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
borg_archive=$(borg list --short $borg_repo | grep $filter | zenity --height=$H --window-icon=$HOME/.icons/borg.svg --list --title "Listes des archives" --column "Archive")
fi
if [ "$borg_archive" = "" ];then
zenity --width=600 --info --text "Aucune archive choisie, retour au menu"
zenity --width=$W --info --text "Aucune archive choisie, retour au menu"
else
zenity --width=600 --info --text="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | zenity --width=600 --progress --pulsate --auto-close
zenity --width=$W --info --text="<tt>$(borg info $borg_repo::$borg_archive)</tt>" | zenity --width=$W --progress --pulsate --auto-close
fi
elif [ "$choixmenu" = "fi" ];then
@ -189,14 +191,14 @@ elif [ "$choixmenu" = "fi" ];then
elif [ "$choixmenu" = "id" ];then
# Information sur le dépôt
zenity --width=600 --info --text="<tt>$(borg info $borg_repo)</tt>" | zenity --width=600 --progress --pulsate --auto-close --title="Récupération des informations..."
zenity --width=$W --info --text="<tt>$(borg info $borg_repo)</tt>" | zenity --width=$W --progress --pulsate --auto-close --title="Récupération des informations..."
elif [ "$choixmenu" = "ap" ];then
# Afficher le profil
zenity --width=600 --height=400 --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
zenity --width=$W --height=$H --info --text="<tt>$(cd $dossierprofil && cat $fichierprofil)</tt>"
elif [ "$choixmenu" = "" ];then
zenity --width=600 --info --text="Aucun choix, retour au menu."
zenity --width=$W --info --text="Aucun choix, retour au menu."
fi
done