Author Topic: run smbmount script from desktop icon?  (Read 4186 times)

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« on: January 18, 2004, 03:59:29 pm »
I finally got smbmount working and can now mount a directory from my winme machine. That\'s great and I can play mp3\'s or videos. First problem was I had to mount from root. Took care of that with sudo. Then I figured there had to be a way to do it from a desktop icon. I read the faqs here and search the net. I managed to set up an idon and script for the mount & unmount. Problem now: They don\'t work...

The mount command I use is:

/home/root/usr/bin/sudo smbmount //mywimmebox/music /home/zaurus/Documents/mypc -o username=Rich,password=password

This works if I just type it into embeddedkonsole.
To make a script, I just copied that into a text editro, added  #!/bin/sh as the first line and saved it as a script file.
It seems to run? But I can\'t find any log files to help find out why it doesn\'t work and of course I get no messages when run from the icon?

Obviously, I\'m not too familiar with linux. I\'ve run a couple of linux boxes here and plan to very soon again, but I\'m just stumped with this.

If anyone could offer some help or pointers, I\'d greatly appreciate it. Probably somehting as dumb as not getting the smbmount to work in the first place...
Thanks...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
run smbmount script from desktop icon?
« Reply #1 on: January 18, 2004, 05:43:49 pm »
Did you put the script in /opt/QtPalmtop/bin/ ?
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #2 on: January 18, 2004, 10:26:03 pm »
Well, no. I put it in /home/QtPalmtop/bin/, but it shows up in the /opt/... also. The .destop file has \"exec=mountmypc\" with \"mountmypc\" as the script name. No path there, but following various instructions posted elswhere, noone mentioned using a path.

Now I just thought of trying to run the script from the terminal by typing \'bash\' (or \'sh\') followed by the path/script name. It returns an error:
ERRSRV - ERRbad pw (Bad password - name/password pair in a Tree Connect or Session Setup are invalid.) SMB connection failed

That doesn\'t hekp me... The name-password set are obviously correct, but something is going wrong when run as a script. Does it need quotes anywhere? Will this take 3 weeks of studying bash scripting to fix? ;-) I have to find my old redhat books...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

Tehas

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • http://users.adelphia.net/~stonerrl/rick/
run smbmount script from desktop icon?
« Reply #3 on: January 18, 2004, 11:03:37 pm »
You shouldn\'t need to type \'bash\' or \'sh\' before the script name.  Try running just the script name from the terminal prompt.  That should allow you to see any messages that are being displayed.

FYI, here\'s a link to a discussion thread on the Sharp site where I posted the script that I use.  I created my script to toggle between mounting and unmounting the drive.  The left paren \'(\' before the \"checkit\" variable and the right paren \')\' after \"fi\" cause everything in between to be executed as a unit with all of the display output being piped to a log file \"] /tmp/domntbase1.log\"

I\'m also using the Opie-sh package to display dialog boxes at the end to tell me whether the drive was mounted or unmounted.

http://www.zaurus.com/dev/board/index.php?...indpost&p=39776
+SL-5600 v1.32 ROM (Special pre-emptive kernel with overclock)  +Viking 256CF  +SimpleTech 256CF  +Viking 128SD (as ext2)  +AmbiCom WL1100C +Micro Innovations KB  +Hawking Ethernet CF  
+SL6000L +Lexar 1GB SD (as ext2)  +Windows 98/Me/Nt/XP  +Mandrake 8.1 My Zaurus Page[img]http://users.adelphia.net/~stonerrl/rick/rls_userbar.gif\" border=\"0\" class=\"linked-sig-image\" /]

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #4 on: January 19, 2004, 12:07:37 am »
Thanks! I tried the \'bash\' just to see what would happen, hoping for more info...

I typed in the script from your link. It does give me a different message, but not what I was hoping for... Now I get:

bash: /home/zaurus/Documents/application/mountmypc.sh: bad interpreter: No such file or directory

I get the same message no matter what directory I copy & run it from (displayed directory/file changes accordingly) even if I type this command directly into the terminal window.

Now \"bad interpreter\"? I know bash works fine. I have other scripts that work, with and without the .sh extension (tried mine both ways). Would indicate to me that the script is possibly not being recognised as a bash script? I used the test editor to create it and others have worked. So I\'m still at a loss...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #5 on: January 19, 2004, 01:32:55 am »
A quick update...

Other scripts work, mine don\'t... So, I edited an existing script into a test script, just echoing a \"running test\". That ran! Took that test script, pasted in the text from the mount script, and now it runs! The only thing saved from the original script was the first line of \"#!/bin/sh\". How could I type that one wrong?
But at least now I have two icone, one for mount and one for unmount and they work!
For some odd reason, your script that mounts/unmounts will only mount? But I can look into that later...
Thanks...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
run smbmount script from desktop icon?
« Reply #6 on: January 19, 2004, 07:29:29 am »
Quote
Now \"bad interpreter\"?  

If you used a Windows or Sharp ROM text editor you get line feeds added which screw things up.
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #7 on: January 19, 2004, 10:51:24 am »
\"Sharp ROM text editor\"? Arr gees... I took it for granted that would be safe, and what comes up automatically when you \"view as text\"... Okat, two problems solved and I guess I need a new text editor...
Thanks!
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
run smbmount script from desktop icon?
« Reply #8 on: January 19, 2004, 11:10:20 am »
FYI the opie-texteditor doesn\'t do this, ie it edits and saves UNIX-style.

You should be able to find it in the OZ-on-Sharp-ROM-feed (or you could always flash over to OZ ;-) )

Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #9 on: January 19, 2004, 12:54:03 pm »
Thanks. I\'m a little new to the 5600 and don\'t really want to try other OS\'s yet. I did upgrade it to the ver 1.32 rom, but I thought that was \'safer\' as coming from Sharp. I\'m really interested in the updated kernel I read about here, but I\'d have to do a lot more reading before I get into that. It\'s fast enough for me right now ;-) But a real text editor is obviously on the \'need\' list...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

Tehas

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • http://users.adelphia.net/~stonerrl/rick/
run smbmount script from desktop icon?
« Reply #10 on: January 19, 2004, 09:00:12 pm »
The line of code:
Code: [Select]
checkit=`ls /mnt/base1/ | wc -l` counts the number of files that are found on the mount point.  If I have something other than zero, then I unmount; otherwise I mount the drive.
+SL-5600 v1.32 ROM (Special pre-emptive kernel with overclock)  +Viking 256CF  +SimpleTech 256CF  +Viking 128SD (as ext2)  +AmbiCom WL1100C +Micro Innovations KB  +Hawking Ethernet CF  
+SL6000L +Lexar 1GB SD (as ext2)  +Windows 98/Me/Nt/XP  +Mandrake 8.1 My Zaurus Page[img]http://users.adelphia.net/~stonerrl/rick/rls_userbar.gif\" border=\"0\" class=\"linked-sig-image\" /]

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #11 on: January 19, 2004, 10:12:26 pm »
well I checked the \'ls /mnt/base1/ | wc -l\' in konsole and get back 18 if mounted and zero if unmounted. But the script still only mounts and not unmounts. After I figure out what\'s going on with mtab, I\'ll look into this further...
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF

tumnus

  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
    • http://www.cpinkney.org.uk
run smbmount script from desktop icon?
« Reply #12 on: January 20, 2004, 03:32:23 am »
There\'s a bug in smbmount, which turns /etc/mtab into a static file, rather than pointing to /proc/mounts. To fix it, run the following command as root:

ln -sf /proc/mounts /etc/mtab

I put this in my unmount scripts.
# Search the Zaurus Howtos ## Search the Zaurus FAQs ## Find Z software at ELSI #
--------------------
UK SL5500 with Sharp ROM 3.13, SL5600 with Sharp ROM 1.32 - SuSE 9.0 Pro, Windows XP Home
Qualendar for Calendar and Todo
Socket Bluetooth CF Card (Rev F), Kingmax 512MB MMC Card, Palm Tungsten T Stylus,
Pretec CF->Smartmedia Adapter, Semsons Universal Battery Extender

RichS

  • Full Member
  • ***
  • Posts: 146
    • View Profile
    • http://
run smbmount script from desktop icon?
« Reply #13 on: January 20, 2004, 10:14:30 am »
Duh... I never thought of adding that to the unmount script... Thanks, a great dea!
In my other thread about the cf card, whcih turned out to be about mtab, I found that it was smbumount that was apparently changing my mtab, so far. But adding this to the unmount script would be grat insurance!
And thanks for showing me the \'-sf\'. I didn\'t know about the \'f\' part that removes the file. Makes it one step easier!
SL-5600 Sharp v.1.32 ROM
CE-AG06 camera
Linksys WCF-12 wireless CF
D-Link DCF-660W wireless CF (dead!)
Sandisk 64meg SD, 256meg CF
Kingston 512meg CF
Viking 128meg SD, 1 gig CF