diff options
Diffstat (limited to 'trunk/src/templatepkg')
-rwxr-xr-x | trunk/src/templatepkg | 44 |
1 files changed, 33 insertions, 11 deletions
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 } |