|
2010-01-14
, 21:45
|
Posts: 692 |
Thanked: 264 times |
Joined on Dec 2009
|
#82
|
|
2010-01-15
, 10:02
|
Posts: 40 |
Thanked: 4 times |
Joined on Mar 2008
|
#83
|
You need to use Unix encoding (with ANSI characters, to be safe). Notepad++ can do this, or if you make the file on your N900 it should be saved with Unix encoding. I'm 99.9% sure this script should work fine but I haven't tested it on Fremantle so I can't be totally certain.
Edit: just found a problem with the code. Working to fix.
Update: Fixed.
|
2010-01-15
, 13:54
|
Posts: 840 |
Thanked: 823 times |
Joined on Nov 2009
|
#84
|
#! /bin/sh #arguments: servername serverip share username password mountpoint #username, password and mountpoint are optional arguments if [ $# -lt 3 ] ; then #Go into "wizard mode" if there are no arguments echo -e "Not enough arguments passed - running wizard" echo -e "Enter the server name:" read servername echo -e "Enter the server IP" read serverip echo -e "Enter the share name or path" read sharename echo -e "Enter a username, or leave blank for anonymous" read username username_orig=$username if [ "${username}" != "" ]; then echo -e "Enter a password" read password fi echo -e "Enter a mount point, or leave blank for automatic" read mountpoint fi #if arguments were passed from the command line, use them: if [ $# -gt 2 ]; then servername=$1 serverip=$2 sharename=$3 username=$4 username_orig=$username password=$5 mountpoint=$6 fi #set default mountpoint if the user didn't enter one if [ "${mountpoint}" = "" ]; then mountpoint="/media/Remote_Filesystems/$servername@$sharename" #make sure the Remote_Filesystems directory exists mountparentdir="/media/Remote_Filesystems" if [ -d $mountparentdir ]; then echo -e "$mountparentdir found." else echo -e "Creating $mountparentdir" mkdir $mountparentdir fi fi #requote variables to escape special characters servername=$(printf '%q' "$servername") serverip=$(printf '%q' "$serverip") sharename=$(printf '%q' "$sharename") username=$(printf '%q' "$username") password=$(printf '%q' "$password") mountpoint=$(printf '%q' "$mountpoint") #check for mountpoint and create it if it doesn't exist if [ -d $mountpoint ]; then echo -e "Mount point already exists - will attempt to use." else echo -e "Creating mountpoint $mountpoint" mkdir $mountpoint fi echo -e "Attempting to mount //$servername/$sharename at $mountpoint" #Run the mount command if [ "${username_orig}" = "" ]; then mount -t cifs //$servername/$sharename $mountpoint -o user=$username pass=$password ip=$serverip else mount -t cifs //$servername/$sharename $mountpoint -o ip=$serverip fi #chown mountpoint to user chown -R user $mountpoint echo -e "To unmount this share, run umount $mountpoint as root"
The Following 3 Users Say Thank You to Cue For This Useful Post: | ||
|
2010-01-15
, 15:39
|
Posts: 10 |
Thanked: 1 time |
Joined on Jan 2010
|
#86
|
|
2010-01-15
, 18:36
|
Posts: 452 |
Thanked: 522 times |
Joined on Nov 2007
|
#87
|
hi nathan, this is the error message if you specify iocharset=utf8 parameter.
mount: mounting //ip/share on /mnt failed: Can not access a needed shared library
maybe you have seen the error already
|
2010-01-15
, 19:06
|
Posts: 452 |
Thanked: 522 times |
Joined on Nov 2007
|
#88
|
The Following 3 Users Say Thank You to Nathan For This Useful Post: | ||
|
2010-01-15
, 22:50
|
Posts: 692 |
Thanked: 264 times |
Joined on Dec 2009
|
#89
|
#! /bin/sh #arguments: servername serverip share username password mountpoint #username, password and mountpoint are optional arguments if [ $# -lt 3 ] ; then #Go into "wizard mode" if there are no arguments echo -e "Not enough arguments passed - running wizard" echo -e "Enter the server name:" read servername echo -e "Enter the server IP" read serverip echo -e "Enter the share name or path" read sharename echo -e "Enter a username, or leave blank for anonymous" read username username_orig=$username if [ "${username}" != "" ]; then echo -e "Enter a password" read password fi echo -e "Enter a mount point, or leave blank for automatic" read mountpoint fi #if arguments were passed from the command line, use them: if [ $# -gt 2 ]; then servername=$1 serverip=$2 sharename=$3 username=$4 username_orig=$username password=$5 mountpoint=$6 fi #set default mountpoint if the user didn't enter one if [ "${mountpoint}" = "" ]; then mountpoint="/media/Remote_Filesystems/$servername@$sharename" #make sure the Remote_Filesystems directory exists mountparentdir="/media/Remote_Filesystems" if [ -d $mountparentdir ]; then echo -e "$mountparentdir found." else echo -e "Creating $mountparentdir" mkdir $mountparentdir fi fi #requote variables to escape special characters servername=$(printf '%q' "$servername") serverip=$(printf '%q' "$serverip") sharename=$(printf '%q' "$sharename") username=$(printf '%q' "$username") password=$(printf '%q' "$password") mountpoint=$(printf '%q' "$mountpoint") #check for mountpoint and create it if it doesn't exist if [ -d $mountpoint ]; then echo -e "Mount point already exists - will attempt to use." else echo -e "Creating mountpoint $mountpoint" mkdir $mountpoint fi echo -e "Attempting to mount //$servername/$sharename at $mountpoint" #Run the mount command if [ "${username_orig}" != "" ]; then mount -t cifs //$servername/$sharename $mountpoint -o user=$username pass=$password ip=$serverip else mount -t cifs //$servername/$sharename $mountpoint -o ip=$serverip fi #chown mountpoint to user chown -R user $mountpoint echo -e "To unmount this share, run umount $mountpoint as root"
The Following User Says Thank You to GameboyRMH For This Useful Post: | ||
|
2010-01-15
, 23:13
|
|
Posts: 210 |
Thanked: 178 times |
Joined on Jan 2010
|
#90
|
Noob instructions:[/B] Copy contents, save it as something like say "cifsmount", then run "chmod u+x cifsmount." You need to run this script as root, so with rootsh installed run "sudo gainroot." You can then either run it in "wizard mode" by running "./cifsmount" or pass arguments to it like "./cifsmount myhomeserver 192.168.254.10 mysharedfolder myusername mypassword /mount/point" (arguments are all documented in the code comments)
Username, password and mountpoint are all optional. You must specify a username and password to use a custom mountpoint if you're doing it with arguments, but if you're connecting to an anonymous share you can put anything in those fields.
By default it uses the same mountpoints as Wizard Mounter: /media/Remote_Filesystems/servername@share. You have to unmount manually: "umount /media/Remote_Filesystems/whatever@whatever." The script will tell you exactly what at the end.
when i run cifsmount in /home/user folder i get not found error so i tried
sh /home/user/cfsmount and i now got syntax eror on line 4 . i have copied and used editplus to save it. is there any encoding type i need to use to save this script? i'm on windows