mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 06:10:20 +00:00
Makes blocklists world readable
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
2e6198077d
commit
a3d2a1062f
1 changed files with 6 additions and 0 deletions
|
@ -328,6 +328,7 @@ gravity_DownloadBlocklistFromUrl() {
|
||||||
# Parse source files into domains format
|
# Parse source files into domains format
|
||||||
gravity_ParseFileIntoDomains() {
|
gravity_ParseFileIntoDomains() {
|
||||||
local source="${1}" destination="${2}" firstLine abpFilter
|
local source="${1}" destination="${2}" firstLine abpFilter
|
||||||
|
chmod 644 "${source}"
|
||||||
|
|
||||||
# Determine if we are parsing a consolidated list
|
# Determine if we are parsing a consolidated list
|
||||||
if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
|
if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
|
||||||
|
@ -345,6 +346,7 @@ gravity_ParseFileIntoDomains() {
|
||||||
sed -r '/(\/|#).*$/d' | \
|
sed -r '/(\/|#).*$/d' | \
|
||||||
sed -r 's/^.*\s+//g' | \
|
sed -r 's/^.*\s+//g' | \
|
||||||
sed -r '/([^\.]+\.)+[^\.]{2,}/!d' > "${destination}"
|
sed -r '/([^\.]+\.)+[^\.]{2,}/!d' > "${destination}"
|
||||||
|
chmod 644 "${destination}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -375,6 +377,7 @@ gravity_ParseFileIntoDomains() {
|
||||||
if($0 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { $0="" }
|
if($0 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { $0="" }
|
||||||
if($0) { print $0 }
|
if($0) { print $0 }
|
||||||
}' "${source}" > "${destination}"
|
}' "${source}" > "${destination}"
|
||||||
|
chmod 644 "${destination}"
|
||||||
|
|
||||||
# Determine if there are Adblock exception rules
|
# Determine if there are Adblock exception rules
|
||||||
# https://adblockplus.org/filters
|
# https://adblockplus.org/filters
|
||||||
|
@ -391,6 +394,7 @@ gravity_ParseFileIntoDomains() {
|
||||||
|
|
||||||
# Remove exceptions
|
# Remove exceptions
|
||||||
comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}"
|
comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}"
|
||||||
|
chmod 644 "${source}"
|
||||||
mv "${source}" "${destination}"
|
mv "${source}" "${destination}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -427,6 +431,7 @@ gravity_ParseFileIntoDomains() {
|
||||||
gravity_Cleanup "error"
|
gravity_Cleanup "error"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
chmod 644 "${destination}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create (unfiltered) "Matter and Light" consolidated list
|
# Create (unfiltered) "Matter and Light" consolidated list
|
||||||
|
@ -440,6 +445,7 @@ gravity_ConsolidateDownloadedBlocklists() {
|
||||||
|
|
||||||
# Empty $matterAndLight if it already exists, otherwise, create it
|
# Empty $matterAndLight if it already exists, otherwise, create it
|
||||||
: > "${piholeDir}/${matterAndLight}"
|
: > "${piholeDir}/${matterAndLight}"
|
||||||
|
chmod 644 "${piholeDir}/${matterAndLight}"
|
||||||
|
|
||||||
# Loop through each *.domains file
|
# Loop through each *.domains file
|
||||||
for i in "${activeDomains[@]}"; do
|
for i in "${activeDomains[@]}"; do
|
||||||
|
|
Loading…
Reference in a new issue