improved the bindfs library to make it easier to mount and unmount
now will call nemo at the mountpoint as wellmaster
parent
3be1dc8325
commit
1505382d97
|
@ -28,7 +28,7 @@ mounted () {
|
|||
|
||||
dir_bind_unmount () {
|
||||
local usesudo
|
||||
local mp=$1
|
||||
local mp=${1:-$PWD}
|
||||
[[ ! $(mounted $mp) ]] && echo no mountpoint at $mp && mp=$BFS_MOUNT_DIR/$(basename $mp)
|
||||
[[ ! $(mounted $mp) ]] && echo no mountpoint at $mp either, aborting && return 1
|
||||
[[ $EUID -ne 0 ]] && usesudo=sudo
|
||||
|
@ -68,18 +68,22 @@ if [[ $(mounted $mp) ]]; then
|
|||
echo "to unmount use: dir_bind_unmount $mp or bfsum $mp"
|
||||
else
|
||||
echo unable to mount $dir at $mp as user $user
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dir_bind () {
|
||||
mp=${2:-$BFS_MOUNT_DIR/$(basename $1)}
|
||||
dir_bind_user $USER $1 $mp
|
||||
dir=${1:-$PWD}
|
||||
mp=${2:-$BFS_MOUNT_DIR/$(basename "$dir")}
|
||||
dir_bind_user $USER $dir $mp
|
||||
if [ -v PS1 ]; then
|
||||
echo enter \"u\" when you ready to unmount, otherwise any other key will leave mounted
|
||||
read -n1 ans
|
||||
echo -e "\n"
|
||||
[[ $ans == "u" ]] && dir_bind_unmount $mp
|
||||
if [[ $BFSEDIT ]]; then /opt/bin/vscode $mp 1>/dev/null ; else xdg-open $mp; fi
|
||||
echo $BFSEDIT
|
||||
echo enter \"u\" to unmount, otherwise any other key will leave mounted
|
||||
unset BFSEDIT
|
||||
read -n1 ans
|
||||
echo -e "\n"
|
||||
[[ $ans == "u" ]] && dir_bind_unmount $mp
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -92,18 +96,10 @@ dir_bind_user $1 $2 $2
|
|||
}
|
||||
|
||||
bfs_vscode () {
|
||||
mp=${2:-$BFS_MOUNT_DIR/$(basename $1)}
|
||||
dir_bind_user $USER $1 $mp
|
||||
/opt/bin/vscode $mp
|
||||
if [ -v PS1 ]; then
|
||||
echo when you ready to unmount FIRST close your vscode window then enter \"u\"
|
||||
echo otherwise any other key will leave mounted
|
||||
read -n1 ans
|
||||
echo -e "\n"
|
||||
[[ $ans == "u" ]] && dir_bind_unmount $mp
|
||||
fi
|
||||
|
||||
BFSEDIT="When done editing FIRST close your vscode window then"
|
||||
dir_bind "$@"
|
||||
}
|
||||
|
||||
|
||||
(return 0 2>/dev/null) || dir_bind_user $@
|
||||
|
||||
|
|
Loading…
Reference in New Issue