Added an option for listing available .map files and (u)mounting only given .map files.

git-svn-id: https://websvn.glenux.net/svn/Upoc/sshfs-mapper/trunk@1384 eaee96b3-f302-0410-b096-c6cfd47f7835
This commit is contained in:
Glenn Y. Rolland 2009-06-09 08:28:24 +00:00
parent 388f31cd24
commit b9dc51d07f
2 changed files with 26 additions and 14 deletions

12
debian/changelog vendored
View file

@ -1,14 +1,10 @@
sshfs-mapper (0.1-4.3) unstable; urgency=low
sshfs-mapper (0.2) unstable; urgency=low
* .map parser was buggy with some kind of whitespaces.
* Added an option for listing available .map files.
* Added an option for (u)mounting only given .map files.
-- <warbrain@daneel.glenux.net> Fri, 20 Mar 2009 17:49:17 +0100
sshfs-mapper (0.1-4.2) unstable; urgency=low
* Changed interpreter to /bin/sh instead of /bin/bash .
-- Glenn ROLLAND <glenux@glenux.net> Tue, 30 Dec 2008 08:06:10 +0100
-- Glenn Y. Rolland <glenux@192.168.46.180> Tue, 09 Jun 2009 10:26:49 +0200
sshfs-mapper (0.1-4.1) unstable; urgency=low

View file

@ -100,8 +100,11 @@ EOF
## Parse options and mount/umount
##
SSHFS_HOST_PATTERN=" "
SSHFS_HOST_LIMIT=0
SSHFS_HOST_LIST=0
#TODO:while getopts h:u o
while getopts hiu o
while getopts hiuls: o
do
case "$o" in
i) # init (copy config files in user HOME)
@ -111,10 +114,15 @@ do
echo "Umounting..."
SSHFS_MOUNT=0
;;
# s) # only selected hosts
# #SSHFS_HOST_SELECTION=1
# SSHFS_HOST_PATTERN="$OPTARG"
# ;;
s) # only selected hosts
#SSHFS_HOST_SELECTION=1
SSHFS_HOST_PATTERN+="$OPTARG "
SSHFS_HOST_LIMIT=1
;;
l)
SSHFS_HOST_LIST=1
;;
h)
do_usage
;;
@ -144,9 +152,17 @@ mountpoint=$( read_conf "$SSHFS_CONFIG" MOUNTPOINT )
echo "Edit mountpoint definition in \"$SSHFS_CONFIG\"" >&2
exit 1;
}
echo "MOUNTPOINT=$mountpoint"
for map_file in `find "$SSHFS_DIR" -type f -name '*.map' `; do
if [ $SSHFS_HOST_LIST -eq 1 ]; then
basename ${map_file/.map/}
continue
fi
if [ $SSHFS_HOST_LIMIT -eq 1 ]; then
if ! echo "$SSHFS_HOST_PATTERN" | grep -q " `basename ${map_file/.map/}` " ; then
continue
fi
fi
remote_host=$( read_conf $map_file REMOTE_HOST )
remote_user=$( read_conf $map_file REMOTE_USER )
remote_port=$( read_conf $map_file REMOTE_PORT )