Skip to content

Commit

Permalink
fix(sysvinit): make code a bit more consistent (#4677)
Browse files Browse the repository at this point in the history
let's just use an `if`!

Sponsored by: The FreeBSD Foundation
  • Loading branch information
igalic committed Dec 13, 2023
1 parent 4006c23 commit 16aa69a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sysvinit/freebsd/cloudinitlocal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# PROVIDE: cloudinitlocal
{#
``cloudinitlocal`` purposefully does not depend on ``dsidentify``.
That makes it easy for image builders to create images without ``dsidentify``.
That makes it easy for image builders to disable ``dsidentify``.
#}
# REQUIRE: ldconfig mountcritlocal
# BEFORE: NETWORKING cloudinit cloudconfig cloudfinal
Expand Down
7 changes: 4 additions & 3 deletions sysvinit/netbsd/cloudconfig.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ name="cloudinit"
start_cmd="start_cloud_init"
start_cloud_init()
{
test -e {{prefix}}/etc/cloud/cloud-init.disabled \
&& warn "cloud-init disabled by cloud-init.disabled file" \
&& exit 0
if test -e {{prefix}}/etc/cloud/cloud-init.disabled ; then
warn "cloud-init disabled by cloud-init.disabled file"
exit 0
fi
{{prefix}}/bin/cloud-init modules --mode config
}

Expand Down
7 changes: 4 additions & 3 deletions sysvinit/netbsd/cloudfinal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ name="cloudinit"
start_cmd="start_cloud_init"
start_cloud_init()
{
test -e {{prefix}}/etc/cloud/cloud-init.disabled \
&& warn "cloud-init disabled by cloud-init.disabled file" \
&& exit 0
if test -e {{prefix}}/etc/cloud/cloud-init.disabled ; then
warn "cloud-init disabled by cloud-init.disabled file"
exit 0
fi
{{prefix}}/bin/cloud-init modules --mode final
}

Expand Down
7 changes: 4 additions & 3 deletions sysvinit/netbsd/cloudinit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ name="cloudinit"
start_cmd="start_cloud_init"
start_cloud_init()
{
test -e {{prefix}}/etc/cloud/cloud-init.disabled \
&& warn "cloud-init disabled by cloud-init.disabled file" \
&& exit 0
if test -e {{prefix}}/etc/cloud/cloud-init.disabled ; then
warn "cloud-init disabled by cloud-init.disabled file"
exit 0
fi
{{prefix}}/bin/cloud-init init
}

Expand Down
7 changes: 4 additions & 3 deletions sysvinit/netbsd/cloudinitlocal.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ name="cloudinitlocal"
start_cmd="start_cloud_init_local"
start_cloud_init_local()
{
test -e {{prefix}}/etc/cloud/cloud-init.disabled \
&& warn "cloud-init disabled by cloud-init.disabled file" \
&& exit 0
if test -e {{prefix}}/etc/cloud/cloud-init.disabled; then
warn "cloud-init disabled by cloud-init.disabled file"
exit 0
fi
{{prefix}}/bin/cloud-init init -l
}

Expand Down
7 changes: 4 additions & 3 deletions sysvinit/netbsd/dsidentify.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ name="dsidentify"
start_cmd="start_dsidentify"
start_dsidentify()
{
test -e {{prefix}}/etc/cloud/cloud-init.disabled \
&& warn "cloud-init disabled by cloud-init.disabled file" \
&& exit 0
if test -e {{prefix}}/etc/cloud/cloud-init.disabled ; then
warn "cloud-init disabled by cloud-init.disabled file"
exit 0
fi
{{prefix}}/lib/cloud-init/ds-identify
}

Expand Down

0 comments on commit 16aa69a

Please sign in to comment.