SliTaz SliTaz Forum

You are not logged in.

#1 2012-03-06 08:03:10

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Script for mount smb share folder

You need to install smbfs and load cifs module (modprobe cifs)

#!/bin/sh

#

# function: Mount smb share on SliTaz

# rev: 0.1

# author: Shannara <Stanislas Leduc>

# Licence: GPL v2</p>

<p># Read Server SMB IP

read -p "Please enter IP of Server SMB: " address</p>

<p># Read Folder Share

read -p "Please enter the name of share folder: " sharefolder</p>

<p># Read Local Mount Folder

read -p "Please enter the path of mount folder (with /): " localfolder</p>

<p># Read Domain Name

read -p "Please enter the DOMAIN NAME: " domain</p>

<p># Read USERNAME

read -p "Please enter the USERNAME: " user</p>

<p># Read PASSWORD

read -p "Please enter the PASSWORD: " passwd</p>

<p># Mount share folder

mount.cifs //$address/$sharefolder $locafolder -o user,sync,domain=$domain,user=$user,password=$passwd

Offline

#2 2012-03-07 07:53:49

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

I think developing a program in the same kind of WifiBox for the SMB share.

Indeed have no graphical tool included in SliTaz.

For that it is integrating in SliTaz Core, I will develop in gtkdialog.

Offline

#3 2012-03-07 14:17:32

claudinei
Administrator
Registered: 2011-03-29
Posts: 102

Re: Script for mount smb share folder

Use yad wink

http://hg.slitaz.org/slitaz-dev-tools/raw-file/tip/tazyad/README

Read the tazbox script to get how it works:

http://hg.slitaz.org/slitaz-tools/file/tip/tazbox/tazbox

Offline

#4 2012-03-10 12:04:23

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

smbbox progress.

I use yad and use wifibox script as example.

sharefolder and description are listed automatically (with function).

but I blocked with function.

(test.sh for test functions)

http://paste.slitaz.org/23

but:

desc1="Home Directories": command not found

desc2="Test Directory": command not found

If use do echo desc$i="\"[c]sed -n $i'p' desc.file[/c]""\"" its work but display only not variable affected:

desc1="Home Directories"

desc2="Test Directory"

Offline

#5 2012-03-17 13:50:33

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

SmbBox work, its was version 0.95.

I test and check code for 1.0RC

Offline

#6 2012-03-17 15:20:15

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: Script for mount smb share folder

Good job shann.

Depends: linux-cifs smbfs smbclient

#modprobe cifs

#wget http://people.slitaz.org/~shann/wok/smbbox/smbbox -P  /usr/bin

#chmod +x /usr/bin/smbbox

#smbbox

Feedback:

Mkdir sharename for share mount point so multiple mounts are possible.

Inform user of option to use server name or i.p.address :

Please enter smb server name or i.p. address

Offline

#7 2012-03-17 16:03:34

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

the latest version is 0.97:

  - it possible to mount multiple share folder (/tmp/partage/SLITAZ/sharedir)

     /tmp/partage/SLITAZ/homes; /tmp/partage/FREEBOX/Disque dur;

  - smbbox-notify for show sharedir mounted and umount

  - it possible to umount share (bug for show share folder mounted)

Use http://people.slitaz.org/~shann/smbbox for use current version

the wok it for later when build package

I change links in index.html

Offline

#8 2012-03-17 18:23:49

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: Script for mount smb share folder

Version 0.97 and 0.95

Smbbox make's the mount directory path before the dialog that asks if a password in required but does not mount the share.

This is the only error:

Couldn't chdir to "/tmp/partage/192.168.1.2/Storage": No such file or directory

Offline

#9 2012-03-17 19:18:33

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

Fixed

I try,  it's work perfectly

only error is echo sharedir, fixed in echo $sharedir.

Your error is only if you launch smbbox with root account

Not necessary for smbbox script.

root right is only requiert for mount.cifs command (tazbox su is utilized)

For test  I use SliTaz Live Core CD (4.0RC2)

Offline

#10 2012-03-17 20:50:28

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: Script for mount smb share folder

Mounts when I start smbbox as regular user.

I start smbbox-notify in terminal.

Left click notification,double click my mounted share to unmount:

Password:

unmount error 16 = Device or resource busy

Refer to the umount.cifs(8) manual page (man 8 umount.cifs)

I add -lf

tazbox su "umount.cifs -lf [c]echo $mountpoint[/c]"

Listing of mounted share folder is not removed from Smb Share box after umounting.

What will start smbbox-notify ?

Offline

#11 2012-03-17 20:59:00

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

yes, listing of mounted share folder in smbbox-notify isn't really functionnal.

You umount share but not remove in the listing.

For unmount error 16 = Device or resource busy

Refer to the umount.cifs(8) manual page (man 8 umount.cifs)

pcmanfm onglet with closed for umount share folder.

Offline

#12 2012-03-17 21:19:42

mojo
Administrator
Registered: 2011-03-29
Posts: 2,174

Re: Script for mount smb share folder

nano ~/.config/openbox/autostart.sh

Add to bottom:

#smbbox launcher

smbbox-notify

save/exit

logout/in

Rt/click notification icon: SmbBox

Works great.

Offline

#13 2012-04-15 09:54:41

shann
Administrator
Registered: 2011-04-01
Posts: 1,296
Website

Re: Script for mount smb share folder

Hey,

the latest version available is 0.99:

- it possible to mount multiple share folder (/tmp/partage/SLITAZ/sharedir)

/tmp/partage/SLITAZ/homes; /tmp/partage/FREEBOX/Disque dur;

- smbbox-notify for show sharedir mounted and umount

- it possible to umount share (bug for show share folder mounted)

   Mojo: Listing of mounted share folder is not removed from Smb Share box after umounting.

     => Fixed in current version (0.99).

Use http://people.slitaz.org/~shann/smbbox/current for use current version

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.017 seconds, 7 queries executed - Memory usage: 1.56 MiB (Peak: 1.77 MiB) ]