1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Removed extra blank space if no IP added

This commit is contained in:
Jofre Palau 2015-09-28 17:40:13 +02:00
parent 885069d440
commit 4ea397bc71

View File

@ -5,8 +5,8 @@
# This script should only be run after you have a static IP address set on the Pi # This script should only be run after you have a static IP address set on the Pi
piholeIP="$1" piholeIP="$1"
if [[ "$piholeIP" == "" ]]; then if [ -n "$piholeIP"]; then
piholeIP=$(hostname -I) piholeIP=$(hostname -I|xargs)
fi fi
@ -133,7 +133,7 @@ function gravity_advanced()
echo "** $numberOf unique domains trapped in the event horizon." echo "** $numberOf unique domains trapped in the event horizon."
# 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..."
cat $origin/$eventHorizon | awk '{sub(/\r$/,""); print "'"$piholeIP "'" $0}' > $origin/$accretionDisc cat $origin/$eventHorizon | awk '{sub(/\r$/,""); print "'"$piholeIP "'" $0}' > $origin/$accretionDisc
# Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it # Copy the file over as /etc/pihole/gravity.list so dnsmasq can use it
sudo cp $origin/$accretionDisc $adList sudo cp $origin/$accretionDisc $adList
kill -HUP $(pidof dnsmasq) kill -HUP $(pidof dnsmasq)