Skip to content

Commit

Permalink
Fix bash template to produce shellcheck compliant code
Browse files Browse the repository at this point in the history
  • Loading branch information
teacup-on-rockingchair committed May 21, 2024
1 parent 864492d commit 16d90b6
Show file tree
Hide file tree
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
Expand Up @@ -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 %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/package_removed_guard_var/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/service_disabled_guard_var/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}
Expand Down
2 changes: 1 addition & 1 deletion shared/templates/service_enabled_guard_var/bash.template
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}
Expand Down

0 comments on commit 16d90b6

Please sign in to comment.