Skip to content

Commit

Permalink
Merge pull request #126 from Bucking-Horn/rev_server-cndtnl-fwd+appen…
Browse files Browse the repository at this point in the history
…d-domain-dhcp-only

Consider REV_SERVER for Conditonal Forwarding; append domain to hostname only when DHCP is enabled.
  • Loading branch information
dschaper authored Sep 21, 2020
2 parents 87419f6 + 555fa17 commit 1c93c02
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LC_NUMERIC=C
############################################ VARIABLES #############################################

# VERSION
padd_version="v3.3.3"
padd_version="v3.4"

# DATE
today=$(date +%Y%m%d)
Expand Down Expand Up @@ -284,17 +284,16 @@ GetNetworkInformation() {
pi_hostname=$(hostname)
pi_gateway=$(ip r | grep 'default' | awk '{print $3}')

full_hostname=${pi_hostname}
# does the Pi-hole have a domain set?
if [ -z ${PIHOLE_DOMAIN+x} ]; then
full_hostname=${pi_hostname}
else
count=${pi_hostname}"."${PIHOLE_DOMAIN}
count=${#count}

if [ "${count}" -lt "18" ]; then
full_hostname=${pi_hostname}"."${PIHOLE_DOMAIN}
else
full_hostname=${pi_hostname}
if ! [ -z ${PIHOLE_DOMAIN+x} ]; then
# is Pi-hole acting as DHCP server?
if [[ "${DHCP_ACTIVE}" == "true" ]]; then
count=${pi_hostname}"."${PIHOLE_DOMAIN}
count=${#count}
if [ "${count}" -lt "18" ]; then
full_hostname=${pi_hostname}"."${PIHOLE_DOMAIN}
fi
fi
fi

Expand Down Expand Up @@ -374,7 +373,7 @@ GetNetworkInformation() {
fi

# Conditional forwarding
if [[ "${CONDITIONAL_FORWARDING}" == "true" ]]; then
if [[ "${CONDITIONAL_FORWARDING}" == "true" ]] || [[ "${REV_SERVER}" == "true" ]]; then
conditional_forwarding_status="Enabled"
conditional_forwarding_heatmap=${green_text}
conditional_forwarding_check_box=${check_box_good}
Expand Down

0 comments on commit 1c93c02

Please sign in to comment.