Merge github.com:pi-hole/pi-hole into UninstallFix

This commit is contained in:
Promofaux 2016-02-11 14:49:46 +00:00
commit 6ff2b04dfb
3 changed files with 45 additions and 34 deletions

View file

@ -1,11 +1,18 @@
# Automated Install # Automated Install
##### Designed For Raspberry Pi B, B+, 2, and Zero (with an Ethernet adapter) ##### Designed For Raspberry Pi A+, B, B+, 2, and Zero (with an Ethernet adapter)
1. Install Raspbian 1. Install Raspbian
2. Run the command below 2. Run the command below
### ```curl -L install.pi-hole.net | bash``` ### ```curl -L install.pi-hole.net | bash```
#### Alternative Semi-Automated install ####
```
wget -O basic-install.sh install.pi-hole.net
chmod +x basic-install.sh
./basic-install.sh
```
Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/). Once installed, [configure your router to have **DHCP clients use the Pi as their DNS server**](http://pi-hole.net/faq/can-i-set-the-pi-hole-to-be-the-dns-server-at-my-router-so-i-dont-have-to-change-settings-for-my-devices/) and then any device that connects to your network will have ads blocked without any further configuration. Alternatively, you can manually set each device to [use the Raspberry Pi as its DNS server](http://pi-hole.net/faq/how-do-i-use-the-pi-hole-as-my-dns-server/).
## Pi-hole Is Free, But Powered By Your Donations ## Pi-hole Is Free, But Powered By Your Donations

View file

@ -303,35 +303,40 @@ setDNS(){
} }
versionCheckDNSmasq(){ versionCheckDNSmasq(){
# Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory # Check if /etc/dnsmasq.conf is from pihole. If so replace with an original and install new in .d directory
dnsFile1="/etc/dnsmasq.conf" dnsFile1="/etc/dnsmasq.conf"
dnsFile2="/etc/dnsmasq.conf.orig" dnsFile2="/etc/dnsmasq.conf.orig"
dnsSearch="addn-hosts=/etc/pihole/gravity.list" dnsSearch="addn-hosts=/etc/pihole/gravity.list"
# Check if /etc/dnsmasq.conf exists defaultFile="/etc/.pihole/advanced/dnsmasq.conf.original"
if [ -d "/etc/dnsmasq.conf" ]; then newFileToInstall="/etc/.pihole/advanced/01-pihole.conf"
# If true, Check dnsmasq.conf for pihole magic newFileFinalLocation="/etc/dnsmasq.d/01-pihole.conf"
if grep -q $dnsSearch $dnsFile1; then
# If true, Check dnsmasq.conf.orig for pihole magic
if grep -q $dnsSearch $dnsFile2; then
# If true, use advanced/dnsmasq.conf.original
$SUDO mv -f /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
else
# If false, mv original file back
$SUDO mv -f /etc/dnsmasq.conf.orig /etc/dnsmasq.conf
fi
# If false, This is a fresh install
fi
else
# If false, use advanced/dnsmasq.conf.original
$SUDO cp /etc/.pihole/advanced/dnsmasq.conf.original /etc/dnsmasq.conf
fi
$SUDO cp /etc/.pihole/advanced/01-pihole.conf /etc/dnsmasq.d/01-pihole.conf if [ -f $dnsFile1 ]; then
$SUDO sed -i "s/@INT@/$piholeInterface/" /etc/dnsmasq.d/01-pihole.conf echo -n "::: Existing dnsmasq.conf found..."
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" /etc/dnsmasq.d/01-pihole.conf if grep -q $dnsSearch $dnsFile1; then
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" /etc/dnsmasq.d/01-pihole.conf echo " it is from a previous pi-hole install."
echo -n "::: Backing up dnsmasq.conf to dnsmasq.conf.orig..."
$SUDO mv -f $dnsFile1 $dnsFile2
echo " done."
echo -n "::: Restoring default dnsmasq.conf..."
$SUDO cp $defaultFile $dnsFile1
echo " done."
else
echo " it is not a pi-hole file, leaving alone!"
fi
else
echo -n "::: No dnsmasq.conf found.. restoring default dnsmasq.conf..."
$SUDO cp $defaultFile $dnsFile1
echo " done."
fi
echo -n "::: Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf..."
$SUDO cp $newFileToInstall $newFileFinalLocation
echo " done."
$SUDO sed -i "s/@INT@/$piholeInterface/" $newFileFinalLocation
$SUDO sed -i "s/@DNS1@/$piholeDNS1/" $newFileFinalLocation
$SUDO sed -i "s/@DNS2@/$piholeDNS2/" $newFileFinalLocation
} }
installScripts() { installScripts() {
@ -351,11 +356,10 @@ installScripts() {
installConfigs() { installConfigs() {
# Install the configs from /etc/.pihole to their various locations # Install the configs from /etc/.pihole to their various locations
$SUDO echo ":::" $SUDO echo ":::"
$SUDO echo -n "::: Installing configs..." $SUDO echo "::: Installing configs..."
versionCheckDNSmasq versionCheckDNSmasq
$SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig $SUDO mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
$SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf $SUDO cp /etc/.pihole/advanced/lighttpd.conf /etc/lighttpd/lighttpd.conf
$SUDO echo " done."
} }
stopServices() { stopServices() {
@ -389,7 +393,7 @@ checkForDependencies() {
fi fi
echo ":::" echo ":::"
echo -n "::: Checking apt-get for upgraded packages...." echo -n "::: Checking apt-get for upgraded packages...."
updatesToInstall=$(sudo apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst) updatesToInstall=$($SUDO apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst)
echo " done!" echo " done!"
echo ":::" echo ":::"
if [[ $updatesToInstall -eq "0" ]]; then if [[ $updatesToInstall -eq "0" ]]; then

View file

@ -38,6 +38,6 @@ include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
$HTTP["host"] =~ "ads.hulu.com|ads-v-darwin.hulu.com" { $HTTP["host"] =~ "ads.hulu.com|ads-v-darwin.hulu.com|ads-e-darwin.hulu.com" {
url.redirect = ( ".*" => "http://192.168.1.101:8200/MediaItems/19.mov") url.redirect = ( ".*" => "http://192.168.1.101:8200/MediaItems/19.mov")
} }