echappement des variables

This commit is contained in:
Djan GICQUEL 2022-06-23 17:56:25 +02:00
parent 7a55bb867d
commit aa650ade82
1 changed files with 18 additions and 19 deletions

View File

@ -49,7 +49,7 @@ TestBorgRepo () {
bobainfoa () { bobainfoa () {
TestBorgRepo TestBorgRepo
borg info ./::$borg_repo borg info ./::"$borg_repo"
} }
DossierPresent () { DossierPresent () {
@ -66,9 +66,9 @@ ZenityPulsate () {
BorgFilter () { BorgFilter () {
if [ "$filter" = "" ];then if [ "$filter" = "" ];then
Borg_Archive=$(borg list --short $borg_repo | zenity $H $iconborg --list --title "Listes des archives" --column "Archive") Borg_Archive=$(borg list --short "$borg_repo" | zenity $H $iconborg --list --title "Listes des archives" --column "Archive")
else else
Borg_Archive=$(borg list --short $borg_repo| grep $filter | zenity $H $iconborg --list --title "Listes des archives" --column "Archive") Borg_Archive=$(borg list --short "$borg_repo" | grep "$filter" | zenity $H $iconborg --list --title "Listes des archives" --column "Archive")
fi fi
} }
@ -105,7 +105,7 @@ elif [ "$borg_repo" = "" ]; then
exit exit
fi fi
cd $borg_repo cd "$borg_repo"
TestBorgRepo TestBorgRepo
@ -141,7 +141,7 @@ MenuCreer="cs\n[+] Créer l'archive : $(echo $borg_archive)\n"
fi fi
# afficher l'espace disque sous condition, la variable vient du fichier borg-zenity.conf # afficher l'espace disque sous condition, la variable vient du fichier borg-zenity.conf
EspaceDisqueUtil=$(df -k --output=pcent $borg_repo | tail -n +2 | cut -d% -f1) EspaceDisqueUtil=$(df -k --output=pcent "$borg_repo" | tail -n +2 | cut -d% -f1)
if [ $EspaceDisqueUtil -gt $seuil_alerte_espace_disque ];then if [ $EspaceDisqueUtil -gt $seuil_alerte_espace_disque ];then
MenuEspaceDisque="ed\n/!\ Espace disque utilisé : $EspaceDisqueUtil %\n" MenuEspaceDisque="ed\n/!\ Espace disque utilisé : $EspaceDisqueUtil %\n"
else else
@ -196,16 +196,15 @@ fi
# Créer une archive # Créer une archive
TestBorgRepo TestBorgRepo
DossierPresent "$borg_repo"
DossierPresent "$borg_dir"
DossierPresent $borg_repo borg list --short "$borg_repo" | grep $borg_archive
DossierPresent $borg_dir
borg list --short $borg_repo | grep $borg_archive
if [ "$?" = "0" ];then if [ "$?" = "0" ];then
zenity --warning $W $iconborg --text "L'archive existe déjà." zenity --warning $W $iconborg --text "L'archive existe déjà."
else else
if [ "$VarDossierPresent" != "false" ];then if [ "$VarDossierPresent" != "false" ];then
cd $borg_dir && borg create $borg_excludes $borg_compress $borg_repo::$borg_archive ./ | ZenityPulsate cd "$borg_dir" && borg create $borg_excludes $borg_compress "$borg_repo"::"$borg_archive" ./ | ZenityPulsate
sync | ZenityPulsate sync | ZenityPulsate
zenity --notification --text "Sauvegarde $nomsauvegarde terminée" zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
zenity $W --info --text "Sauvegarde $nomsauvegarde terminée" zenity $W --info --text "Sauvegarde $nomsauvegarde terminée"
@ -217,8 +216,8 @@ fi
# Monter une archive # Monter une archive
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
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
@ -226,9 +225,9 @@ 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
sleep 2 | ZenityPulsate sleep 2 | ZenityPulsate
rmdir $ptnmontage | ZenityPulsate rmdir "$ptnmontage" | ZenityPulsate
fi fi
elif [ "$choixmenu" = "dmt" ];then elif [ "$choixmenu" = "dmt" ];then
@ -246,7 +245,7 @@ fi
if [ "$Borg_Archive" = "" ];then if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu" zenity $W --info --text "Aucune archive choisie, retour au menu"
else else
borg delete $borg_repo::$Borg_Archive | ZenityPulsate borg delete "$borg_repo"::"$Borg_Archive" | ZenityPulsate
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
@ -254,15 +253,15 @@ fi
# Supprimer des archives # Supprimer des archives
if [ "$filter" = "" ];then if [ "$filter" = "" ];then
Borg_Archive=$(borg list --short $borg_repo | sed s/^/\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "Sel" --column "Archive") Borg_Archive=$(borg list --short "$borg_repo" | sed s/^/\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "Sel" --column "Archive")
else else
Borg_Archive=$(borg list --short $borg_repo | grep $filter | sed s/^/S\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "S" --column "Archive") Borg_Archive=$(borg list --short "$borg_repo" | grep "$filter" | sed s/^/S\\n/g | zenity $H $iconborg --list --checklist --title "Listes des archives" --column "S" --column "Archive")
fi fi
if [ "$Borg_Archive" = "" ];then if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu" zenity $W --info --text "Aucune archive choisie, retour au menu"
else else
borg delete $borg_repo::$(echo "$Borg_Archive" | sed s/\|/\ /g) | ZenityPulsate borg delete "$borg_repo"::$(echo "$Borg_Archive" | sed s/\|/\ /g) | ZenityPulsate
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
@ -274,7 +273,7 @@ fi
zenity $W --info --text "Aucune archive choisie, retour au menu" zenity $W --info --text "Aucune archive choisie, retour au menu"
else else
borg_nouveaunom=$(zenity --entry --text "Nouveau nom" --entry-text="$Borg_Archive") borg_nouveaunom=$(zenity --entry --text "Nouveau nom" --entry-text="$Borg_Archive")
borg rename $borg_repo::"$Borg_Archive" "$borg_nouveaunom" | ZenityPulsate borg rename "$borg_repo"::"$Borg_Archive" "$borg_nouveaunom" | ZenityPulsate
fi fi