mirror of
https://github.com/moparisthebest/pi-hole
synced 2024-12-22 07:08:49 -05:00
Breakout basic-install.sh to functions
This commit is contained in:
parent
2193d6a81f
commit
9421366e4f
@ -148,6 +148,7 @@ else
|
||||
# If the settings are correct, then we need to set the piholeIP
|
||||
# Saving it to a temporary file us to retrieve it later when we run the gravity.sh script
|
||||
echo ${IPv4addr%/*} > /tmp/piholeIP
|
||||
echo $piholeInterface > /tmp/piholeINT
|
||||
# After that's done, the loop ends and we move on
|
||||
ipSettingsCorrect=True
|
||||
else
|
||||
@ -182,45 +183,71 @@ static domain_name_servers=$IPv4gw" | sudo tee -a $dhcpcdFile >/dev/null
|
||||
sudo ip addr replace dev $piholeInterface $IPv4addr
|
||||
}
|
||||
|
||||
installPihole()
|
||||
{
|
||||
installScripts(){
|
||||
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/Scripts/chronometer.sh
|
||||
sudo curl -o /usr/local/bin/whitelist.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/whitelist.sh
|
||||
sudo curl -o /usr/local/bin/piholeLogFlush.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/piholeLogFlush.sh
|
||||
sudo chmod 755 /usr/local/bin/{gravity,chronometer,whitelist,piholeLogFlush}.sh
|
||||
}
|
||||
|
||||
installConfigs(){
|
||||
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.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
|
||||
}
|
||||
|
||||
stopServices(){
|
||||
sudo service dnsmasq stop || true
|
||||
sudo service lighttpd stop || true
|
||||
}
|
||||
|
||||
installDependencies(){
|
||||
sudo apt-get update
|
||||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install dnsutils bc toilet
|
||||
sudo apt-get -y install dnsmasq
|
||||
sudo apt-get -y install lighttpd php5-common php5-cgi php5
|
||||
sudo mkdir /var/www/html
|
||||
sudo chown www-data:www-data /var/www/html
|
||||
sudo chmod 775 /var/www/html
|
||||
sudo usermod -a -G www-data pi
|
||||
sudo service dnsmasq stop
|
||||
sudo service lighttpd stop
|
||||
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
||||
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
||||
sudo mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
||||
sudo mv /etc/crontab /etc/crontab.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 mv /etc/crontab /etc/crontab.orig
|
||||
sudo curl -o /etc/crontab https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/pihole.cron
|
||||
sudo lighty-enable-mod fastcgi fastcgi-php
|
||||
sudo mkdir /var/www/html/pihole
|
||||
sudo curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
|
||||
}
|
||||
|
||||
installWebAdmin(){
|
||||
sudo wget https://github.com/jacobsalmela/AdminLTE/archive/master.zip -O /var/www/master.zip
|
||||
sudo unzip -o /var/www/master.zip -d /var/www/html/
|
||||
sudo unzip -oq /var/www/master.zip -d /var/www/html/
|
||||
sudo mv /var/www/html/AdminLTE-master /var/www/html/admin
|
||||
sudo rm /var/www/master.zip 2>/dev/null
|
||||
}
|
||||
|
||||
installPiholeWeb(){
|
||||
sudo mkdir /var/www/html/pihole
|
||||
sudo mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
||||
sudo curl -o /var/www/html/pihole/index.html https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html
|
||||
}
|
||||
|
||||
installCron(){
|
||||
sudo mv /etc/crontab /etc/crontab.orig
|
||||
sudo curl -o /etc/crontab https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/pihole.cron
|
||||
}
|
||||
|
||||
installPiLog(){
|
||||
sudo touch /var/log/pihole.log
|
||||
sudo chmod 644 /var/log/pihole.log
|
||||
sudo chown dnsmasq:root /var/log/pihole.log
|
||||
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/Scripts/chronometer.sh
|
||||
sudo curl -o /usr/local/bin/whitelist.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/whitelist.sh
|
||||
sudo curl -o /usr/local/bin/piholeLogFlush.sh https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/piholeLogFlush.sh
|
||||
sudo chmod 755 /usr/local/bin/gravity.sh
|
||||
sudo chmod 755 /usr/local/bin/chronometer.sh
|
||||
sudo chmod 755 /usr/local/bin/whitelist.sh
|
||||
sudo chmod 755 /usr/local/bin/piholeLogFlush.sh
|
||||
}
|
||||
installPihole()
|
||||
{
|
||||
installDependencies
|
||||
stopServices
|
||||
sudo chown www-data:www-data /var/www/html
|
||||
sudo chmod 775 /var/www/html
|
||||
sudo usermod -a -G www-data pi
|
||||
sudo lighty-enable-mod fastcgi fastcgi-php
|
||||
installScripts
|
||||
installConfigs
|
||||
installWebAdmin
|
||||
installPiholeWeb
|
||||
installCron
|
||||
installPiLog
|
||||
sudo /usr/local/bin/gravity.sh
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user