pihole-ftl: Download macvendor.db in setup service
As done in the update script https://github.com/pi-hole/pi-hole/blob/cef7fd4b02c9ae4314e7478c0d542379bfce7f65/automated install/basic-install.sh#L1791-L1792
···15 comment = list.description;
16 };
17 payloads = map makePayload cfg.lists;
018in
19''
20 # Can't use -u (unset) because api.sh uses API_URL before it is set
···22 pihole="${lib.getExe pihole}"
23 jq="${lib.getExe pkgs.jq}"
240025 # If the database doesn't exist, it needs to be created with gravity.sh
26- if [ ! -f '${cfg.stateDirectory}'/gravity.db ]; then
27 $pihole -g
28 # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one
29 ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})
···15 comment = list.description;
16 };
17 payloads = map makePayload cfg.lists;
18+ macvendorURL = lib.strings.escapeShellArg cfg.macvendorURL;
19in
20''
21 # Can't use -u (unset) because api.sh uses API_URL before it is set
···23 pihole="${lib.getExe pihole}"
24 jq="${lib.getExe pkgs.jq}"
2526+ ${lib.getExe pkgs.curl} --retry 3 --retry-delay 5 "${macvendorURL}" -o "${cfg.settings.files.macvendor}" || echo "Failed to download MAC database from ${macvendorURL}"
27+28 # If the database doesn't exist, it needs to be created with gravity.sh
29+ if [ ! -f '${cfg.settings.files.gravity}' ]; then
30 $pihole -g
31 # Send SIGRTMIN to FTL, which makes it reload the database, opening the newly created one
32 ${lib.getExe' pkgs.procps "kill"} -s SIGRTMIN $(systemctl show --property MainPID --value ${config.systemd.services.pihole-ftl.name})