From fd2b24f2a01dab7177777658243c9797fde82dc8 Mon Sep 17 00:00:00 2001
From: jacobsalmela <jacob.salmela@gmail.com>
Date: Tue, 16 Jun 2015 11:15:15 -0500
Subject: [PATCH] preparing files for merge and for testing automated install

I haven't merged anything before, so hopefully, I won't mess it up too
bad!
---
 README.md                                     |  8 ++---
 advanced/{ => Scripts}/chronometer.sh         |  9 ++----
 advanced/index.html                           |  1 -
 advanced/lighttpd.conf                        | 17 ++++------
 .../basic-install.sh                          |  2 +-
 block hulu ads/lighttpd.conf                  | 32 +++++++++++++++++++
 block hulu ads/minidlna.conf                  |  6 ++++
 7 files changed, 53 insertions(+), 22 deletions(-)
 rename advanced/{ => Scripts}/chronometer.sh (66%)
 rename {advanced/automated instal => automated instal}/basic-install.sh (96%)
 create mode 100644 block hulu ads/lighttpd.conf
 create mode 100644 block hulu ads/minidlna.conf

diff --git a/README.md b/README.md
index a2c6af7a..9a0a9ed6 100644
--- a/README.md
+++ b/README.md
@@ -15,13 +15,13 @@ On a clean installation of Raspbian, you can run this command to **auto-install
 ```curl -s "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/automated%20install/basic-install.sh" | bash```
 
 ## Gravity
-The [gravity.sh](https://github.com/jacobsalmela/pi-hole/blob/master/gravity.sh) does most of the magic.  The script pulls in ad domains from many sources and compiles them into a single list of [over 900,000 entries](http://jacobsalmela.com/blocking-ads-from-120000-domains/).
-
-### How It Works
-A technical and detailed description can be found [here](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0)!
+The [gravity.sh](https://github.com/jacobsalmela/pi-hole/blob/master/gravity.sh) does most of the magic.  The script pulls in ad domains from many sources and compiles them into a single list of [over 900,000 entries](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0).
 
 ## Whitelist and blacklist
 You can add a `whitelist.txt` or `blacklist.txt` in `/etc/pihole/` and the script will apply those files automatically.
 
+### How It Works
+A technical and detailed description can be found [here](http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0)!
+
 ## Other Operating Systems
 This script will work for other UNIX-like systems with some slight **modifications**.  As long as you can install `dnsmasq` and a Webserver, it should work OK.  The automated install only works for a clean install of Raspiban right now since that is how the project originated.
\ No newline at end of file
diff --git a/advanced/chronometer.sh b/advanced/Scripts/chronometer.sh
similarity index 66%
rename from advanced/chronometer.sh
rename to advanced/Scripts/chronometer.sh
index a57038ec..353fc125 100755
--- a/advanced/chronometer.sh
+++ b/advanced/Scripts/chronometer.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 # Infinite loop that can be used to display ad domains on a Pi touch screen
-# It will continually display ads that are blocked in real time on the screen
+# Continually watch the log file and display ad domains that are blocked being blocked
 # Set the pi user to log in automatically and add run this script from .bashrc
 clear
 echo ""
@@ -13,10 +13,7 @@ echo "        Internet Ads   "
 echo ""
 echo "     http://pi-hole.net"
 echo ""
-echo "  Pi-hole IP: $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
-echo ""
-echo "Ads blocked will show up once"
-echo "you set your DNS server."
-echo ""
+echo "     $(ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -d':' -f2)"
 sleep 7
+# Look for only the entries that contain /etc/hosts, indicating the domain was found to be an advertisement
 tail -f /var/log/daemon.log | awk '/\/etc\/hosts/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/hosts") print $7; else;}'
\ No newline at end of file
diff --git a/advanced/index.html b/advanced/index.html
index 2049cfe9..6bfc7988 100644
--- a/advanced/index.html
+++ b/advanced/index.html
@@ -1,5 +1,4 @@
 <html>
 <body>
-<div style="height:1px; width:1px;"><img src="25Bytes.gif" height="1" width="1"></img></div>
 </body>
 </html>
\ No newline at end of file
diff --git a/advanced/lighttpd.conf b/advanced/lighttpd.conf
index e875897e..1c3ed076 100644
--- a/advanced/lighttpd.conf
+++ b/advanced/lighttpd.conf
@@ -1,13 +1,10 @@
 server.modules = (
 	"mod_expire",
-	"mod_access",
-	"mod_alias",
 	"mod_compress",
  	"mod_redirect",
-	"mod_auth",
 	"mod_rewrite"
 )
-
+ 
 server.document-root        = "/var/www"
 server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
 server.errorlog             = "/var/log/lighttpd/error.log"
@@ -15,26 +12,26 @@ server.pid-file             = "/var/run/lighttpd.pid"
 server.username             = "www-data"
 server.groupname            = "www-data"
 server.port                 = 80
-
-
+ 
+ 
 index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
 url.access-deny             = ( "~", ".inc" )
 static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
-
+ 
 compress.cache-dir          = "/var/cache/lighttpd/compress/"
 compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )
-
+ 
 # default listening port for IPv6 falls back to the IPv4 port
 include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
 include_shell "/usr/share/lighttpd/create-mime.assign.pl"
 include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
-
+ 
 # Set access to 1 day for better query performance when the list gets so large
 # http://jacobsalmela.com/raspberry-pi-block-ads-adtrap/#comment-2013820434
 $HTTP["url"] =~ "^/pihole/" {
         expire.url = ("" => "access plus 1 days")
 }
-
+ 
 # Rewrites all URLs to the /var/www/pihole/index.html
 $HTTP["host"] =~ ".*" {
      url.rewrite = (".*" => "pihole/index.html")
diff --git a/advanced/automated instal/basic-install.sh b/automated instal/basic-install.sh
similarity index 96%
rename from advanced/automated instal/basic-install.sh
rename to automated instal/basic-install.sh
index 3eee116c..43f9d663 100755
--- a/advanced/automated instal/basic-install.sh	
+++ b/automated instal/basic-install.sh	
@@ -53,7 +53,7 @@ sudo curl -o /var/www/pihole/index.html "https://raw.githubusercontent.com/jacob
 
 echo "Locating the Pi-hole..."
 sudo curl -o /usr/local/bin/gravity.sh "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/gravity.sh"
-sudo curl -o /usr/local/bin/chronometer.sh "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/chronometer.sh"
+sudo curl -o /usr/local/bin/chronometer.sh "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/scripts/chronometer.sh"
 sudo chmod 755 /usr/local/bin/gravity.sh
 sudo chmod 755 /usr/local/bin/chronometer.sh
 
diff --git a/block hulu ads/lighttpd.conf b/block hulu ads/lighttpd.conf
new file mode 100644
index 00000000..b22f599e
--- /dev/null
+++ b/block hulu ads/lighttpd.conf	
@@ -0,0 +1,32 @@
+server.modules = (
+	"mod_access",
+	"mod_alias",
+	"mod_compress",
+ 	"mod_redirect",
+   "mod_rewrite"
+)
+
+server.document-root        = "/var/www"
+server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
+server.errorlog             = "/var/log/lighttpd/error.log"
+server.pid-file             = "/var/run/lighttpd.pid"
+server.username             = "www-data"
+server.groupname            = "www-data"
+server.port                 = 80
+
+
+index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
+url.access-deny             = ( "~", ".inc" )
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+compress.cache-dir          = "/var/cache/lighttpd/compress/"
+compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )
+
+# default listening port for IPv6 falls back to the IPv4 port
+include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
+include_shell "/usr/share/lighttpd/create-mime.assign.pl"
+include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
+
+$HTTP["host"] =~ "ads.hulu.com|ads-v-darwin.hulu.com" {
+	url.redirect = ( ".*" => "http://192.168.1.101:8200/MediaItems/19.mov")
+}
diff --git a/block hulu ads/minidlna.conf b/block hulu ads/minidlna.conf
new file mode 100644
index 00000000..9eccc7b6
--- /dev/null
+++ b/block hulu ads/minidlna.conf	
@@ -0,0 +1,6 @@
+media_dir=V,/var/lib/minidlna/videos/
+port=8200
+friendly_name=pihole
+serial=12345678
+model_number=1
+inotify=yes
\ No newline at end of file