@ -23,7 +23,7 @@ fi
# have changed
# have changed
gravityDBfile = " ${ GRAVITYDB } "
gravityDBfile = " ${ GRAVITYDB } "
reloa d= false
noReloadRequeste d= false
addmode = true
addmode = true
verbose = true
verbose = true
wildcard = false
wildcard = false
@ -35,6 +35,7 @@ typeId=""
comment = ""
comment = ""
declare -i domaincount
declare -i domaincount
domaincount = 0
domaincount = 0
reload = false
colfile = "/opt/pihole/COL_TABLE"
colfile = "/opt/pihole/COL_TABLE"
source ${ colfile }
source ${ colfile }
@ -242,13 +243,13 @@ Displaylist() {
NukeList( ) {
NukeList( ) {
count = $( sqlite3 " ${ gravityDBfile } " " SELECT COUNT(1) FROM domainlist WHERE type = ${ typeId } ; " )
count = $( sqlite3 " ${ gravityDBfile } " " SELECT COUNT(1) FROM domainlist WHERE type = ${ typeId } ; " )
listname = " $( GetListnameFromTypeId " ${ typeId } " ) "
listname = " $( GetListnameFromTypeId " ${ typeId } " ) "
if [ " $count " -gt 0 ] ; then
if [ " $count " -gt 0 ] ; then
sqlite3 " ${ gravityDBfile } " " DELETE FROM domainlist WHERE type = ${ typeId } ; "
sqlite3 " ${ gravityDBfile } " " DELETE FROM domainlist WHERE type = ${ typeId } ; "
echo " ${ TICK } Removed ${ count } domain(s) from the ${ listname } "
echo " ${ TICK } Removed ${ count } domain(s) from the ${ listname } "
else
else
echo " ${ INFO } ${ listname } already empty. Nothing to do! "
echo " ${ INFO } ${ listname } already empty. Nothing to do! "
fi
fi
exit 0;
exit 0;
}
}
@ -268,7 +269,7 @@ while (( "$#" )); do
"--white-wild" | "white-wild" ) typeId = 2; wildcard = true; ;
"--white-wild" | "white-wild" ) typeId = 2; wildcard = true; ;
"--wild" | "wildcard" ) typeId = 3; wildcard = true; ;
"--wild" | "wildcard" ) typeId = 3; wildcard = true; ;
"--regex" | "regex" ) typeId = 3; ;
"--regex" | "regex" ) typeId = 3; ;
"-nr" | "--noreload" ) reload= fals e; ;
"-nr" | "--noreload" ) noReloadRequested= tru e; ;
"-d" | "--delmode" ) addmode = false; ;
"-d" | "--delmode" ) addmode = false; ;
"-q" | "--quiet" ) verbose = false; ;
"-q" | "--quiet" ) verbose = false; ;
"-h" | "--help" ) helpFunc; ;
"-h" | "--help" ) helpFunc; ;
@ -294,6 +295,6 @@ if $web; then
echo "DONE"
echo "DONE"
fi
fi
if [ [ " ${ reload } " != false ] ] ; then
if [ [ ${ reload } = = true && ${ noReloadRequested } = = false ] ] ; then
pihole restartdns reload-lists
pihole restartdns reload-lists
fi
fi