diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-04-20 12:44:28 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-04-20 12:44:28 +0200 |
commit | 3c0811fb0912aaad6a6e5a41120d66a692c53387 (patch) | |
tree | 18d3336368342f412374cf44a224cf8390700393 | |
parent | 333ba3fbe568dd62bd9bc687e56975c06a2b85b5 (diff) |
Add freebsd method for svc enable
-rw-r--r-- | lib/util/svc.bash | 12 |
1 files changed, 12 insertions, 0 deletions
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" ;; *) |