commit ce85f0aaa4a48f40b6d3bfabdc6628f6256a7da8
parent b1208fca609d768e943baf198f3ea70fef23f74c
Author: Jaromil <jaromil@dyne.org>
Date: Fri, 25 Feb 2011 09:58:45 +0100
avoid creating targets for hooks
we require users to have the mount targets for hooks already existing
this behaviour is less intrusive in someone's home that is unconscious of hooks
plus it now supports mount bind of normal files
Diffstat:
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/tomb b/src/tomb
@@ -633,7 +633,6 @@ exec_safe_bind_hooks() {
func "bind-hooks not found in $MOUNTPOINT"
return 1
fi
- typeset -al created
typeset -al mounted
typeset -Al maps
maps=($(<"$MOUNTPOINT/bind-hooks"))
@@ -645,16 +644,16 @@ exec_safe_bind_hooks() {
if [ "${${maps[$dir]}[1]}" = "/" -o "${${maps[$dir]}[1,2]}" = ".." ]; then
error "bind-hooks map format: local/to/tomb local/to/\$HOME. Rolling back"
for dir in ${mounted}; do umount $dir; done
- for dir in ${created}; do rmdir $dir; done
return 1
fi
- if [ ! -d "$HOME/${maps[$dir]}" ]; then
- act "creating $HOME/${maps[$dir]}"
- mkdir -p $HOME/${maps[$dir]}
- created+=("$HOME/${maps[$dir]}")
+ if [ ! -r "$HOME/${maps[$dir]}" ]; then
+ error "bind-hook target not existent, skipping $HOME/${maps[$dir]}"
+ elif [ ! -r "$MOUNTPOINT/$dir" ]; then
+ error "bind-hook source not found in tomb, skipping ${MOUNTPOINT}/${dir}"
+ else
+ mount -o bind $MOUNTPOINT/$dir $HOME/${maps[$dir]}
+ mounted+=("$HOME/${maps[$dir]}")
fi
- mount --bind $MOUNTPOINT/$dir $HOME/${maps[$dir]}
- mounted+=("$HOME/${maps[$dir]}")
done
}