mirror of
https://github.com/pi-hole/pi-hole
synced 2025-07-02 21:32:33 +00:00
Select init.d or systemd unit depending on used init system
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
55f1adeb39
commit
df49761e45
@ -1754,14 +1754,27 @@ FTLinstall() {
|
|||||||
# Move into the temp ftl directory
|
# Move into the temp ftl directory
|
||||||
pushd "$(mktemp -d)" > /dev/null || { echo "Unable to make temporary directory for FTL binary download"; return 1; }
|
pushd "$(mktemp -d)" > /dev/null || { echo "Unable to make temporary directory for FTL binary download"; return 1; }
|
||||||
|
|
||||||
# Always replace pihole-FTL.service (init.d script)
|
# Determine if systemd is used on this system
|
||||||
install -T -m 0644 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL.initd" "/etc/init.d/pihole-FTL"
|
file $(which init) | grep "systemd" &> /dev/null
|
||||||
|
|
||||||
# Always replace pihole-FTL.service (systemd unit)
|
if [ $? -eq 0 ]; then
|
||||||
install -T -m 0644 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL.service" "/etc/systemd/system/pihole-FTL.service"
|
# Use systemd unit
|
||||||
|
# Always replace pihole-FTL.service (systemd unit)
|
||||||
|
install -T -m 0644 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL.service" "/etc/systemd/system/pihole-FTL.service"
|
||||||
|
install -T -m 0755 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL-prestart.sh" "/opt/pihole/pihole-FTL-prestart.sh"
|
||||||
|
|
||||||
# Enable service script (we have to do this after replacing the service unit)
|
# Remove old init.d script if present as it cannot coexist with the systemd unit we are installing here
|
||||||
systemctl enable pihole-FTL.service
|
if [ -e "/etc/init.d/pihole-FTL" ]; then
|
||||||
|
rm "/etc/init.d/pihole-FTL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable service script (we have to do this after replacing the service unit)
|
||||||
|
systemctl enable pihole-FTL.service
|
||||||
|
else
|
||||||
|
# Use old init.d script
|
||||||
|
# Always replace pihole-FTL.service (init.d script)
|
||||||
|
install -T -m 0644 "${PI_HOLE_LOCAL_REPO}/advanced/pihole-FTL.initd" "/etc/init.d/pihole-FTL"
|
||||||
|
fi
|
||||||
|
|
||||||
local ftlBranch
|
local ftlBranch
|
||||||
local url
|
local url
|
||||||
|
Loading…
Reference in New Issue
Block a user