commit 7a85292456fcfa45d634dfb487680ce662f380f0 parent edc68be543a40a51c6881091c3f4d031685c70d4 Author: Jan Pobrislo <ccx@webprojekty.cz> Date: Thu, 25 Jun 2015 18:22:16 +0200 bind mount support Diffstat:
| M | zsh-functions/confz_fs_init | | | 16 | +++++++++++++++- |
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/zsh-functions/confz_fs_init b/zsh-functions/confz_fs_init @@ -379,7 +379,7 @@ confz_fstab_check() { sed '/^[ \t]*#/d;s/#.*//;s/[ \t]\+/ /g' /etc/fstab | \ while read device mountpoint filesystem opts dump pass; do if [[ $mountpoint == ${vars[mountpoint]} ]]; then - [[ $device == ${vars[device]} ]] || \ + [[ $device == ${vars[device]} && opts != *bind* ]] || \ die "$0: $mountpoint already present" \ "with different device than ${(qqq)vars[device]}" @@ -426,6 +426,20 @@ confz_mounted_do() { } +# make device mounted on mountpoint +confz_bind_mounted_check() { + checkvars device origin mountpoint + + fail_reason="could not find ${vars[device]} ${vars[mountpoint]} in /proc/mounts" + grep -q "^${vars[device]} ${vars[mountpoint]} " /proc/mounts +} + +confz_bind_mounted_do() { + mkdir -p ${vars[mountpoint]} || return $? + mount --bind "$@" ${vars[origin]} ${vars[mountpoint]} +} + + # create LVM2 logical volume, and make sure it's in fstab and mounted confz_mounted_volume_check() { checkvars lv_name label