mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
additional hostname checks in gravity.sh
- Test if /etc/hostname exists before attempting to cat the file. - Add alternative hostname discovery via hostname command - Add an error message to stdout if unable to determine host fqdn
This commit is contained in:
parent
6c0c6182e9
commit
640af300cb
1 changed files with 7 additions and 1 deletions
|
@ -264,7 +264,13 @@ function gravity_unique() {
|
|||
function gravity_hostFormat() {
|
||||
# Format domain list as "192.168.x.x domain.com"
|
||||
echo "::: Formatting domains into a HOSTS file..."
|
||||
if [[ -f /etc/hostname ]]; then
|
||||
hostname=$(</etc/hostname)
|
||||
elif [ -x "$(command -v hostname)" ]; then
|
||||
hostname=$(hostname -f)
|
||||
else
|
||||
echo "::: Error: Unable to determine fully qualified domain name of host"
|
||||
fi
|
||||
# If there is a value in the $piholeIPv6, then IPv6 will be used, so the awk command modified to create a line for both protocols
|
||||
if [[ -n ${piholeIPv6} ]];then
|
||||
# Add hostname and dummy domain to the top of gravity.list to make ping result return a friendlier looking domain! Also allows for an easy way to access the Pi-hole admin console (pi.hole/admin)
|
||||
|
|
Loading…
Reference in a new issue