Skip to content

Commit

Permalink
Merge pull request #809 from tschettervictor/patch-1
Browse files Browse the repository at this point in the history
template: allow & in arg string
  • Loading branch information
bmac2 authored Feb 10, 2025
2 parents 0c722ac + 91d41b9 commit c6a62a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/chapters/template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ Template Automation Hooks
| SYSRC | sysrc command(s) | nginx_enable=YES |
+---------+-------------------+-----------------------------------------+

Note: SYSRC requires that NO quotes be used or that quotes (`"`) be escaped
Special Hook Cases
------------------

SYSRC requires that NO quotes be used or that quotes (`"`) be escaped
ie; (`\\"`)

ARG will always treat an ampersand "\&" literally, without the need to escape it.
Escaping it will cause errors.

Place these uppercase template hook commands into a `Bastillefile` in any order
and automate container setup as needed.

Expand Down
2 changes: 1 addition & 1 deletion usr/local/share/bastille/template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ get_arg_name() {

parse_arg_value() {
# Parses the value after = and then escapes back/forward slashes and single quotes in it. -- cwells
echo "${1}" | sed -E 's/[^=]+=?//' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/'\''/'\''\\'\'\''/g'
echo "${1}" | sed -E 's/[^=]+=?//' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/'\''/'\''\\'\'\''/g' -e 's/&/\\&/g'
}

get_arg_value() {
Expand Down

0 comments on commit c6a62a9

Please sign in to comment.