Skip to content

Commit

Permalink
Fix bash template to produce shellcheck compliant code
Browse files Browse the repository at this point in the history
teacup-on-rockingchair committed Dec 12, 2024
1 parent 7df2ff6 commit 75126ba
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shared/templates/package_installed_guard_var/bash.template
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
{{{ bash_instantiate_variables(VARIABLE) }}}

{{% if OPERATION == "pattern match" %}}
if [[ "{{{ VALUE }}}" =~ "${{{ VARIABLE }}}" ]]; then
if [[ "{{{ VALUE }}}" =~ ${{{ VARIABLE }}} ]]; then
{{{ bash_package_install(package=PKGNAME) }}}
fi
{{% else %}}
2 changes: 1 addition & 1 deletion shared/templates/package_removed_guard_var/bash.template
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
{{{ bash_instantiate_variables(VARIABLE) }}}

{{% if OPERATION == "pattern match" %}}
if ! [[ "{{{ VALUE }}}" =~ "${{{ VARIABLE }}}" ]]; then
if ! [[ "{{{ VALUE }}}" =~ ${{{ VARIABLE }}} ]]; then
{{{ bash_package_remove(package=PKGNAME) }}}
fi
{{% else %}}
2 changes: 1 addition & 1 deletion shared/templates/service_disabled_guard_var/bash.template
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
{{{ bash_instantiate_variables(VARIABLE) }}}

{{% if OPERATION == "pattern match" %}}
if ! [[ "{{{ VALUE }}}" =~ "${{{ VARIABLE }}}" ]];
if ! [[ "{{{ VALUE }}}" =~ ${{{ VARIABLE }}} ]]; then
{{% else %}}
if [ ${{{ VARIABLE }}} != {{{ VALUE }}} ]; then
{{%- endif %}}
2 changes: 1 addition & 1 deletion shared/templates/service_enabled_guard_var/bash.template
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

SYSTEMCTL_EXEC='/usr/bin/systemctl'
{{% if OPERATION == "pattern match" %}}
if [[ "{{{ VALUE }}}" =~ "${{{ VARIABLE }}}" ]];
if [[ "{{{ VALUE }}}" =~ ${{{ VARIABLE }}} ]]; then
{{% else %}}
if [ ${{{ VARIABLE }}} == {{{ VALUE }}} ]; then
{{%- endif %}}

0 comments on commit 75126ba

Please sign in to comment.