From 3c0811fb0912aaad6a6e5a41120d66a692c53387 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Wed, 20 Apr 2022 12:44:28 +0200 Subject: Add freebsd method for svc enable --- lib/util/svc.bash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/util/svc.bash b/lib/util/svc.bash index 403615f..3a5f7b2 100644 --- a/lib/util/svc.bash +++ b/lib/util/svc.bash @@ -47,8 +47,20 @@ svc_enable() { local system="bashtard/svc/enable" local service=$1 + local rc case "${BASHTARD_PLATFORM[key]}" in + freebsd) + rc="$(printf '%s_enable="YES"' "$service")" + + if ! grep -Fqx "$rc" "/etc/rc.conf.d/$service" + then + printf "%s\n" "$rc" >> "/etc/rc.conf.d/$service" + fi + + return 0 + + ;; linux-gentoo) set -- /sbin/rc-update add "$service" ;; linux-*) set -- systemctl enable "$service" ;; *) -- cgit v1.1