From b92ccb2de4204299717b02b9c3291ed22dfdcc3d Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Wed, 14 Mar 2018 20:01:06 +0000 Subject: [PATCH] Additionally `mask` the dnsmasq service on systems with systemctl Signed-off-by: Adam Warner --- automated install/basic-install.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 22d549e1..47348775 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1173,6 +1173,25 @@ disable_service() { echo -e "${OVER} ${TICK} ${str}" } +# Mask service so that it cannot be started accidentally +mask_service() { + # Local, named variables + local str="Masking ${1} service" + echo -ne " ${INFO} ${str}..." + # If systemctl exists, + if command -v systemctl &> /dev/null; then + # use that to disable the service + systemctl mask "${1}" &> /dev/null + echo -e "${OVER} ${TICK} ${str}" + # Othwerwise, + else + # use update-rc.d to accomplish this + echo -e "${OVER} ${CROSS} ${str}" + echo -e " ${INFO} systemctl not detected. Cannot mask service." + fi + +} + check_service_active() { # If systemctl exists, if command -v systemctl &> /dev/null; then @@ -1831,7 +1850,8 @@ FTLinstall() { if check_service_active "dnsmasq";then echo " ${INFO} FTL can now resolve DNS Queries without dnsmasq running separately" stop_service dnsmasq - disable_service dnsmasq + disable_service dnsmasq + mask_service dnsmasq fi fi