Skip to content

Commit

Permalink
fix(sysvinit): make code a bit more consistent
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 8, 2023
1 parent c43322d commit 6482cc4
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 @@ -26,9 +26,10 @@ cloud_init_local_precmd()

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 @@ -21,9 +21,10 @@ dsidentify_precmd()

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 6482cc4

Please sign in to comment.