45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
|
|
function bumount {
|
|
echo "removing bind mount at $1"
|
|
notify-send "removing bind mount at ${1}" --icon=dialog-information -t 2000
|
|
fusermount -u "$1"
|
|
}
|
|
|
|
function bmount {
|
|
if [ "$1" == "-d" ]; then
|
|
bumount $2
|
|
else
|
|
# if [[ " ${array[@]} " =~ " ${value} " ]]; then
|
|
# # whatever you want to do when array contains value
|
|
# fi
|
|
# mp="${@: -2}"
|
|
echo mounting $@
|
|
bindfs $@
|
|
fi
|
|
}
|
|
|
|
# must have fuser and bindfs installed
|
|
# for use by sudoers
|
|
# ln -s $BASH_SHELL_HOST/all/modules/bind-mount/bind-mount.sh /opt/bin/bmount
|
|
# function xxbmount () {
|
|
# if [ "$1" == "-mp" ]; then
|
|
# MOUNTED=$(mountpoint "$2" | grep not)
|
|
# if [ -z "$MOUNTED" ]; then
|
|
# echo $2 is a mount point so bind mounting $2/$3 to $4
|
|
# notify-send "bind mounting ${2}/${3} to ${4}" --icon=dialog-information -t 2000
|
|
# bindfs "$2/$3" "$4"
|
|
# else
|
|
# notify-send "${2} not a mount point - Unable to bind mount ${2}/${3} to ${4}" --icon=dialog-error -t 2000
|
|
# fi
|
|
# else
|
|
# echo bind mounting $1 to $2
|
|
# notify-send "bind mounting ${1} to ${2}" --icon=dialog-information -t 2000
|
|
# bindfs "$1" "$2"
|
|
# fi
|
|
# }
|
|
|
|
# if script was executed then call the function
|
|
(return 0 2>/dev/null) || bmount $@ |