Good evening, I’d like to contribute something; I’m not sure if it will help anyone or if something similar has already been done, but here it goes... I’m using Pi-hole not only to remove ads but also to filter content on my network, similar to how SquidGuard works.
Since Pi-hole uses a list-based system, it helps a lot with this task. However, it has the characteristic of requiring 0.0.0.0 in front of each URL, which I believe acts as if the domain resolves to that IP, effectively blocking it by redirecting to "null."
With this, I started using the UT1 list, which is frequently updated—almost daily, I’d say. So, I had the idea to create a shell script (with some help from ChatGPT XD) to automate this process for me.
Once a day, I update the lists and send them to another server with Pi-hole installed so that both servers use the same list.
You are processing only a subset of archives listed by the university of Toulouse, and they seem to be a mixture of block and allow lists, as the usage file seems to declare.
Note that those archives contain files that are not compatible with Pi-hole.
It seems your script correctly deals with this by extracting the domains file only, but it doesn't inspect usage. Users trying to blindly download all lists may accidentally block domains intended to be allowed (e.g. in the bank, update or liste_blanche archives).
Above means that you can use the domains file as is, i.e. you do not need to
# Edit the file by adding "0.0.0.0" at the beginning of each line
sed -i 's/^/0.0.0.0 /' "$var_name"
Your script unconditionally tries to copy files and initiate a gravity update on a remote Pi-hole.
Users may run one instance of Pi-hole only, and if they run multiple Pi-holes, they may already handle syncing them.
You should consider removing that part, or make it optional, so it wouldn't be triggered by default.