From 34fa107fcf7282a909cfed9cba64d2f411799034 Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Fri, 4 Apr 2025 16:55:33 -0600 Subject: [PATCH] template: Fix lininfile hook --- usr/local/share/bastille/template.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/usr/local/share/bastille/template.sh b/usr/local/share/bastille/template.sh index c6fa43a4..b25e0cd1 100644 --- a/usr/local/share/bastille/template.sh +++ b/usr/local/share/bastille/template.sh @@ -115,14 +115,15 @@ render() { } line_in_file() { - _line="${2}" - _file_path="${1}/${3}" - if [ -f "${_file_path}" ]; then - if ! grep -qxF "${_line}" "${_file_path}"; then - echo "${_line}" >> "${_file_path}" + _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}" fi else - warn "Path not found for line_in_file: ${2}" + warn "Path not found for line_in_file: ${_filepath}" fi }