diff options
-rw-r--r-- | lib/control.sh | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/control.sh b/lib/control.sh index cd982e9..37123dd 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -18,6 +18,15 @@ # along with opkbuild. If not, see <http://www.gnu.org/licenses/>. _OB_SUBSTVARS_MAX_DEPTH=50 +_OB_SUBSTVAR_TRIM_SED=' + H; # Store each input line in the hold space. + ${ # At the last line of input: + g; # restore the hold space into the pattern space, + s/^[\n]*//; # remove leading newline characters, + s/[\n]*$//; # remove trailing newline characters, and + p; # print the results. + }; +' _ob_parse_control_error() { @@ -200,15 +209,7 @@ ob_set_source_substvar() name="$(printf '%s' "${name}" | tr 'a-z-' 'A-Z_')" # Trim leading and trailing whitespace from value. - value="$(printf '%s' "${value}" | sed -n ' - H; # Store each input line in the hold space. - ${ # At the last line of input: - g; # restore the hold space into the pattern space, - s/^[\n]*//; # remove leading newline characters, - s/[\n]*$//; # remove trailing newline characters, and - p; # print the results. - }; - ')" + value="$(printf '%s' "${value}" | sed -n "${_OB_SUBSTVAR_TRIM_SED}")" eval "_OB_SUBSTVAR_${name}=\"\${value}\"" |