Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Shell Script for DSM 7.0 and above #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ad-blocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fetch_blocklist () {
# the "-O-" tells wget to send the file to standard out instead of a real file
# this makes it suitable for piping and eliminates need for another temp file
wget -O- "$BlocklistURL" | \
sed -e 's/null.zone.file/\/etc\/zone\/master\/null.zone.file/g' > "/tmp/ad-blocker.new"
sed -e 's/null.zone.file/\/var\/packages\/DNSServer\/target\/named\/etc\/zone\/master\/null.zone.file/g' > "/tmp/ad-blocker.new"
}

# user-specified list of domains to be blocked in addition to those from yoyo.org
Expand Down Expand Up @@ -156,10 +156,10 @@ update_zone_data () {
# check for the include statement in the ZoneDataFile
# if it is present do nothing, else append the include statement to the ZoneDataFile
if [ -f "$ZoneDataDB" ] && [ -f "$ZoneDataFile" ]; then
Matches=$(grep 'include "/etc/zone/data/ad-blocker.db";' "$ZoneDataFile")
Matches=$(grep 'include "'${ZoneDataDir}'/ad-blocker.db";' "$ZoneDataFile")
if [ -z "$Matches" ]; then
echo '' >> "$ZoneDataFile"
echo 'include "/etc/zone/data/ad-blocker.db";' >> "$ZoneDataFile"
echo 'include "'${ZoneDataDir}'/ad-blocker.db";' >> "$ZoneDataFile"
fi
fi
}
Expand All @@ -186,7 +186,7 @@ update_zone_master () {
echo '* IN A 127.0.0.1'; } > "$ZoneMasterFile"

# reload the server config to pick up the changes
"${RootDir}"/script/reload.sh
"${RootDir}"/script/reload.sh null.zone.file
}

# Global vars for common paths
Expand Down