From 6aaa1b26eddbc2f54b8e6d8b50aea5f88a6e3068 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Thu, 20 Nov 2025 15:01:15 -0500 Subject: [PATCH] template: fix LIF --- usr/local/share/bastille/template.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/usr/local/share/bastille/template.sh b/usr/local/share/bastille/template.sh index e974b4ad..6f796c43 100644 --- a/usr/local/share/bastille/template.sh +++ b/usr/local/share/bastille/template.sh @@ -117,15 +117,18 @@ render() { } line_in_file() { - _jailpath="${1}" - _filepath="$(echo ${2} | awk '{print $2}')" - _line="$(echo ${2} | awk '{print $1}')" - if [ -f "${_jailpath}/${_filepath}" ]; then - if ! grep -qxF "${_line}" "${_jailpath}/${_filepath}"; then - echo "${_line}" >> "${_jailpath}/${_filepath}" + + local jail_path="${1}" + eval set -- "${2}" + local line="${1}" + local file_path="${2}" + + if [ -f "${jail_path}/${file_path}" ]; then + if ! grep -qxF "${line}" "${jail_path}/${file_path}"; then + echo "${line}" >> "${jail_path}/${file_path}" fi else - warn "[WARNING]: Path not found for line_in_file: ${_filepath}" + warn "[WARNING]: Path not found for line_in_file: ${file_path}" fi }