From a836719a51ef6f1f8545c3a831da405727408137 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 11 Nov 2018 12:48:07 +0000 Subject: [PATCH] jw-pkg: Add command list-template-tables Signed-off-by: Jan Lindemann --- scripts/jw-pkg | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/jw-pkg b/scripts/jw-pkg index 7dab15f3..fb2ee14a 100644 --- a/scripts/jw-pkg +++ b/scripts/jw-pkg @@ -150,6 +150,7 @@ cmd_list_templates() { local ext_from="$template_exts" # TODO: support more than one local ext_from_re=`echo $ext_from | sed 's/\./\\./g'` + local f list_packages "$@" | xargs -r rpm -ql | while read f; do [ -f "$f" ] || continue echo $f | grep -q "$ext_from_re$" || continue @@ -157,12 +158,25 @@ cmd_list_templates() done } +cmd_list_template_tables() +{ + local ext_from="$table_exts" + local e f + list_packages "$@" | xargs -r rpm -ql | while read f; do + [ -f "$f" -o -L "$f" ] || continue + for e in $ext_from; do + [ -f "${f%.*}$e" ] || continue + echo $f + done + done +} + cmd_compile_templates() { local ext_from="$template_exts" # TODO: support more than one local ext_from_re=`echo $template_exts | sed 's/\./\\./g'` local ext_to="" - local ext_tables=".jw-secret .jw-vars" + local ext_tables="$table_exts" local group=root local owner=root local mode=600 @@ -228,6 +242,7 @@ cmd_built_today() myname=`basename $0` longname=$0 opts="v" +table_exts=".jw-secret .jw-vars" template_exts=".jw-tmpl" while [ ${1:0:1} = '-' ]; do @@ -313,6 +328,9 @@ compile-templates) list-templates) cmd_list_templates "$@" ;; +list-template-tables) + cmd_list_template_tables "$@" + ;; diff) cmd_diff "$@" ;;