From b9d7366ab55417c8a0b15cfd9a58df2f8d4d39ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mina=20Gali=C4=87?= Date: Fri, 8 Dec 2023 19:37:12 +0000 Subject: [PATCH] fix(sysvinit): make code a bit more consistent (#4677) let's just use an `if`! Sponsored by: The FreeBSD Foundation --- sysvinit/freebsd/cloudinitlocal.tmpl | 2 +- sysvinit/netbsd/cloudconfig.tmpl | 7 ++++--- sysvinit/netbsd/cloudfinal.tmpl | 7 ++++--- sysvinit/netbsd/cloudinit.tmpl | 7 ++++--- sysvinit/netbsd/cloudinitlocal.tmpl | 7 ++++--- sysvinit/netbsd/dsidentify.tmpl | 7 ++++--- 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/sysvinit/freebsd/cloudinitlocal.tmpl b/sysvinit/freebsd/cloudinitlocal.tmpl index ec9b1fb8b824..acf8c20a854f 100755 --- a/sysvinit/freebsd/cloudinitlocal.tmpl +++ b/sysvinit/freebsd/cloudinitlocal.tmpl @@ -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 diff --git a/sysvinit/netbsd/cloudconfig.tmpl b/sysvinit/netbsd/cloudconfig.tmpl index b78356ca3d54..f299d7c1a69a 100755 --- a/sysvinit/netbsd/cloudconfig.tmpl +++ b/sysvinit/netbsd/cloudconfig.tmpl @@ -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 } diff --git a/sysvinit/netbsd/cloudfinal.tmpl b/sysvinit/netbsd/cloudfinal.tmpl index 3117d07cc2c6..fa092c885153 100755 --- a/sysvinit/netbsd/cloudfinal.tmpl +++ b/sysvinit/netbsd/cloudfinal.tmpl @@ -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 } diff --git a/sysvinit/netbsd/cloudinit.tmpl b/sysvinit/netbsd/cloudinit.tmpl index a8e926c13bd9..5a814989927e 100755 --- a/sysvinit/netbsd/cloudinit.tmpl +++ b/sysvinit/netbsd/cloudinit.tmpl @@ -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 } diff --git a/sysvinit/netbsd/cloudinitlocal.tmpl b/sysvinit/netbsd/cloudinitlocal.tmpl index ba840ab4bd8b..79e78aee667f 100755 --- a/sysvinit/netbsd/cloudinitlocal.tmpl +++ b/sysvinit/netbsd/cloudinitlocal.tmpl @@ -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 } diff --git a/sysvinit/netbsd/dsidentify.tmpl b/sysvinit/netbsd/dsidentify.tmpl index 4ce7e067ee1c..cc5361980252 100755 --- a/sysvinit/netbsd/dsidentify.tmpl +++ b/sysvinit/netbsd/dsidentify.tmpl @@ -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 }