--- a/scripts/lib.sh Fri Jan 27 12:07:32 2012 +0200
+++ b/scripts/lib.sh Fri Jan 27 14:41:02 2012 +0200
@@ -157,6 +157,15 @@
done < $tpl > $out
}
+function expand_file () {
+ local src=$1
+ local dst=$2
+
+ log_info "expand: file $src -> $dst"
+
+ cmd expand_template $src $dst
+}
+
# Recursive expand_template files from src -> dst
# XXX: not used
function expand_tree () {
@@ -164,20 +173,26 @@
local dst=$2
local filter=${3:-'*'}
+ log_info "expand: tree $src/$filter -> $dst"
+
+ [ ! -d $dst ] && cmd mkdir $dst
+
for path in ${src}/${filter}; do
local name=$(basename $path)
local target=$dst/$name
+ log_debug "expand_tree: $src: path=$path, name=$name, target=$target"
+
if [ -d $path ]; then
- log_debug "expand_tree: $path -> $target"
- expand_tree $path $target $filter
+ log_debug "expand_tree: $src: tree $name -> $target"
+ expand_tree $path $target "$filter"
elif [ -f $path ]; then
- log_debug "expand_file: $path -> $target"
+ log_debug "expand_tree: $src: file $name -> $target"
expand_file $path $target
else
- log_warn "ignore weird file: $path"
+ log_warn "expand_tree: $src: ignore $name"
fi
done