OpenRC init.d script for FTL and other fixes!

Hello there!

Since systemd liked to muck up my IPv6 routing, I've been looking for an alternative Linux distro to run on my RasPi 2, running Devuan for a while before getting sick of the missing Debian packages that it didn't provide, despite a lot of them not even being dependant on systemd.

Long story short, I ended up on Arch/Parabola. Pihole is fortunately provided as a custom build on the AUR, but there's nothing accounting for alternative init systems. Until now! I've been writing a rudimentary startup script for FTL that more or less adheres to the OpenRC conventions. I've also uploaded a PKGBUILD formula to the AUR for quicker installation.

If you're more experienced in writing OpenRC scripts, feel free to fork and request a pull! I'm sure there's still a few things that can be improved.

Also, the main 'pihole' script will need updating of its restart function to the OpenRC equivalent of the systemd commands that are already present, but that's a quick edit which I think doesn't necessarily need a github repo. Maybe I'll make a little .patch file with a PKGBUILD formula at some point.

Links:

https://aur.archlinux.org/packages/pihole-openrc/

Note to readers: see Pi-hole - ArchWiki

Note: Pi-hole on Arch Linux is not officially supported by the Pi-hole project.

Did I post in the wrong section then? Any unofficial modification section I should go to?

No, this is the correct section. I just wanted to point out that Arch is not a supported OS and if users have problems with the script we can't help them.

Oh yes, of course. Any malfunction with the init script is on me.

1 Like

First issue: I don't know why, but openrc complains about an "unexpected end of file" where there is no issue that I can see. Any help would be appreciated.

#!/usr/bin/openrc-run
command="/usr/bin/pihole-FTL"
pidfile="/run/pihole-FTL/pihole-FTL.pid"
command_background="yes"
cfgfile="/etc/pihole/pihole-FTL.conf"

depend() {
	use dns logger
}

start() {
	ebegin "Starting pihole-FTL"
	start-stop-daemon --start \
	--user pihole \
        --exec /usr/bin/pihole-FTL \
        --pidfile /run/pihole-FTL/pihole-FTL.pid \
}

stop() {
	ebegin "Stopping pihole-FTL"
	start-stop-daemon --stop \
	--exec /usr/bin/pihole-FTL
}

restart() {
	ebegin "Stopping pihole-FTL"
	start-stop-daemon --stop \
	--exec /usr/bin/pihole-FTL
	ebegin "Starting pihole-FTL"
	start-stop-daemon --start \
	--user pihole \
        --exec /usr/bin/pihole-FTL \
        --pidfile /run/pihole-FTL/pihole-FTL.pid
	
}

OK I've been gnawing at this since I posted my issue and I've got it now! The script now mostly mimics what the systemd unit does, including fixing permissions on launch. It also makes sure it runs after the networking service.

I've also fixed FTL not being able to bind to the DHCP port, which I've uploaded into a quick repo as a shell script:

That's where the aforementioned .patch file will go once I get around to making it. For today, I'm finished! Good night! :smiley:

The GitHub Issues function would be the perfect place to discuss your scripts and to provide support to users who may want to use it.

This area is more for additions to the supported scripting. Providing support and discussion in a single thread is going to drive you batty and lead to a bad user experience. GitHub is even rolling out a Discussion area for repositories so you can have your own community discussions.