summaryrefslogtreecommitdiffstats
path: root/xlators/mount
diff options
context:
space:
mode:
authorHarshavardhana Ranganath <harsha@gluster.com>2009-07-06 03:39:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-07-06 12:37:05 -0700
commit552c392449eb5ed3d249bea8d4467f817781caf0 (patch)
treecbbee2e8fa3788583c36bb6f1801521d2a1da5b5 /xlators/mount
parent7261ef381a2c3c7bf5ef0ecd2392f7cab9e60e37 (diff)
Modified mount.glusterfs to print usage in case of no mountpoint provided and "-o" options to be agnostic of their position.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/mount')
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in67
1 files changed, 47 insertions, 20 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 7d30ee13a32..95403262015 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -16,8 +16,6 @@
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
-
-
function _init ()
{
# log level definitions
@@ -31,14 +29,13 @@ function _init ()
# set default log level to NORMAL
log_level=$LOG_NORMAL;
+ prefix="@prefix@";
+ exec_prefix=@exec_prefix@;
+ cmd_line=$(echo "@sbindir@/glusterfs");
}
function start_glusterfs ()
{
- prefix="@prefix@";
- exec_prefix=@exec_prefix@;
- cmd_line=$(echo "@sbindir@/glusterfs");
-
if [ -n "$log_level_str" ]; then
case "$log_level_str" in
"ERROR")
@@ -83,21 +80,23 @@ function start_glusterfs ()
fi
if [ -z "$volfile_loc" ]; then
- if [ -n "$transport" ]; then
- cmd_line=$(echo "$cmd_line \
+ if [ -n "$server_ip" ]; then
+ if [ -n "$transport" ]; then
+ cmd_line=$(echo "$cmd_line \
--volfile-server=$server_ip \
--volfile-server-port=$server_port \
--volfile-server-transport=$transport");
- else
- cmd_line=$(echo "$cmd_line \
+ else
+ cmd_line=$(echo "$cmd_line \
--volfile-server=$server_ip \
--volfile-server-port=$server_port");
- fi
- if [ -n "$volume_id" ]; then
- cmd_line=$(echo "$cmd_line --volfile-id=$volume_id");
+ fi
+ if [ -n "$volume_id" ]; then
+ cmd_line=$(echo "$cmd_line --volfile-id=$volume_id");
+ fi
fi
else
- cmd_line=$(echo "$cmd_line --volfile=$volfile_loc");
+ cmd_line=$(echo "$cmd_line --volfile=$volfile_loc");
fi
if [ -n "$log_server" ]; then
@@ -112,20 +111,34 @@ function start_glusterfs ()
cmd_line=$(echo "$cmd_line --volume-name=$volume_name");
fi
-
cmd_line=$(echo "$cmd_line $mount_point");
exec $cmd_line;
}
+function usage ()
+{
+
+echo "Usage: mount.glusterfs <volumeserver>:<volumeid/volumeport> -o <options> <mountpoint>
+Options:
+man 8 mount.glusterfs
+
+To display the version number of the mount helper:
+mount.glusterfs --version"
+
+}
function main ()
{
+ helper=$(echo "$@" | sed -n 's/.*\--[ ]*\([^ ]*\).*/\1/p');
+
options=$(echo "$@" | sed -n 's/.*\-o[ ]*\([^ ]*\).*/\1/p');
+
new_log_level=$(echo "$options" | sed -n 's/.*log-level=\([^,]*\).*/\1/p');
[ -n "$new_log_level" ] && {
log_level_str="$new_log_level";
}
+
log_file=$(echo "$options" | sed -n 's/.*log-file=\([^,]*\).*/\1/p');
transport=$(echo "$options" | sed -n 's/.*transport=\([^,]*\).*/\1/p');
@@ -143,7 +156,7 @@ function main ()
log_server=$(echo "$options" | sed -n 's/.*log-server=\([^,]*\).*/\1/p');
log_server_port=$(echo "$options" | sed -n 's/.*log-server-port=\([^,]*\).*/\1/p');
-
+
volfile_loc="$1";
[ -r "$volfile_loc" ] || {
@@ -175,10 +188,24 @@ function main ()
-e 's/[,]*volume-id=[^,]*//' \
-e 's/[,]*log-server=[^,]*//' \
-e 's/[,]*log-server-port=[^,]*//');
- # following line is product of love towards sed
- # $2=$(echo "$@" | sed -n 's/[^ ]* \([^ ]*\).*/\1/p');
-
- mount_point="$2";
+
+ #
+ [ -n "$helper" ] && {
+ cmd_line=$(echo "$cmd_line --$helper");
+ exec $cmd_line;
+ exit 0;
+ }
+
+ mount_provided=$(echo "$@" | cut -f2 -d'/');
+
+ [ -n "$mount_provided" ] && {
+ mount_point="/$mount_provided";
+ }
+
+ [ -z "$mount_point" ] && {
+ usage;
+ exit 0;
+ }
# Simple check to avoid multiple identical mounts
if grep -q " $mount_point fuse" /etc/mtab; then