From e0e5915fde86b7be46fd6ef17104ac8d9f87b7b6 Mon Sep 17 00:00:00 2001 From: GARDAIS Jeremy Date: Thu, 26 Apr 2018 15:13:32 +0200 Subject: [PATCH] Add DEBUG messages for MyFqdn function --- install_backuppc_mac.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/install_backuppc_mac.sh b/install_backuppc_mac.sh index 299d782..d88e7da 100755 --- a/install_backuppc_mac.sh +++ b/install_backuppc_mac.sh @@ -79,8 +79,9 @@ function IpAddress() { local strMyIpAddress strMyIpAddress='' strMyIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com) + [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction IpAddress - strMyIpAddress = ${strMyIpAddress}." if [ "${strMyIpAddress}" == '' ]; then - error "failed to retrieve the ip address of this machine" + printf '\e[1;31m%-6s\e[m\n' "ERREUR : Impossible de récupérer l'adresse IP de cette machine (${strMyIpAddress})." return 1 fi echo "{$strMyIpAddress}" @@ -92,7 +93,9 @@ function MyFqdn() { local strMyIpAddress local strMyFqdn strMyIpAddress=$( IpAddress ) # eg '129.20.27.49' - strMyFqdn=$(host "${strMyIpAddress}" | awk '{print $5}') + [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction MyFqdn - strMyIpAddress = ${strMyIpAddress}." + strMyFqdn=$(host "$strMyIpAddress" | awk '{print $5}') + [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Fonction MyFqdn - strMyFqdn = ${strMyFqdn}." echo "${strMyFqdn%?}" # remove the trailing '.' } ## }}} @@ -182,11 +185,11 @@ function AllowBackuppcSudo() { # Ensure to create the sudoers directory 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 sudo sh -c "echo '${userLogin} ALL=(ALL:ALL) NOEXEC:NOPASSWD: /usr/bin/rsync' > ${sudoersDir}/backuppc_noexec" - [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout des autorisations sudo pour l'utilisateur (${userLogin}) dans le fichier (${sudoersDir}/backuppc_noexec)." + [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout des autorisations sudo pour l'utilisateur (${userLogin}) dans le fichier (${sudoersDir}/backuppc_noexec)." } ## }}} # }}}