From 47196f2dfb0dfa4fb3fadb7613ff8f0d6049abaf Mon Sep 17 00:00:00 2001 From: glenux Date: Tue, 9 Jun 2009 08:28:24 +0000 Subject: [PATCH] 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 --- debian/changelog | 12 ++++-------- sshfs-mapper | 28 ++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0942ec2..3737d66 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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. - -- 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 Tue, 30 Dec 2008 08:06:10 +0100 + -- Glenn Y. Rolland Tue, 09 Jun 2009 10:26:49 +0200 sshfs-mapper (0.1-4.1) unstable; urgency=low diff --git a/sshfs-mapper b/sshfs-mapper index ec9e1fa..702d4d0 100644 --- a/sshfs-mapper +++ b/sshfs-mapper @@ -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 )