mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +00:00
improvements to git functions (passing parameters). Added >/dev/null to attempt to supress output from apt-get upgrade
This commit is contained in:
parent
cf3aea8075
commit
1563146918
1 changed files with 26 additions and 29 deletions
|
@ -44,6 +44,7 @@ dhcpcdFile=/etc/dhcpcd.conf
|
||||||
|
|
||||||
######## FIRST CHECK ########
|
######## FIRST CHECK ########
|
||||||
# Must be root to install
|
# Must be root to install
|
||||||
|
echo ":::"
|
||||||
if [[ $EUID -eq 0 ]];then
|
if [[ $EUID -eq 0 ]];then
|
||||||
echo "You are root."
|
echo "You are root."
|
||||||
else
|
else
|
||||||
|
@ -298,10 +299,10 @@ checkForDependencies(){
|
||||||
echo ":::"
|
echo ":::"
|
||||||
#update package lists
|
#update package lists
|
||||||
echo -n "::: Updating package list before install...."
|
echo -n "::: Updating package list before install...."
|
||||||
$SUDO apt-get -qq update & spinner $!
|
$SUDO apt-get -qq update > /dev/null & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
echo -n "::: Upgrading installed apt-get packages...."
|
echo -n "::: Upgrading installed apt-get packages...."
|
||||||
$SUDO apt-get -y -qq upgrade & spinner $!
|
$SUDO apt-get -y -qq upgrade > /dev/null & spinner $!
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
|
@ -326,55 +327,51 @@ checkForDependencies(){
|
||||||
getGitFiles(){
|
getGitFiles(){
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
dirToCheck=$piholeFilesDir
|
echo "::: Checking for existing base files..."
|
||||||
echo -n "::: Checking for existing base files..."
|
if is_repo $piholeFilesDir; then
|
||||||
if ! is_repo; then
|
make_repo $piholeFilesDir $piholeGitUrl
|
||||||
echo -n " Not found! Getting files from github...."
|
|
||||||
repoToClone=$piholeGitUrl
|
|
||||||
make_repo
|
|
||||||
echo " done!"
|
|
||||||
else
|
else
|
||||||
echo -n " Existing files found. Grabbing latest...."
|
update_repo $piholeFilesDir
|
||||||
update_repo
|
|
||||||
echo " done!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ":::"
|
echo ":::"
|
||||||
dirToCheck=$webInterfaceDir
|
echo "::: Checking for existing web interface..."
|
||||||
echo -n "::: Checking for existing web interface..."
|
if is_repo $webInterfaceDir; then
|
||||||
if ! is_repo; then
|
make_repo $webInterfaceDir $webInterfaceGitUrl
|
||||||
echo -n " Not found! Getting files from github...."
|
|
||||||
repoToClone=$webInterfaceGitUrl
|
|
||||||
make_repo
|
|
||||||
echo " done!"
|
|
||||||
else
|
else
|
||||||
echo -n " Existing files found. Grabbing latest..."
|
update_repo $webInterfaceDir
|
||||||
update_repo
|
|
||||||
echo " done!"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
is_repo() {
|
is_repo() {
|
||||||
|
echo -n "::: Checking $1 is a repo..."
|
||||||
# if the directory does not have a .git folder
|
# if the directory does not have a .git folder
|
||||||
# it is not a repo
|
# it is not a repo
|
||||||
if [ ! -d "$dirToCheck/.git" ]; then
|
if [ -d "$1/.git" ]; then
|
||||||
|
echo " OK!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
echo " not found!!"
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
make_repo() {
|
make_repo() {
|
||||||
# remove the non-repod interface and clone the interface
|
# remove the non-repod interface and clone the interface
|
||||||
|
echo -n "::: Cloning $2 into $1..."
|
||||||
$SUDO rm -rf $dirToCheck
|
$SUDO rm -rf $1
|
||||||
$SUDO git clone -q "$repoToClone" "$dirToCheck" > /dev/null & spinner $!
|
$SUDO git clone -q "$2" "$1" > /dev/null & spinner $!
|
||||||
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_repo() {
|
update_repo() {
|
||||||
# pull the latest commits
|
# pull the latest commits
|
||||||
cd "$dirToCheck"
|
echo -n "::: Updating repo in $1..."
|
||||||
|
cd "$1"
|
||||||
$SUDO git pull -q > /dev/null & spinner $!
|
$SUDO git pull -q > /dev/null & spinner $!
|
||||||
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue