#!/bin/bash # # Mount SMB Share # # This should be installed under $HOME/.gnome2/nautilus-scripts # It does not have (as of yet) an umounting capability. # # You are advised to read http://g-scripts.sourceforge.net/faq.php # This script is not different than "smbmount" found there, but it aims to # evolve to something better. # # Tested on Ubuntu 5.10, requires smbfs (run: sudo apt-get install smbfs) # # Yiorgos Adamopoulos, 2005/12/16 if [ ! -d ${HOME}/Desktop/Network ]; then mkdir ${HOME}/Desktop/Network fi # get the windows share name for i in $NAUTILUS_SCRIPT_SELECTED_URIS do wMount_=${i} break; done wMount=`echo ${wMount_} | sed -e 's#smb:##'` # decide the local target name wTarget=${wMount/*\/} if [ ! -d ${HOME}/Desktop/Network/${wTarget} ]; then mkdir ${HOME}/Desktop/Network/${wTarget} fi # get the windows username wUsername=`zenity --entry --width=300 --title="Mount $wMount" --text="Username:"` if [ $? -ne 0 ]; then exit 1 fi # get the windows password wPassword=`zenity --entry --width=300 --title="Mount $wMount" --text="Password:" --hide-text` if [ $? -ne 0 ]; then exit 1 fi gksudo mount sudo smbmount $wMount ${HOME}/Desktop/Network/${wTarget} -o username=${wUsername},password=${wPassword} if [ $? -eq 0 ]; then zenity --info --title="Mount OK!" --text="Mount OK!" else zenity --error --title="Mount Failed!" --text="Mount Failed!" fi nautilus --no-desktop ${HOME}/Desktop/Network/${wTarget}