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