Fix the returned value of IpAddress

This commit is contained in:
Jeremy Gardais 2018-04-26 15:29:45 +02:00
parent f5ef9d67b1
commit 285aa8d6f0
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 5 additions and 5 deletions

View File

@ -84,7 +84,7 @@ function IpAddress() {
printf '\e[1;31m%-6s\e[m\n' "ERREUR: Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})." printf '\e[1;31m%-6s\e[m\n' "ERREUR: Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})."
return 1 return 1
fi fi
echo "{$strMyIpAddress}" echo "${strMyIpAddress}"
} }
## }}} ## }}}
@ -94,7 +94,7 @@ function MyFqdn() {
local strMyIpAddress local strMyIpAddress
local strMyFqdn local strMyFqdn
strMyIpAddress=$( IpAddress ) # eg '129.20.27.49' strMyIpAddress=$( IpAddress ) # eg '129.20.27.49'
strMyFqdn=$(host "$strMyIpAddress" | awk '{print $5}') strMyFqdn=$(host "${strMyIpAddress}" | awk '{print $5}')
echo "${strMyFqdn%?}" # remove the trailing '.' echo "${strMyFqdn%?}" # remove the trailing '.'
} }
## }}} ## }}}
@ -182,9 +182,9 @@ function AllowBackuppcSudo() {
return "$ERROR" return "$ERROR"
fi fi
# Ensure to create the sudoers directory # Ensure to create the sudoers directory
sudo mkdir -p -- "${sudoersDir}" sudo mkdir -p -- "${sudoersDir}"
[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG: Création du dossier pour les sudoers (${sudoersDir})." [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG: Création du dossier pour les sudoers (${sudoersDir})."
# Allow backuppc user to use rsync with sudo # Allow backuppc user to use rsync with sudo
sudo sh -c "echo '${userLogin} ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync' > ${sudoersDir}/backuppc_noexec" sudo sh -c "echo '${userLogin} ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync' > ${sudoersDir}/backuppc_noexec"
@ -240,7 +240,7 @@ fi
#### DOSSIER À SAUVEGARDER INTROUVABLE, ANNULATION #### #### DOSSIER À SAUVEGARDER INTROUVABLE, ANNULATION ####
if [ ! -d "${dir1}" ]; then if [ ! -d "${dir1}" ]; then
[[ "${DEBUG}" == "0" ]] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Partie - Dossier introuvable" [[ "${DEBUG}" == "0" ]] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Partie - Dossier introuvable"
printf '\e[1;31m%-6s\e[m\n' "ERREUR: Dossier ${dir1} introuvable, installation annulée." printf '\e[1;31m%-6s\e[m\n' "ERREUR: Dossier ${dir1} introuvable, installation annulée."
exit exit
fi fi