maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2007 / Maemo 3 / Bora (https://talk.maemo.org/forumdisplay.php?f=23)
-   -   Help with init script to mount CIFS (https://talk.maemo.org/showthread.php?t=11109)

Airw0lf 2007-10-29 09:51

Help with init script to mount CIFS
 
Following the steps here: http://maemo.org/community/wiki/howtoaccesswindowscifs/ I have been able to get CIFS working. What I want to do next is use an init script to automatically mount and umount the share on boot/shutdown.

This is what I have made in /etc/init.d/

Code:

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

case "$1" in
  start)
        insmod /mnt/initfs/lib/modules/cifs.ko
        mount -t cifs //192.168.1.x/Hdd /home/user/MyDocs/.documents/nslu2 -o domain=Workgroup,user=user,password=password
        ;;
  stop)
        umount /home/user/MyDocs/.documents/nslu2
        ;;
  *)
        echo "error"
        ;;
esac

I can type ./cifs start and ./cifs stop and everything works like a charm. But when I boot up, nothing has happened.

By the way, I am trying to connect to a file share on my linksys NSLU2 - another really nifty linux device.

What am I doing wrong? I know the path is often a thorn in the side of linux scripts, but I think I've declared just about everything!

fanoush 2007-10-29 11:08

Re: Help with init script to mount CIFS
 
Perhaps the network is not connected at the boot time yet?

Airw0lf 2007-10-29 11:38

Re: Help with init script to mount CIFS
 
Quote:

Originally Posted by fanoush (Post 88265)
Perhaps the network is not connected at the boot time yet?

Hmm actually that is a distinct possibility. The GUI only displays "connected to Blah" well after everything else has booted up. Thanks for pointing out a very obvious point I missed.

In that case it's not an obstacle that can be easily surmounted.

Unless there is a way to run the script after the network is up? On some linux distributions you can number init scripts like S10, S20, S30 etc. That doesn't seem to be the case for the N800.

By the way, do you know how to set permissions so that the mounted folder is browsable in the File Manager by a non-root user?

My /nslu2 was created as a regular user. But once I mount it as root (I need to be root to use mount), the owner and group becomes 501/501. Is it safe to try chown and chgroup to put it back to user/users?

fanoush 2007-10-29 12:47

Re: Help with init script to mount CIFS
 
Quote:

Originally Posted by Airw0lf (Post 88269)
Unless there is a way to run the script after the network is up?

yes, search this forum for some dbus related hackery. it was used for setting up bluetooth PAN. There is no ifup script automatically called by system when some interface comes up.

Quote:

Originally Posted by Airw0lf (Post 88269)
My /nslu2 was created as a regular user. But once I mount it as root (I need to be root to use mount), the owner and group becomes 501/501. Is it safe to try chown and chgroup to put it back to user/users?

This is CIFS or NFS mount? I heard this is feature of NFS and is hard to workaround. As for CIFS I don't know about such problem, maybe you can turn off something related to users in samba on NSLU side?

Airw0lf 2007-10-30 06:16

Re: Help with init script to mount CIFS
 
Quote:

Originally Posted by fanoush (Post 88282)
This is CIFS or NFS mount? I heard this is feature of NFS and is hard to workaround. As for CIFS I don't know about such problem, maybe you can turn off something related to users in samba on NSLU side?

CIFS. I'm using mount -t cifs, and it seems to work, so I presume it's CIFS...


All times are GMT. The time now is 17:05.

vBulletin® Version 3.8.8