From 674cbdbb3e2d510c65483c558ccf8a8cc494bb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Fri, 22 May 2020 11:25:14 +0200 Subject: [PATCH] Make usage of initscripts optional Do not depend hard on initscript just to provide fancy colored status. When started from systemd, it does not really matter. Return exactly the same return code as returned by the original tool. --- bind.spec | 1 + generate-rndc-key.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bind.spec b/bind.spec index 547829f..5791770 100644 --- a/bind.spec +++ b/bind.spec @@ -1606,6 +1606,7 @@ fi; %changelog * Fri May 15 2020 Petr Menšík - 32:9.11.19-1 - Update to 9.11.19 (CVE-2020-8616, CVE-2020-8617) +- Make initscripts just optional dependency * Tue Apr 21 2020 Björn Esser - 32:9.11.18-2 - Rebuild (json-c) diff --git a/generate-rndc-key.sh b/generate-rndc-key.sh index dde7f70..375a48e 100755 --- a/generate-rndc-key.sh +++ b/generate-rndc-key.sh @@ -1,6 +1,17 @@ #!/bin/bash -. /etc/rc.d/init.d/functions +if [ -r /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +else +success() { + echo $" OK " +} + +failure() { + echo -n " " + echo $"FAILED" +} +fi # This script generates /etc/rndc.key if doesn't exist AND if there is no rndc.conf @@ -14,7 +25,9 @@ if [ ! -s /etc/rndc.key -a ! -s /etc/rndc.conf ]; then success $"/etc/rndc.key generation" echo else + rc=$? failure $"/etc/rndc.key generation" echo + exit $rc fi fi