Add DEBUG messages for MyFqdn function
This commit is contained in:
parent
ebf03aaf8e
commit
e0e5915fde
|
@ -79,8 +79,9 @@ function IpAddress() {
|
||||||
local strMyIpAddress
|
local strMyIpAddress
|
||||||
strMyIpAddress=''
|
strMyIpAddress=''
|
||||||
strMyIpAddress=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
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
|
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
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "{$strMyIpAddress}"
|
echo "{$strMyIpAddress}"
|
||||||
|
@ -92,7 +93,9 @@ 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}')
|
[[ "${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 '.'
|
echo "${strMyFqdn%?}" # remove the trailing '.'
|
||||||
}
|
}
|
||||||
## }}}
|
## }}}
|
||||||
|
@ -182,11 +185,11 @@ function AllowBackuppcSudo() {
|
||||||
|
|
||||||
# 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"
|
||||||
[[ "${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)."
|
||||||
}
|
}
|
||||||
## }}}
|
## }}}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Loading…
Reference in New Issue