echappement des variables

This commit is contained in:
Djan GICQUEL 2022-06-23 17:56:25 +02:00
parent 7a55bb867d
commit aa650ade82

View File

@ -49,7 +49,7 @@ TestBorgRepo () {
bobainfoa () {
TestBorgRepo
borg info ./::$borg_repo
borg info ./::"$borg_repo"
}
DossierPresent () {
@ -66,9 +66,9 @@ ZenityPulsate () {
BorgFilter () {
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
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
}
@ -105,7 +105,7 @@ elif [ "$borg_repo" = "" ]; then
exit
fi
cd $borg_repo
cd "$borg_repo"
TestBorgRepo
@ -141,7 +141,7 @@ MenuCreer="cs\n[+] Créer l'archive : $(echo $borg_archive)\n"
fi
# 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
MenuEspaceDisque="ed\n/!\ Espace disque utilisé : $EspaceDisqueUtil %\n"
else
@ -196,16 +196,15 @@ fi
# Créer une archive
TestBorgRepo
DossierPresent "$borg_repo"
DossierPresent "$borg_dir"
DossierPresent $borg_repo
DossierPresent $borg_dir
borg list --short $borg_repo | grep $borg_archive
borg list --short "$borg_repo" | grep $borg_archive
if [ "$?" = "0" ];then
zenity --warning $W $iconborg --text "L'archive existe déjà."
else
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
zenity --notification --text "Sauvegarde $nomsauvegarde terminée"
zenity $W --info --text "Sauvegarde $nomsauvegarde terminée"
@ -217,8 +216,8 @@ fi
# Monter une archive
BorgFilter
if [ ! "$Borg_Archive" = "" ];then
mkdir $HOME/$Borg_Archive
borg mount $borg_repo::$Borg_Archive $HOME/$Borg_Archive | ZenityPulsate
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>"
fi
@ -226,9 +225,9 @@ 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
fusermount -u "$ptnmontage" | ZenityPulsate
sleep 2 | ZenityPulsate
rmdir $ptnmontage | ZenityPulsate
rmdir "$ptnmontage" | ZenityPulsate
fi
elif [ "$choixmenu" = "dmt" ];then
@ -246,7 +245,7 @@ fi
if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
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"
fi
@ -254,15 +253,15 @@ fi
# Supprimer des archives
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
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
if [ "$Borg_Archive" = "" ];then
zenity $W --info --text "Aucune archive choisie, retour au menu"
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)"
fi
@ -274,7 +273,7 @@ fi
zenity $W --info --text "Aucune archive choisie, retour au menu"
else
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