From b3c98a0f9dae4eb1e6078df4a0c55a9e892ae56e Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 11 May 2022 10:28:43 +0200 Subject: Check if rc.d file exists --- lib/util/svc.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/util/svc.bash b/lib/util/svc.bash index 3a5f7b2..3b2ac90 100644 --- a/lib/util/svc.bash +++ b/lib/util/svc.bash @@ -53,7 +53,7 @@ svc_enable() { freebsd) rc="$(printf '%s_enable="YES"' "$service")" - if ! grep -Fqx "$rc" "/etc/rc.conf.d/$service" + if [[ ! -f "/etc/rc.conf.d/$service" ]] || ! grep -Fqx "$rc" "/etc/rc.conf.d/$service" then printf "%s\n" "$rc" >> "/etc/rc.conf.d/$service" fi -- cgit v1.1