Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template: allow & in arg string #809

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 requires an ampersand "\&" to be escaped (`\\&`) if it is to be interpreted
literally, otherwise it is treated as a special character.

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