sshfs-mapper: Added verbosity option.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1623 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
glenux 2010-05-22 17:52:19 +00:00
parent 0a090db765
commit 73410ea881

View file

@ -32,6 +32,7 @@ do_mount() {
local localdir=$2 local localdir=$2
local remoteport=$3 local remoteport=$3
set -x
sshfs \ sshfs \
-o allow_root \ -o allow_root \
-o idmap=user \ -o idmap=user \
@ -46,6 +47,7 @@ do_mount() {
-o Port=$remoteport \ -o Port=$remoteport \
$remotedir \ $remotedir \
$localdir $localdir
set +x
#-o compression=yes #-o compression=yes
} }
@ -65,6 +67,7 @@ Usage: `basename $0` [options]
-a, --all Use all maps. -a, --all Use all maps.
-s, --select <map> Only use specified map. -s, --select <map> Only use specified map.
-u, --umount Umount user maps (mount if not specified). -u, --umount Umount user maps (mount if not specified).
-v, --verbose Be verbose.
EOF EOF
exit 1 exit 1
} }
@ -109,6 +112,7 @@ SSHFS_HOST_PATTERN=" "
SSHFS_HOST_LIMIT=0 SSHFS_HOST_LIMIT=0
SSHFS_HOST_LIST=0 SSHFS_HOST_LIST=0
SSHFS_HOST_AUTO=0 SSHFS_HOST_AUTO=0
SSHFS_VERBOSE=0
OPTFOUND=0 OPTFOUND=0
while true while true
do do
@ -117,39 +121,42 @@ do
shift shift
OPTARG=${1:-} OPTARG=${1:-}
#echo "$OPT?" #echo "$OPT?"
case "$OPT" in case "$OPT" in
--all|-a) # mount all --verbose|-v) #be verbose
SSHFS_HOST_AUTO=1 SSHFS_VERBOSE=1
OPTFOUND=1 ;;
;; --all|-a) # mount all
--init|-i) # init (copy config files in user HOME) SSHFS_HOST_AUTO=1
do_initialize OPTFOUND=1
OPTFOUND=1 ;;
;; --init|-i) # init (copy config files in user HOME)
--umount|-u) # umount do_initialize
echo "Umounting..." OPTFOUND=1
SSHFS_MOUNT=0 ;;
OPTFOUND=1 --umount|-u) # umount
;; echo "Umounting..."
--select|-s) # only selected hosts SSHFS_MOUNT=0
SSHFS_HOST_PATTERN="${SSHFS_HOST_PATTERN}${OPTARG} " OPTFOUND=1
SSHFS_HOST_LIMIT=1 ;;
shift --select|-s) # only selected hosts
OPTFOUND=1 SSHFS_HOST_PATTERN="${SSHFS_HOST_PATTERN}${OPTARG} "
;; SSHFS_HOST_LIMIT=1
--list|-l) shift
SSHFS_HOST_LIST=1 OPTFOUND=1
OPTFOUND=1 ;;
;; --list|-l)
--help|-h) SSHFS_HOST_LIST=1
do_usage OPTFOUND=1
OPTFOUND=1 ;;
;; --help|-h)
*) do_usage
do_usage OPTFOUND=1
OPTFOUND=1 ;;
;; *)
esac do_usage
OPTFOUND=1
;;
esac
done done
if [ $OPTFOUND -eq 0 ]; then if [ $OPTFOUND -eq 0 ]; then
do_usage do_usage