From 6b0c8ed25ebb4379079954301b48bd2d11cf3382 Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 5 Apr 2007 14:49:00 +0000 Subject: jail-commit: template_merge with symlink support git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@239 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/jail-commit | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'trunk/src') 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 } -- cgit v1.2.3