shell-base/modules/sshfs/sshfs.sh

32 lines
708 B
Bash
Executable File

#!/bin/bash
# depends on sshfs fuse for ssh
function smount(){
MOUNTED=$(mountpoint "$2" | grep not)
if [ -z "$MOUNTED" ]; then
echo "remote $1 already mounted at $2, aborting mount"
else
echo "mounting $1 at $2 via ssh"
sshfs $1 $2 $3 $4 -o default_permissions
fi
}
function usmount(){
MOUNTED=$(mountpoint $1 | grep not)
if [ -z "$MOUNTED" ]; then
echo "unmounting remote file system at $1"
fusermount -u $1
else
echo "nothing mounted at $1, aborting unmount"
fi
}
DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi
for f in $DIR/*; do
if [ ${f: -4} != ".off" ] && [ $(basename $f) != "sshfs.sh" ] && [ ! -d "$f" ] ; then
# echo 'loading mount functions for '$f
. $f
fi
done