mirror of
https://github.com/pi-hole/pi-hole
synced 2025-01-02 12:10:54 +00:00
Remove unused wildcard_regex_converter.sh (#4369)
* Remove unused wildcard_regex_converter.sh Signed-off-by: Christian König <ckoenig@posteo.de> * Remove regexconverter Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
2b74b47b4a
commit
38bb4a4908
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Pi-hole: A black hole for Internet advertisements
|
|
||||||
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
|
|
||||||
# Network-wide ad blocking via your own hardware.
|
|
||||||
#
|
|
||||||
# Provides an automated migration subroutine to convert Pi-hole v3.x wildcard domains to Pi-hole v4.x regex filters
|
|
||||||
#
|
|
||||||
# This file is copyright under the latest version of the EUPL.
|
|
||||||
# Please see LICENSE file for your rights under this license.
|
|
||||||
|
|
||||||
# regexFile set in gravity.sh
|
|
||||||
|
|
||||||
wildcardFile="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
|
||||||
|
|
||||||
convert_wildcard_to_regex() {
|
|
||||||
if [ ! -f "${wildcardFile}" ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
local addrlines domains uniquedomains
|
|
||||||
# Obtain wildcard domains from old file
|
|
||||||
addrlines="$(grep -oE "/.*/" ${wildcardFile})"
|
|
||||||
# Strip "/" from domain names and convert "." to regex-compatible "\."
|
|
||||||
domains="$(sed 's/\///g;s/\./\\./g' <<< "${addrlines}")"
|
|
||||||
# Remove repeated domains (may have been inserted two times due to A and AAAA blocking)
|
|
||||||
uniquedomains="$(uniq <<< "${domains}")"
|
|
||||||
# Automatically generate regex filters and remove old wildcards file
|
|
||||||
awk '{print "(^|\\.)"$0"$"}' <<< "${uniquedomains}" >> "${regexFile:?}" && rm "${wildcardFile}"
|
|
||||||
}
|
|
@ -15,8 +15,6 @@ export LC_ALL=C
|
|||||||
|
|
||||||
coltable="/opt/pihole/COL_TABLE"
|
coltable="/opt/pihole/COL_TABLE"
|
||||||
source "${coltable}"
|
source "${coltable}"
|
||||||
regexconverter="/opt/pihole/wildcard_regex_converter.sh"
|
|
||||||
source "${regexconverter}"
|
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
source "/etc/.pihole/advanced/Scripts/database_migration/gravity-db.sh"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user