Merge pull request #668 from bcambl/dns-hostname-fixes

Dns hostname fixes
This commit is contained in:
Dan Schaper 2016-09-20 10:16:15 -07:00 committed by GitHub
commit ac8d295bb9
2 changed files with 12 additions and 3 deletions

View file

@ -342,6 +342,9 @@ setStaticIPv4() {
${SUDO} echo "ONBOOT=yes" >> ${IFCFG_FILE} ${SUDO} echo "ONBOOT=yes" >> ${IFCFG_FILE}
${SUDO} echo "IPADDR=$IPADDR" >> ${IFCFG_FILE} ${SUDO} echo "IPADDR=$IPADDR" >> ${IFCFG_FILE}
${SUDO} echo "PREFIX=$CIDR" >> ${IFCFG_FILE} ${SUDO} echo "PREFIX=$CIDR" >> ${IFCFG_FILE}
${SUDO} echo "GATEWAY=$IPv4gw" >> ${IFCFG_FILE}
${SUDO} echo "DNS1=$piholeDNS1" >> ${IFCFG_FILE}
${SUDO} echo "DNS2=$piholeDNS2" >> ${IFCFG_FILE}
${SUDO} echo "USERCTL=no" >> ${IFCFG_FILE} ${SUDO} echo "USERCTL=no" >> ${IFCFG_FILE}
${SUDO} ip addr replace dev "$piholeInterface" "$IPv4addr" ${SUDO} ip addr replace dev "$piholeInterface" "$IPv4addr"
if [ -x "$(command -v nmcli)" ];then if [ -x "$(command -v nmcli)" ];then
@ -851,9 +854,9 @@ configureSelinux() {
printf "::: Enabling httpd server side includes (SSI).. " printf "::: Enabling httpd server side includes (SSI).. "
${SUDO} setsebool -P httpd_ssi_exec on ${SUDO} setsebool -P httpd_ssi_exec on
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo -n "Success\n" echo -n "Success"
fi fi
printf ":::\tCompiling Pi-Hole SELinux policy..\n" printf "\n:::\tCompiling Pi-Hole SELinux policy..\n"
${SUDO} checkmodule -M -m -o /etc/pihole/pihole.mod /etc/.pihole/advanced/selinux/pihole.te ${SUDO} checkmodule -M -m -o /etc/pihole/pihole.mod /etc/.pihole/advanced/selinux/pihole.te
${SUDO} semodule_package -o /etc/pihole/pihole.pp -m /etc/pihole/pihole.mod ${SUDO} semodule_package -o /etc/pihole/pihole.pp -m /etc/pihole/pihole.mod
${SUDO} semodule -i /etc/pihole/pihole.pp ${SUDO} semodule -i /etc/pihole/pihole.pp

View file

@ -246,7 +246,13 @@ function gravity_unique() {
function gravity_hostFormat() { function gravity_hostFormat() {
# Format domain list as "192.168.x.x domain.com" # Format domain list as "192.168.x.x domain.com"
echo "::: Formatting domains into a HOSTS file..." echo "::: Formatting domains into a HOSTS file..."
if [[ -f /etc/hostname ]]; then
hostname=$(</etc/hostname) 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 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 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) # 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)