pihole-regex icon indicating copy to clipboard operation
pihole-regex copied to clipboard

Add list & comment arguments enables usage with other regex lists

Open nickspaargaren opened this issue 1 year ago • 4 comments

What

This pull request adds the following sub commands to the install script.

  • --list [string] (regex.list of choice)
  • --comment [string] (Comment of choice)

If you choose none of these sub commands: The default is used.

Usage

curl -sSl https://raw.githubusercontent.com/nickspaargaren/pihole-regex/args/install.py | sudo python3 /dev/stdin --list https://raw.githubusercontent.com/nickspaargaren/no-google/master/regex.list --comment github.com/nickspaargaren/no-google

How to test

Requirements

  • Docker

Setup new Pi-Hole test installation

  • Pull the Pi-hole docker image by running docker pull pihole/pihole:2024.02.0
  • Start the Pi-hole docker container by running docker run --name pihole -d -p 8080:80 -e WEBPASSWORD=admin pihole/pihole:2024.02.0
  • Navigate to http://localhost:8080/admin/
  • Login in with password admin and check "Remind me for 7 days"
  • Install Python inside the docker container by running docker exec pihole sh -c "sudo apt update && apt install python3 -y"

Import domains in Pi-Hole

  • Navigate to http://localhost:8080/admin/groups-domains.php and make sure there are no rules
  • Import a custom list by running docker exec pihole sh -c "curl -sSl https://raw.githubusercontent.com/nickspaargaren/pihole-regex/args/install.py | sudo python3 /dev/stdin --list https://raw.githubusercontent.com/nickspaargaren/no-google/master/regex.list --comment github.com/nickspaargaren/no-google"
  • Refresh or navigate to http://localhost:8080/admin/groups-domains.php and make sure the domains are imported correctly

Closes https://github.com/mmotti/pihole-regex/issues/61

nickspaargaren avatar Oct 18 '22 18:10 nickspaargaren

Great addition!

EWouters avatar Jan 02 '23 09:01 EWouters

Hi! Apologies for the delay in response; I haven't had Pi-hole installed for some time.

Unfortunately the diff for this particular change isn't too helpful for me to be able to look through this quickly and I'd have to familiarise myself once again with the code.

Are you able to confirm that this has been tested and works as expected?

mmotti avatar Jan 02 '23 17:01 mmotti

I was merely trying to apply multiple lists and noticed that when you apply a list all previous entries will be deleted/disabled. Adding command line arguments to select which allow/block lists one wants to apply would be a great addition.

EWouters avatar Jan 03 '23 13:01 EWouters

Hi @mmotti! My apologies for leaving this PR open for so long. I've added a "How to test" section so you can verify the changes using a new Pi-hole installation with Docker. Let me know if you need anything!

nickspaargaren avatar Feb 19 '24 14:02 nickspaargaren