aboutsummaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-05 14:49:00 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-04-05 14:49:00 +0000
commit6b0c8ed25ebb4379079954301b48bd2d11cf3382 (patch)
tree916e4bcfd987e386a4b81c8464e8a011127f2657 /trunk/src
parent4836ee41d746322e1c2586a96fa53f86cc587578 (diff)
downloadsimplepkg-6b0c8ed25ebb4379079954301b48bd2d11cf3382.tar.gz
simplepkg-6b0c8ed25ebb4379079954301b48bd2d11cf3382.tar.bz2
jail-commit: template_merge with symlink support
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@239 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src')
-rwxr-xr-xtrunk/src/jail-commit26
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
}