Skip to content

Commit

Permalink
ds-identify: Allow disable service and override environment (#4485)
Browse files Browse the repository at this point in the history
This PR allows disabling the ds-identify service on FreeBSD, without
having to delete the service file.
It also overrides two environment variables when running the service
to ensure that on FreeBSD, paths are where they are to be expected.

Fixes GH-4481
Sponsored by: The FreeBSD Foundation
Co-authored-by: Dave Cottlehuber <[email protected]>
  • Loading branch information
igalic authored Oct 9, 2023
1 parent 3267098 commit 9fde069
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions sysvinit/freebsd/dsidentify.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ rcvar="cloudinit_enable"

dsidentify_start()
{
echo "${command} starting"
if kenv -q kernel_options | grep -q 'cloud-init=disabled'; then
warn "cloud-init is disabled via kernel_options."
elif test -e {{ prefix }}/etc/cloud-init.disabled; then
warn "cloud-init is disabled via cloud-init.disabled file."
else
${command}
if checkyesno cloudinit_dsidentify_enable; then
echo "${command} starting"
if kenv -q kernel_options | grep -q 'cloud-init=disabled'; then
warn "cloud-init is disabled via kernel_options."
elif test -e {{ prefix }}/etc/cloud-init.disabled; then
warn "cloud-init is disabled via cloud-init.disabled file."
else
${command}
fi
fi
}

load_rc_config 'cloudinit'

: ${cloudinit_enable="NO"}
: ${cloudinit_dsidentify_enable="YES"}
: ${dsidentify_env="PATH_DI_CONFIG={{ prefix }}/etc/cloud/ds-identify.cfg PATH_ETC_CLOUD={{ prefix }}/etc/cloud"}

run_rc_command "$1"

0 comments on commit 9fde069

Please sign in to comment.