mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-24 23:23:42 +00:00
Improved installer and updated scripts
This commit is contained in:
parent
2a34daafb9
commit
9e8ffc48da
7 changed files with 40 additions and 60 deletions
|
@ -10,8 +10,6 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
source pihole.var
|
|
||||||
|
|
||||||
RootCheck(){
|
RootCheck(){
|
||||||
echo ":::"
|
echo ":::"
|
||||||
if [[ $EUID -eq 0 ]];then
|
if [[ $EUID -eq 0 ]];then
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
source /etc/pihole/Functions/pihole.var
|
||||||
source /etc/pihole/Functions/pihole.funcs
|
source /etc/pihole/Functions/pihole.funcs
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
if [[ $# = 0 ]]; then
|
||||||
|
|
|
@ -10,60 +10,35 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
WEB_INTERFACE_GIT_URL="https://github.com/pi-hole/AdminLTE.git"
|
source /etc/pihole/Functions/pihole.var
|
||||||
WEB_INTERFACE_DIR="/var/www/html/admin"
|
source /etc/pihole/Functions/pihole.funcs
|
||||||
|
source /etc/pihole/Functions/git.funcs
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
prerequisites
|
prerequisites
|
||||||
if ! is_repo; then
|
if ! is_repo $webInterfaceDir; then
|
||||||
make_repo
|
make_repo $webInterfaceDir $webInterfaceGitUrl
|
||||||
fi
|
fi
|
||||||
update_repo
|
update_repo $webInterfaceDir
|
||||||
}
|
}
|
||||||
|
|
||||||
prerequisites() {
|
prerequisites() {
|
||||||
|
# must be root to update
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
sudo bash "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
# must be root to update
|
# web interface must already exist. this is a (lazy)
|
||||||
if [[ $EUID -ne 0 ]]; then
|
# check to make sure pihole is actually installed.
|
||||||
sudo bash "$0" "$@"
|
if [ ! -d "$webInterfaceDir" ]; then
|
||||||
exit $?
|
echo "$webInterfaceDir not found. Exiting."
|
||||||
fi
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# web interface must already exist. this is a (lazy)
|
if ! type "git" > /dev/null; then
|
||||||
# check to make sure pihole is actually installed.
|
apt-get -y install git
|
||||||
if [ ! -d "$WEB_INTERFACE_DIR" ]; then
|
fi
|
||||||
echo "$WEB_INTERFACE_DIR not found. Exiting."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! type "git" > /dev/null; then
|
|
||||||
apt-get -y install git
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
is_repo() {
|
|
||||||
# if the web interface directory does not have a .git folder
|
|
||||||
# it means its using the master.zip archive from the install
|
|
||||||
# script.
|
|
||||||
if [ ! -d "$WEB_INTERFACE_DIR/.git" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# removes the web interface installed from the master.zip archive and
|
|
||||||
# replaces it with the current master branch from github
|
|
||||||
make_repo() {
|
|
||||||
# remove the non-repod interface and clone the interface
|
|
||||||
rm -rf $WEB_INTERFACE_DIR
|
|
||||||
git clone "$WEB_INTERFACE_GIT_URL" "$WEB_INTERFACE_DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
# pulls the latest master branch from github
|
|
||||||
update_repo() {
|
|
||||||
# pull the latest commits
|
|
||||||
cd "$WEB_INTERFACE_DIR"
|
|
||||||
git pull
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
# the Free Software Foundation, either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
|
source /etc/pihole/Functions/pihole.var
|
||||||
source /etc/pihole/Functions/pihole.funcs
|
source /etc/pihole/Functions/pihole.funcs
|
||||||
|
|
||||||
if [[ $# = 0 ]]; then
|
if [[ $# = 0 ]]; then
|
||||||
|
|
|
@ -11,14 +11,19 @@
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
|
|
||||||
# Get files, as they might have changed
|
# Get files, as they might have changed
|
||||||
curl -o $HOME/piholeInstall/pihole.var https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/Functions/pihole.var
|
if [ ! -d /tmp/piholeInstall ]; then
|
||||||
curl -o $HOME/piholeInstall/pihole.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/Functions/pihole.funcs
|
mkdir -p /tmp/piholeInstall
|
||||||
curl -o $HOME/piholeInstall/install.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/Functions/install.funcs
|
fi
|
||||||
curl -o $HOME/piholeInstall/git.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/master/advanced/Functions/git.funcs
|
|
||||||
|
|
||||||
source $HOME/piholeInstall/pihole.funcs
|
curl -o /tmp/piholeInstall/pihole.var https://raw.githubusercontent.com/pi-hole/pi-hole/ExportVariables/advanced/Functions/pihole.var
|
||||||
source $HOME/piholeInstall/install.funcs
|
#curl -o /tmp/piholeInstall/pihole.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/ExportVariables/advanced/Functions/pihole.funcs
|
||||||
source $HOME/piholeInstall/git.funcs
|
curl -o /tmp/piholeInstall/install.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/ExportVariables/advanced/Functions/install.funcs
|
||||||
|
curl -o /tmp/piholeInstall/git.funcs https://raw.githubusercontent.com/pi-hole/pi-hole/ExportVariables/advanced/Functions/git.funcs
|
||||||
|
|
||||||
|
source /tmp/piholeInstall/pihole.var
|
||||||
|
source /tmp/piholeInstall/pihole.funcs
|
||||||
|
source /tmp/piholeInstall/install.funcs
|
||||||
|
source /tmp/piholeInstall/git.funcs
|
||||||
|
|
||||||
###########Begin Script
|
###########Begin Script
|
||||||
RootCheck
|
RootCheck
|
||||||
|
@ -27,7 +32,7 @@ if [ ! -d /etc/pihole ];then
|
||||||
$SUDO mkdir -p /etc/pihole/
|
$SUDO mkdir -p /etc/pihole/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Display the welcome dialogs
|
# Display the welcome dialogs
|
||||||
welcomeDialogs
|
welcomeDialogs
|
||||||
|
|
||||||
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
# Just back up the original Pi-hole right away since it won't take long and it gets it out of the way
|
||||||
|
|
Loading…
Reference in a new issue