2016-01-10 19:08:29 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-01-30 20:12:40 +00:00
|
|
|
# Pi-hole: A black hole for Internet advertisements
|
|
|
|
# (c) 2015, 2016 by Jacob Salmela
|
|
|
|
# Network-wide ad blocking via your Raspberry Pi
|
|
|
|
# http://pi-hole.net
|
|
|
|
# Updates the Pi-hole web interface
|
2016-01-10 19:08:29 +00:00
|
|
|
#
|
2016-01-30 20:12:40 +00:00
|
|
|
# Pi-hole is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
2016-01-10 19:08:29 +00:00
|
|
|
|
2016-03-15 01:04:09 +00:00
|
|
|
source /etc/pihole/Functions/pihole.var
|
|
|
|
source /etc/pihole/Functions/pihole.funcs
|
|
|
|
source /etc/pihole/Functions/git.funcs
|
2016-01-10 19:08:29 +00:00
|
|
|
|
|
|
|
main() {
|
|
|
|
prerequisites
|
2016-03-15 01:04:09 +00:00
|
|
|
if ! is_repo $webInterfaceDir; then
|
|
|
|
make_repo $webInterfaceDir $webInterfaceGitUrl
|
2016-01-10 19:08:29 +00:00
|
|
|
fi
|
2016-03-15 01:04:09 +00:00
|
|
|
update_repo $webInterfaceDir
|
2016-01-10 19:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
prerequisites() {
|
2016-03-15 01:04:09 +00:00
|
|
|
# must be root to update
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
sudo bash "$0" "$@"
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
# web interface must already exist. this is a (lazy)
|
|
|
|
# check to make sure pihole is actually installed.
|
|
|
|
if [ ! -d "$webInterfaceDir" ]; then
|
|
|
|
echo "$webInterfaceDir not found. Exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! type "git" > /dev/null; then
|
|
|
|
apt-get -y install git
|
|
|
|
fi
|
2016-01-10 19:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|