From d2209645ba26fc154b91c22def5d64519abf2c5a Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 6 Apr 2007 01:00:12 +0000 Subject: templatepkg: --list improved git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@274 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/templatepkg | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'trunk/src') diff --git a/trunk/src/templatepkg b/trunk/src/templatepkg index 3b5c283..4521fef 100755 --- a/trunk/src/templatepkg +++ b/trunk/src/templatepkg @@ -526,20 +526,42 @@ function template_list { # list templates # usage: template_list [template_name] - local list + local list basedir template - # TODO: checar se ha / + if echo $1 | grep -q "/"; then - list="`ls $BASE_CONF/defaults/templates/$1 2> /dev/null`" - if [ "$?" == "0" ]; then - list="`echo $list | xargs`" - echo "Default templates: $list" - fi + template="`echo $1 | cut -d "/" -f 1`" + + if [ -e "$BASE_CONF/defaults/templates/$1" ]; then + list="`ls $BASE_CONF/defaults/templates/$1 2> /dev/null`" + if [ "$?" == "0" ]; then + list="`echo $list | xargs`" + echo "In the default template $template: $list" + fi + fi + + if [ -e "$BASE_CONF/templates/$1" ]; then + list="`ls $BASE_CONF/templates/$1 2> /dev/null`" + if [ "$?" == "0" ]; then + list="`echo $list | xargs`" + echo "In the custom template $template: $list" + fi + fi + + else + + list="`ls $BASE_CONF/defaults/templates/$1 2> /dev/null`" + if [ "$?" == "0" ]; then + list="`echo $list | xargs`" + echo "Default templates: $list" + fi + + list="`ls $BASE_CONF/templates/$1 2> /dev/null`" + if [ "$?" == "0" ]; then + list="`echo $list | xargs`" + echo "Custom templates: $list" + fi - list="`ls $BASE_CONF/templates/$1 2> /dev/null`" - if [ "$?" == "0" ]; then - list="`echo $list | xargs`" - echo "Custom templates: $list" fi } -- cgit v1.2.3