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!
This commit is contained in:
jacobsalmela 2015-06-16 11:15:15 -05:00
parent 655a584941
commit fd2b24f2a0
7 changed files with 53 additions and 22 deletions

View file

@ -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;}'

View file

@ -1,64 +0,0 @@
#!/bin/bash
# Pi-hole automated install
# Raspberry Pi Ad-blocker
#
# Install with this command (from the Pi):
#
# curl -s "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/automated%20install/basic-install.sh" | bash
#
# Or run the commands below in order
clear
echo " _____ _ _ _ "
echo " | __ (_) | | | | "
echo " | |__) | __ | |__ ___ | | ___ "
echo " | ___/ | |__| | '_ \ / _ \| |/ _ \ "
echo " | | | | | | | | (_) | | __/ "
echo " |_| |_| |_| |_|\___/|_|\___| "
echo " "
echo " Raspberry Pi Ad-blocker "
echo " "
echo "Set a static IP before running this!"
echo " "
echo " Press Enter when ready "
echo " "
read
echo "Updating the Pi..."
sudo apt-get update
sudo apt-get -y upgrade
echo "Installing DNS..."
sudo apt-get -y install dnsmasq
sudo update-rc.d dnsmasq enable
echo "Installing a Web server"
sudo apt-get -y install lighttpd
sudo chown www-data:www-data /var/www
sudo chmod 775 /var/www
sudo usermod -a -G www-data pi
echo "Stopping services to modify them..."
sudo service dnsmasq stop
sudo service lighttpd stop
echo "Backing up original config files and downloading Pi-hole ones..."
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
sudo mv /var/www/index.lighttpd.html /var/www/index.lighttpd.orig
sudo curl -o /etc/dnsmasq.conf "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/dnsmasq.conf"
sudo curl -o /etc/lighttpd/lighttpd.conf "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf"
sudo mkdir /var/www/pihole
sudo curl -o /var/www/pihole/index.html "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html"
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 chmod 755 /usr/local/bin/gravity.sh
sudo chmod 755 /usr/local/bin/chronometer.sh
echo "Entering the event horizon..."
sudo /usr/local/bin/gravity.sh
echo "Restarting..."
sudo shutdown -r now

View file

@ -1,5 +1,4 @@
<html>
<body>
<div style="height:1px; width:1px;"><img src="25Bytes.gif" height="1" width="1"></img></div>
</body>
</html>

View file

@ -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")