From 35717ada4eaea22b7762d985135217d659d0957b Mon Sep 17 00:00:00 2001 From: Lars Engels Date: Wed, 15 Jan 2020 17:27:03 +0100 Subject: [PATCH] Print a simple directory tree to verify a template's contents using find + sed if tree(1) is not installed --- usr/local/share/bastille/verify.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr/local/share/bastille/verify.sh b/usr/local/share/bastille/verify.sh index 6aecb70..8f8cd1a 100644 --- a/usr/local/share/bastille/verify.sh +++ b/usr/local/share/bastille/verify.sh @@ -99,11 +99,13 @@ verify_template() { cat "${_path}" echo while read _dir; do - if [ -x /usr/local/bin/tree ]; then echo -e "${COLOR_GREEN}[${_hook}]:[${_dir}]:${COLOR_RESET}" - tree -a ${_template_path}/${_dir} + if [ -x /usr/local/bin/tree ]; then + /usr/local/bin/tree -a ${_template_path}/${_dir} + else + find "${_template_path}/${_dir}" -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g' + fi echo - fi done < ${_path} else echo -e "${COLOR_GREEN}[${_hook}]:${COLOR_RESET}"