fonctions : ZenityPulsate ajout param posit, ajout ZenityNotification
réécriture verbeuse des appel aux fonct ZenityPulsate
This commit is contained in:
parent
288e52381e
commit
4350705ef5
48
borg-gui.sh
48
borg-gui.sh
@ -70,11 +70,16 @@ DossierPresent () {
|
||||
}
|
||||
|
||||
ZenityPulsate () {
|
||||
zenity $W $iconborg --progress --pulsate --auto-close
|
||||
zenity $W $iconborg --title "borg-zenity" --progress --pulsate --auto-close --text "$1"
|
||||
}
|
||||
|
||||
ZenityNotification () {
|
||||
zenity $iconborg --notification --text "$1"
|
||||
}
|
||||
|
||||
BorgFilter () {
|
||||
if [ "$filter" = "" ];then
|
||||
ZenityNotification "borg-zenity\nGénération de la liste des archives en cours..."
|
||||
BorgArchiveList=$(borg list --short "$borg_repo")
|
||||
Borg_Archive=$(echo -e "$BorgArchiveList" | zenity $H $W $iconborg --list --title "Listes des archives" --column "Archive")
|
||||
else
|
||||
@ -92,7 +97,8 @@ fichierprofil=$(ls -1 *.conf | cut -d. -f1 | \
|
||||
zenity $W $H $iconborg --list \
|
||||
--title "Liste des profils" \
|
||||
--text "Choisir un profil dans la liste" \
|
||||
--column "Fichier de profil"\
|
||||
--column "Fichier de profil" \
|
||||
--hide-header \
|
||||
) && . "$dossierprofil"/"$fichierprofil".conf
|
||||
|
||||
if [ "$fichierprofil" = "" ]; then
|
||||
@ -155,7 +161,7 @@ fi
|
||||
# notification si espace disque faible
|
||||
NotificationEspaceDisque () {
|
||||
if [ $EspaceDisqueUtil -gt $seuil_alerte_espace_disque ];then
|
||||
zenity --window-icon warning --notification --text="borg-zenity\nEspace disque faible, $EspaceDisqueUtil% occupé"
|
||||
ZenityNotification "borg-zenity\nEspace disque faible, $EspaceDisqueUtil% occupé"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -234,13 +240,13 @@ fi
|
||||
else
|
||||
if [ "$VarDossierPresent" != "false" ];then
|
||||
log="/tmp/borg-zenity-$borg_archive-$(date +%H-%M-%S).log"
|
||||
borg create ${borg_excludes} ${borg_compress} "$borg_repo"::"$borg_archive" . 2> "$log" | zenity $W $iconborg --progress --pulsate --auto-close --no-cancel
|
||||
borg create ${borg_excludes} ${borg_compress} "$borg_repo"::"$borg_archive" . 2> "$log" | zenity $W $iconborg --progress --pulsate --auto-close --no-cancel --text "Sauvegarde en cours..." --title "borg-zenity"
|
||||
chmod 777 "$log"
|
||||
if [ $(wc -c "$log" | cut -f1 -d " ") -gt 1 ] ;then
|
||||
zenity $W --error --title "borg-zenity erreur" --text "$(cat $log)"
|
||||
fi
|
||||
sync | ZenityPulsate
|
||||
zenity $iconborg --notification --text "Sauvegarde $nomsauvegarde terminée"
|
||||
sync | ZenityPulsate "Synchronisation des écritures..."
|
||||
ZenityNotification "borg-zenity\nSauvegarde $nomsauvegarde terminée"
|
||||
zenity $W --info --text "Sauvegarde $nomsauvegarde terminée"
|
||||
fi
|
||||
fi
|
||||
@ -251,7 +257,7 @@ fi
|
||||
BorgFilter
|
||||
if [ ! "$Borg_Archive" = "" ];then
|
||||
mkdir $HOME/"$Borg_Archive"
|
||||
borg mount "$borg_repo"::"$Borg_Archive" $HOME/"$Borg_Archive" | ZenityPulsate
|
||||
borg mount "$borg_repo"::"$Borg_Archive" $HOME/"$Borg_Archive" | ZenityPulsate "Montage de l'archive..."
|
||||
zenity $W --info --text="La sauvegarde est disponible dans le dossier\n<tt>$HOME/$Borg_Archive</tt>"
|
||||
fi
|
||||
|
||||
@ -259,17 +265,17 @@ fi
|
||||
# Démonter 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
|
||||
sleep 2 | ZenityPulsate
|
||||
rmdir "$ptnmontage" | ZenityPulsate
|
||||
fusermount -u "$ptnmontage" | ZenityPulsate "Démontage de l'archive..."
|
||||
sleep 2 | ZenityPulsate ""
|
||||
rmdir "$ptnmontage" | ZenityPulsate "Suppression du point du montage..."
|
||||
fi
|
||||
zenity --notification $iconborg --text="Démontage de $ptnmontage"
|
||||
ZenityNotification "borg-zenity\nDémontage de $ptnmontage"
|
||||
|
||||
elif [ "$choixmenu" = "dmt" ];then
|
||||
# Démonter toutes les archives
|
||||
while [ $(mount | grep borgfs | cut -d" " -f3 | head -n 1) ];do
|
||||
ptnmontage="$(mount | grep borgfs | cut -d" " -f3 | head -n 1)"
|
||||
zenity --notification $iconborg --text="Démontage de $ptnmontage"
|
||||
ZenityNotification "borg-zenity\nDémontage de $ptnmontage"
|
||||
fusermount -uz "$ptnmontage" && sleep 2 && rmdir "$ptnmontage"
|
||||
done
|
||||
|
||||
@ -278,7 +284,7 @@ fi
|
||||
# Supprimer une archive
|
||||
BorgFilter
|
||||
if [ ! "$Borg_Archive" = "" ];then
|
||||
borg delete "$borg_repo"::"$Borg_Archive" | ZenityPulsate
|
||||
borg delete "$borg_repo"::"$Borg_Archive" | ZenityPulsate "Suppresion de l'archive..."
|
||||
zenity $W --info --text="Suppresion de l'archive $Borg_Archive terminée"
|
||||
fi
|
||||
|
||||
@ -292,13 +298,13 @@ fi
|
||||
fi
|
||||
|
||||
if [ ! "$Borg_Archive" = "" ];then
|
||||
borg delete "$borg_repo"::$(echo "$Borg_Archive" | sed s/\|/\ /g) | ZenityPulsate
|
||||
borg delete "$borg_repo"::$(echo "$Borg_Archive" | sed s/\|/\ /g) | ZenityPulsate "Suppression de l'archive..."
|
||||
zenity $W --info --text="Suppression des archives terminée.\nArchives supprimées : $(echo "$Borg_Archive" | sed s/\|/\ /g)"
|
||||
fi
|
||||
|
||||
elif [ "$choixmenu" = "co" ];then
|
||||
# Compacter le dépôt
|
||||
borg compact --verbose "$borg_repo" 2> /tmp/borg-compact.log | ZenityPulsate
|
||||
borg compact --verbose "$borg_repo" 2> /tmp/borg-compact.log | ZenityPulsate "Compactage du dépôt..."
|
||||
zenity $W --info --text "$(cat /tmp/borg-compact.log)"
|
||||
|
||||
elif [ "$choixmenu" = "ra" ];then
|
||||
@ -308,12 +314,12 @@ fi
|
||||
if [ ! "$Borg_Archive" = "" ];then
|
||||
borg_nouveaunom=$(zenity $W --entry --text "Nouveau nom" --entry-text="$Borg_Archive")
|
||||
if [ "$borg_nouveaunom" = "$Borg_Archive" ];then
|
||||
zenity --notification $iconborg --text="Renommage annulé"
|
||||
ZenityNotification "Renommage annulé"
|
||||
elif [ "$borg_nouveaunom" = "" ];then
|
||||
zenity --notification $iconborg --text="Renommage annulé"
|
||||
ZenityNotification "Renommage annulé"
|
||||
elif [ "$Borg_Archive" != "$borg_nouveaunom" ];then
|
||||
borg rename "$borg_repo"::"$Borg_Archive" "$borg_nouveaunom" | ZenityPulsate
|
||||
zenity --notification $iconborg --text="Renommage terminé\n"$Borg_Archive" -> "$borg_nouveaunom""
|
||||
borg rename "$borg_repo"::"$Borg_Archive" "$borg_nouveaunom" | ZenityPulsate "Renommage de l'archive..."
|
||||
ZenityNotification "Renommage terminé\n"$Borg_Archive" -> "$borg_nouveaunom""
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -321,7 +327,7 @@ fi
|
||||
# Information archive
|
||||
BorgFilter
|
||||
if [ ! "$Borg_Archive" = "" ];then
|
||||
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 "Récupération des informations..."
|
||||
fi
|
||||
|
||||
elif [ "$choixmenu" = "fi" ];then
|
||||
@ -330,7 +336,7 @@ fi
|
||||
|
||||
elif [ "$choixmenu" = "id" ];then
|
||||
# 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 "Récupération des informations..."
|
||||
|
||||
elif [ "$choixmenu" = "ap" ];then
|
||||
# Afficher le profil
|
||||
|
Loading…
Reference in New Issue
Block a user