From: Rishabh Date: Mon, 20 Apr 2026 16:21:37 +0000 (+0530) Subject: keepalived: add indent param in config_section_open/close X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=c75235e52323357e97d14df60c95ccaa9690d5ed;p=openwrt-packages.git keepalived: add indent param in config_section_open/close Add a parameter for indent in config_section_open and config_section_close. Previously you had to separately add indents while parsing if a section was inside another section. Now this is supported by these two functions. You can specify how much indent you need to add before opening or closing a section. Signed-off-by: Rishabh --- diff --git a/net/keepalived/files/keepalived.init b/net/keepalived/files/keepalived.init index ac59c8103..5d2b42ae4 100644 --- a/net/keepalived/files/keepalived.init +++ b/net/keepalived/files/keepalived.init @@ -16,13 +16,17 @@ INDENT_4="${INDENT_1}${INDENT_1}${INDENT_1}${INDENT_1}" config_section_open() { local tag="$1" local name="$2" + local indent="$3" + [ -n "$indent" ] && printf '%b' "$indent" >> "$KEEPALIVED_CONF" printf '%s' "$tag" >> "$KEEPALIVED_CONF" [ -n "$name" ] && printf ' %s' "$name" >> "$KEEPALIVED_CONF" printf ' {\n' >> "$KEEPALIVED_CONF" } config_section_close() { + local indent="$1" + [ -n "$indent" ] && printf '%b' "$indent" >> "$KEEPALIVED_CONF" printf '}\n\n' >> "$KEEPALIVED_CONF" }