diff options
-rwxr-xr-x | trunk/src/jail-commit | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/trunk/src/jail-commit b/trunk/src/jail-commit index 9fa80ab..f4d0f0d 100755 --- a/trunk/src/jail-commit +++ b/trunk/src/jail-commit @@ -48,22 +48,32 @@ function template_merge { cd $TEMPLATE_BASE.d for file in `find | grep -v -e "/.svn$" | grep -v -e "/.svn/"`; do - if [[ -f "$file" && -f "$1/$file" ]]; then - if ! diff $file $1/$file; then - echo updating $file - cp -af $1/$file $file + + if [[ -e "$file" && -e "$1/$file" ]]; then + + if [ ! -d "$file" ] && [ ! -s "$file" ]; then + if ! diff $file $1/$file; then + echo updating $file + cp -af $1/$file $file + fi + elif [ -s "$file" ]; then + if [ "`readlink $file`" != "`readlink $1/$file`" ]; then + rm -f $file + ln -s \"`readlink $1/$file`\" $file + fi fi + perms="`numeric_perm $1/$file`" owner="`get_owner $1/$file`" group="`get_group $1/$file`" echo "$file;$owner;$group;$perms" >> $TEMPLATE_BASE.perms + else - if [ ! -f "$file" ]; then - echo $BASENAME: warning: missing file $file - else - echo $BASENAME: warning: missing template file $1/$file + if [ ! -e "$1/$file" ]; then + echo $BASENAME: warning: missing file $1/$file fi fi + done } |