build auto-update

This commit is contained in:
Zelo72 2021-11-01 17:14:11 +01:00
parent eda6702a86
commit bb7dca9f9c
2 changed files with 332 additions and 299 deletions

File diff suppressed because it is too large Load Diff

View File

@ -127,8 +127,10 @@ getRegexDomainsFromWilcardList() {
convertWildcardToRegex "$list" >>"$2" convertWildcardToRegex "$list" >>"$2"
done <"$1" done <"$1"
sortList "$2" sortList "$2"
if inConfig "debug"; then
cp "$2" "$2".regex cp "$2" "$2".regex
fi fi
fi
} }
convertWildcardToRegex() { convertWildcardToRegex() {
@ -141,7 +143,6 @@ convertWildcardToRegex() {
sort -u tmp sort -u tmp
rm -f tmp rm -f tmp
#cat <"$1" | sed -e 's/^[[:space:]]*//' | grep -Ev '^\s*$|^#|^!' | awk '{print $1}' | grep -E '^\*\.|^\.' | sed 's/^\*//' | sed 's/^.//' | sed 's/\./\\./g' | sed -e 's/^/\(\\.\|\^\)/' | sed -e 's/$/\$/'
} }
extractValidDomains() { extractValidDomains() {
@ -235,8 +236,9 @@ printDecCount() {
removeDomains() { removeDomains() {
if [ -s "$1" ] && [ -s "$2" ]; then if [ -s "$1" ] && [ -s "$2" ]; then
comm -13 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >"$2.tmp" comm -13 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >"$2.tmp"
if inConfig "debug"; then
comm -12 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >>"$1.removed" comm -12 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >>"$1.removed"
#grep -Fvx -f "$1" "$2" >"$2.tmp" fi
mv "$2.tmp" "$2" mv "$2.tmp" "$2"
rm "$1" rm "$1"
fi fi
@ -260,7 +262,9 @@ removeDomainsWildcard() {
addDomains() { addDomains() {
if [ -s "$1" ]; then if [ -s "$1" ]; then
if inConfig "debug"; then
comm -23 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >"$1.added" comm -23 <(tr '[:upper:]' '[:lower:]' <"$1" | sort) <(tr '[:upper:]' '[:lower:]' <"$2" | sort) | awk '{print $1}' >"$1.added"
fi
cat <"$1" | sed -e 's/^[[:space:]]*//' | grep -Ev '^\s*$|^#|^!' | awk '{print $1}' | grep -P "$regex" >>"$2" cat <"$1" | sed -e 's/^[[:space:]]*//' | grep -Ev '^\s*$|^#|^!' | awk '{print $1}' | grep -P "$regex" >>"$2"
sortList "$2" sortList "$2"
rm "$1" rm "$1"
@ -505,7 +509,9 @@ echo ""
printDecCount printDecCount
# Save unique domain list # Save unique domain list
if inConfig "unique"; then
cp "$domains" "$domains".unique cp "$domains" "$domains".unique
fi
# Add Domains from personal Blacklists # Add Domains from personal Blacklists
if [ -s "$black" ]; then if [ -s "$black" ]; then
@ -529,7 +535,9 @@ echo ""
fi fi
# Save domain list for later dead domains check # Save domain list for later dead domains check
if inConfig "checkfordead"; then
cp "$domains" "$domains".checkfordead cp "$domains" "$domains".checkfordead
fi
# Remove whitelisted Domains # Remove whitelisted Domains
if [ -s "$white" ]; then if [ -s "$white" ]; then
@ -553,7 +561,7 @@ echo ""
# Remove wildcard whitelisted Domains # Remove wildcard whitelisted Domains
if [ -s "$white" ]; then if [ -s "$white" ]; then
cat <"$white" | grep -E '\*' > "$domains".whitelist.wildcards.tmp cat <"$white" | grep -E '\*' >"$domains".whitelist.wildcards.tmp
convertWildcardToRegex "$domains".whitelist.wildcards.tmp >>"$domains".whitelist.wildcards convertWildcardToRegex "$domains".whitelist.wildcards.tmp >>"$domains".whitelist.wildcards
rm -f "$domains".whitelist.wildcards.tmp rm -f "$domains".whitelist.wildcards.tmp
fi fi
@ -600,7 +608,7 @@ echo ""
# Unblock prioritized wildcard whitelisted Domains # Unblock prioritized wildcard whitelisted Domains
if [ -s "$unblock" ]; then if [ -s "$unblock" ]; then
cat <"$unblock" | grep -E '\*' > "$domains".unblocklist.wildcards.tmp cat <"$unblock" | grep -E '\*' >"$domains".unblocklist.wildcards.tmp
convertWildcardToRegex "$domains".unblocklist.wildcards.tmp >>"$domains".unblocklist.wildcards convertWildcardToRegex "$domains".unblocklist.wildcards.tmp >>"$domains".unblocklist.wildcards
rm -f "$domains".unblocklist.wildcards.tmp rm -f "$domains".unblocklist.wildcards.tmp
fi fi