NFS,SAMBA probing support for stage3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



locate_stage3.sh now supports. NFS and SAMBA
support. for stage3 sources.
HTTP framework ready..but not fully supported.

Regards
Harshavardhana
? locate-stage3.diff
Index: stage2/skel-master/etc/stage2/locate_stage3.sh
===================================================================
RCS file: /sources/gluster/gluster-alpha1/stage2/skel-master/etc/stage2/locate_stage3.sh,v
retrieving revision 1.5
diff -p -u -r1.5 locate_stage3.sh
--- stage2/skel-master/etc/stage2/locate_stage3.sh	21 Feb 2006 12:48:13 -0000	1.5
+++ stage2/skel-master/etc/stage2/locate_stage3.sh	6 Apr 2006 18:01:59 -0000
@@ -15,36 +15,66 @@ list_cdrom_devices ()
     done
 }
 
+
 method_nfs ()
 {
     local ip;
-    local exportpoint;
+    local share;
+    local ip_exportpoint;
+    local exportpoint_subdir;
 
     while :
     do
-      ip=$( dialog --inputbox "NFS server IP" 0 0 "${ip}" 2>&1 >&3 ) || return 1;
-      exportpoint=$( dialog --inputbox "NFS server export path" 0 0 "${exportpoint}" 2>&1 >&3 ) || return 1;
-
+      ip_exportpoint=$( dialog --inputbox " Specify NFS share address as \n example: HOSTNAME:/YOURSHARNAME,\n HOSTNAME example: 192.168.0.1 \n
+ NFS server share path " 0 0 "${ip_exportpoint}" 2>&1 >&3 ) || return 1;
+      [ -z "${ip_exportpoint}" ] && { 
+	  dialog --msgbox " Given NFS share path is invalid " 0 0;
+	  continue;
+      }
+      ip=$(echo $ip_exportpoint | cut -f1 -d':');
+      [ -z "{ip}" ] && {
+	  dialog --msgbox " Specified HOSTNAME is invalid... " 0 0;
+	  continue;
+      }
+      share=$(echo $ip_exportpoint | cut -f2 -d':');
+      [ -z "${share}" ] && {
+	  dialog --msgbox " Specified share point is invalid... " 0 0;
+	  continue;
+      }
+      exportpoint_subdir=$( dialog --inputbox " if remote directory path is \n 192.168.0.1:/YOURSHARENAME/Gluster/extensions \n then enter example: /Gluster/extensions \n NFS server subdirectory path " 0 0 "${exportpoint_subdir}" 2>&1 >&3 ) || return 1;
       while :
-      do
+	do
 	/sbin/ip route get "${ip}";
 	[ $? -eq 0 ] && break;
-	dialog --yesno "${ip} is not reachable. configure network?" 0 0 || break
+	dialog --yesno " ${ip} is not reachable. configure network? " 0 0 || break;
 	/etc/stage2/config_network.sh;
       done
       /sbin/ip route get "${ip}";
       [ $? -eq 0 ] || continue;
       mkdir -p /mnt/nfs;
-      mount -t nfs $ip:$exportpoint /mnt/nfs;
+      [ -z "${exportpoint_subdir}" ] && {
+	  mount -t nfs $ip_exportpoint /mnt/nfs;
+	  [ $? -eq 0 ] || {
+	      dialog --msgbox " Could not mount NFS volume from $ip_exportpoint " 0 0;
+	      continue;
+	  }
+	  [ -f /mnt/nfs/core.gex ] || {
+	      dialog --msgbox " $ip_exportpoint is not a valid gluster stage3 directory " 0 0;
+	      umount /mnt/nfs;
+	      continue;
+	  }
+      }
+      mount -t nfs $ip_exportpoint$exportpoint_subdir /mnt/nfs;
       [ $? -eq 0 ] || {
-	  dialog --msgbox " Could not mount NFS volume from $ip:$exportpoint " 0 0;
+	  dialog --msgbox " Could not mount NFS volume from $ip_exportpoint$exportpoint_subdir " 0 0 ;
 	  continue;
       }
       [ -f /mnt/nfs/core.gex ] || {
-	  dialog --msgbox " $ip:$exportpoint is not a valid gluster stage3 export " 0 0;
+	  dialog --msgbox " $ip_exportpoint$exportpoint_subdir is not a valid gluster stage3 directory " 0 0;
 	  umount /mnt/nfs;
 	  continue;
       }
+      
       rm -rf /stage3 && ln -sf /mnt/nfs /stage3;
       [ $? -eq 0 ] || {
 	  dialog --msgbox " Could not create symlink " 0 0;
@@ -54,7 +84,100 @@ method_nfs ()
       return 0;
     done
 }
+method_samba()
+{
+    local ip;
+    local share;
+    local ip_sambapath;
+    local samba_subdir;
+    while :
+    do 
+    ip_sambapath=$( dialog --inputbox " Specify SAMBA share path as \n example : //HOSTNAME/YOURSHARE \n HOSTNAME example: 192.168.0.1 \n SAMBA server path " 0 0 "${ip_sambapath}" 2>&1 >&3) || return 1;
+    ip=$(echo $ip_sambapath | sed -e 's/^.*\/\///' | cut -f1 -d'/');
+    share=$(echo $ip_sambapath | sed -e 's/^.*\/\///' | cut -f2 -d'/');
+    [ -z "${ip_sambapath}" ] && {
+	dialog --msgbox " Given SMB share path is invalid " 0 0;
+	continue;
+    }
+    [ -z "${ip}" ] && {
+	dialog --msgbox " Given Hostname is invalid... " 0 0;
+	continue;
+    }
+    [ -z "${share}" ] && {
+	dialog --msgbox " Given Sharepath is invalid... " 0 0;
+	continue;
+    }
+    samba_subdir=$( dialog --inputbox " If remote directory path is \n /YOURSHARE/Gluster/extensions/ \n example: Gluster/extensions/ \n SAMBA server subdir path " 0 0 "${samba_subdir}" 2>&1 >&3) || return 1;
 
+    while :
+      do
+      /sbin/ip route get "${ip}";
+      [ $? -eq 0 ] && break;
+      dialog --yesno " $ip is not reachable. configure network? " || break;
+      /etc/stage2/config_network.sh
+    done
+    /sbin/ip route get "${ip}";
+    [ $? -eq 0 ] || continue;
+    mkdir -p /mnt/samba;
+    [ -z "${samba_subdir}" ] && {
+	mount -f smbfs $ip_sambapath /mnt/samba;
+	[ $? -eq 0 ] || {
+	    dialog --msgbox " Could not mount SAMBA volume from $ip_sambapath " 0 0;
+	    continue;
+	}
+	[ -f /mnt/samba/core.gex ] || {
+	    dialog --msgbox " $ip_sambapath is not a VALID gluster stage3 directory " 0 0;
+	    umount /mnt/samba;
+	    continue;
+	}
+    }
+    mount -t smbfs $ip_sambapath/$samba_subdir /mnt/samba;
+    [ $? -eq 0 ] || {
+	dialog --msgbox " Could not mount SAMBA volume from $ip_sambapath/$samba_subdir " 0 0;
+	continue;
+    }
+    [ -f /mnt/samba/core.gex ] || {
+	dialog --msgbox " $ip_sambapath/$samba_subdir is not a VALID gluster stage3 subdir " 0 0;
+	umount /mnt/samba;
+	continue;
+    }
+    rm -rf /stage3 && ln -sf /mnt/samba/ /stage3;
+    [ $? -eq 0 ] || {
+	dialog --msgbox " Could not create symlink " 0 0;
+	umount /mnt/samba;
+	continue;
+    }
+ done
+}
+
+method_http()
+{
+    local url;
+    local ip;
+    while :
+      do
+      http_path=$( dialog --inputbox "Specify HTTP server path for example: http://192.168.0.1/share/ \n HTTP server path " 0 0 "${http_path}" 2>&1 >&3 ) || return 1;
+      [ -z "${http_path}" ] && {
+	  dialog --msgbox " Specified HTTP path is invalid... " 0 0;
+	  continue;
+      }
+      ip=$(echo $http_path | sed 's/^.*http:\/\///' | cut -f1 -d'/');
+      subdir_path=$( dialog --inputbox "Specify the subdir path for example: http://192.168.0.1/share/Gluster/extensions/ " 0 0 "${subdir_path}" 2>&1 >&3 ) || return 1;
+      [ -z "${subdir_path}" ] && {
+	  dialog --msgbox " Specified SUBDIR path is invalid ..." 0 0;
+	  continue;
+      }
+      while :
+      do
+      /sbin/ip route get "${ip}";
+      [ $? -eq 0 ] && break;
+      dialog --yesno " $ip is not reachable. configure network? " || break;
+      /etc/stage2/config_network.sh
+      done
+      /sbin/ip route get "${ip}";
+      [ $? -eq 0 ] || continue;
+    done
+}
 method_cdrom ()
 {
     local dev;
@@ -142,10 +265,12 @@ main ()
         "Select method to reach gluster stage3" 0 0 0\
 	"cdrom" "Select Gluster CD/DVD-ROM device"\
         "nfs" "NFS mount stage3 extensions" \
+	"samba" "SAMBA mount stage3 extensions" \
 	"path" "Manually specify stage3 path" 2>&1 >&3) || break;
       [ "${method}" = "cdrom" ] && method_cdrom && break;
       [ "${method}" = "path" ] && method_path && break;
       [ "${method}" = "nfs" ] && method_nfs && break;
+      [ "${method}" = "samba" ] && method_samba && break;
     done
 
     exec /etc/stage2/load_stage3.sh /stage3/core.tgz

[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux