mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-25 22:27:34 +00:00
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
This commit is contained in:
parent
b1208fca60
commit
ce85f0aaa4
15
src/tomb
15
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user