Merge pull request #1041 from pi-hole/development

[RELEASE] Pi-Hole Core 2.10.2
This commit is contained in:
Adam Warner 2016-12-25 23:43:35 +00:00 committed by GitHub
commit 739aaafa9a
3 changed files with 21 additions and 11 deletions

24
advanced/Scripts/update.sh Normal file → Executable file
View file

@ -22,9 +22,15 @@ readonly PI_HOLE_FILES_DIR="/etc/.pihole"
is_repo() { is_repo() {
# Use git to check if directory is currently under VCS, return the value # Use git to check if directory is currently under VCS, return the value
local directory="${1}" local directory="${1}"
local curdir
local rc
git -C "${directory}" status --short &> /dev/null curdir="${PWD}"
return cd "${directory}" &> /dev/null || return 1
git status --short &> /dev/null
rc=$?
cd "${curdir}" &> /dev/null || return 1
return $rc
} }
prep_repo() { prep_repo() {
@ -46,16 +52,20 @@ make_repo() {
update_repo() { update_repo() {
local directory="${1}" local directory="${1}"
local retVal=0 local curdir
# Pull the latest commits # Pull the latest commits
curdir="${PWD}"
cd "${directory}" &> /dev/null || return 1
# Stash all files not tracked for later retrieval # Stash all files not tracked for later retrieval
git -C "${directory}" stash --all --quiet &> /dev/null || ${retVal}=1 git stash --all --quiet &> /dev/null
# Force a clean working directory for cloning # Force a clean working directory for cloning
git -C "${directory}" clean --force -d &> /dev/null || ${retVal}=1 git clean --force -d &> /dev/null
# Fetch latest changes and apply # Fetch latest changes and apply
git -C "${directory}" pull --quiet &> /dev/null || ${retVal}=1 git pull --quiet &> /dev/null
return ${retVal} cd "${curdir}" &> /dev/null || return 1
return
} }
getGitFiles() { getGitFiles() {

View file

@ -61,6 +61,7 @@ SetWebPassword(){
echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf
echo "New password set" echo "New password set"
else else
echo "WEBPASSWORD=" >> /etc/pihole/setupVars.conf
echo "Password removed" echo "Password removed"
fi fi

View file

@ -13,15 +13,14 @@
# scripts, any changes made to this file will be overwritten when the softare # scripts, any changes made to this file will be overwritten when the softare
# is updated or re-installed. Please make any changes to the appropriate crontab # is updated or re-installed. Please make any changes to the appropriate crontab
# or other cron file snippets. # or other cron file snippets.
PATH="$PATH:/usr/local/bin/"
# Pi-hole: Update the ad sources once a week on Sunday at 01:59 # Pi-hole: Update the ad sources once a week on Sunday at 01:59
# Download any updates from the adlists # Download any updates from the adlists
59 1 * * 7 root pihole updateGravity 59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity
# Pi-hole: Update Pi-hole! Uncomment to enable auto update # Pi-hole: Update Pi-hole! Uncomment to enable auto update
#30 2 * * 7 root pihole updatePihole #30 2 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updatePihole
# Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control # Pi-hole: Flush the log daily at 00:00 so it doesn't get out of control
# Stats will be viewable in the Web interface thanks to the cron job above # Stats will be viewable in the Web interface thanks to the cron job above
00 00 * * * root pihole flush 00 00 * * * root PATH="$PATH:/usr/local/bin/" pihole flush