jacklul / pihole-updatelists

Update Pi-hole's lists from remote sources easily
MIT License
1.39k stars 81 forks source link

Request to introduce the ability to modify command to update gravity in the configuration file #136

Closed CyanMatter closed 1 year ago

CyanMatter commented 1 year ago

Hi,

I have Pi-hole installed as a Docker container. So when I attempted a first run after installing and configuring pihole-updatelists as per the instructions in the readme, the program couldn't find the command to update gravity at /usr/local/bin/pihole updateGravity. To update gravity in my case, I believe the program should use docker exec to use the command in the running container.

The path to updateGravity is set at line 2642. It would benefit me if I could set the command to update gravity in the configuration file. Similarly, I was able to set the path to gravity.db to its location in the volume by modifying GRAVITY_DB.

Swapping CONTAINER with the name of the container, I fixed it by changing line 2642 to: $command = 'docker exec CONTAINER pihole updateGravity'; However, this fix will not persist when I update the program. If I update, I think I'll write a command at /usr/local/bin/ that simply relays the command from pihole-updatelists to the correct destination.

And please correct me if I overlooked something!

jacklul commented 1 year ago

You should probably look here: https://github.com/jacklul/pihole-updatelists#install-with-docker

CyanMatter commented 1 year ago

I believe using your image will solve this problem, but unfortunately it's not an option for me. I'd like to keep using cbcrowe/pihole-unbound as an all-around DNS solution in one container.

jacklul commented 1 year ago

I am pretty sure you could do this in that case:

FROM cbcrowe/pihole-unbound:latest

RUN apt-get update && apt-get install -Vy wget php-cli php-sqlite3 php-intl php-curl

RUN wget -O - https://raw.githubusercontent.com/jacklul/pihole-updatelists/master/install.sh | bash -s docker
CyanMatter commented 1 year ago

Yes! This works as intended. The blame is on my reading comprehension!

jacklul commented 1 year ago

Just a note: I've added PIHOLE_CMD which can be also used to achieve what you mentioned. Setting it to docker exec CONTAINER pihole will be equivalent to $command = 'docker exec CONTAINER pihole updateGravity';.