[SOLVED] smb_userdata

Here for general support for E series TVs, request and problem solve area.

miazza
SamyGO Project Donor
Posts: 773
Joined: Wed Apr 03, 2013 6:10 pm

Re: smb_userdata

Post by miazza »

zdzi wrote:That's simple.

In the 04_04_samba.init file

Find the case statement near the end of the file
Then after the insmod line, after the mkdir line put in your mount command.

If that share is all you need you can get rid of getservers and getshares lines in that section.

Btw really happy for you. Getting things working is a buzz :)
You mean like this ?

Code: Select all

case $1 in 
	start)
	insmod $MOD_DIR/kernel/fs/cifs/cifs.ko
	mkdir -p "$DEST_DIR"
	get_servers
	get_shares
	mount -o username=guest,password=,nounix,sec=ntlmssp -t cifs //192.168.1.5/PUBLIC /dtv/usb/sda/smb
	;;
	stop)
	# may can fail if device access the mount from content library
	# for i in $(cat /proc/mounts | grep cifs | cut -d " " -f2) ; do
	for i in $(cat /proc/mounts | grep cifs | grep "$DEST_DIR" | sed 's/^\(.*\) \(.*\) cifs .*/\2/') ; do
		i="$(echo -n $i | sed -r 's/\\040/ /g')"
		/bin/busybox umount "$i"
	done
	;;
	status)
	/bin/mount | grep "$DEST_DIR"
	;;
	*)
	echo "Usage: $0 {start|stop}" 1>&2
	exit 0
	;;
esac
I wander if it is not sufficient to specify the nounix,sec=ntlmssp somewhere in the script or better in the smb.conf so that any future share is also mounted automathically like:

Code: Select all

M_OPTS="$PERM,user=${USER},password=${PASSWD},codepage=cp1250,iocharset=utf8",nounix,sec=ntlmssp
and specify the user=guest at the beginning of the script:

Code: Select all

##### CHANGE MEEEEE !!!!! ######
USER="guest"
PASSWD=
PERM="rw" # can be ro or rw
##### CHANGE MEEEEE END ######
AVOID TO PUBLISH AND DISCLOSE SAMYGO PROJECTS ON OTHER FORUM.
zdzi
Posts: 46
Joined: Sat Aug 06, 2011 3:18 pm

Re: smb_userdata

Post by zdzi »

Yes but without the getservers getshares lines. But if you want to keep them then you can add the special mount parameters in the do_mount function. But why? Most shares won't need them. Or better said, no idea of the effect of those parameters on 'normal' shares.

You would test the mount manually to see then add the correct mount command in the samba.init. Unless one has a dynamic, frequently changing server and share environment or many servers then I think the getshares and getservers is overkill.
zdzi
Posts: 46
Joined: Sat Aug 06, 2011 3:18 pm

Re: smb_userdata

Post by zdzi »

Ah yes, you're right, better place would be in M_OPTS if you want it auto on every identified share
miazza
SamyGO Project Donor
Posts: 773
Joined: Wed Apr 03, 2013 6:10 pm

Re: smb_userdata

Post by miazza »

OK. END OF THE GAME. FINALLY I WON :D

I attach the 04_04_samba.init modified as I needed:

Code: Select all

#!/bin/sh
#
# ? Copyright 1996-2010, ZsoltTech.Com
#       by Ser Lev Arris <arris@ZsoltTech.Com>
#
#       donated for the SamyGo Project
#       http://samygo.sourceforge.net/
#
#       Version: SamyGO svn $Id: 04_04_samba.init 1069 2011-01-03 16:47:24Z arris69 $
#

. /dtv/SGO.env
# sleep 9
##### CHANGE MEEEEE !!!!! ######
USER="guest"
PASSWD="none"
PERM="rw" # can be ro or rw
##### CHANGE MEEEEE END ######

[ -e /mtd_rwarea/smb_userdata ] && source /mtd_rwarea/smb_userdata

[ -z $USER ] && exit 1
[ -z $PASSWD ] && exit 1

DEST_DIR=$MOUNT_PATH/smb
SERVER="192.168.1.5"
# SERVER="10.0.0.1" # if you want a fixed server
SHARES=""
FR_NAME="Samba Server"
# M_OPTS="rw,user=${USER},password=${PASSWD}"
M_OPTS="$PERM,user=${USER},password=${PASSWD},codepage=cp1250,iocharset=utf8,nounix,sec=ntlmssp"

SERVERS="Don't set me!!"

do_mount()
{
#		$(echo -e "[sdh]\nVendor : CifsMount\nProduct : $FR_NAME\n\
#Serial : Q80VQLFH\nDevpath : 8\nLun : 0\nMountDir : $DEST_DIR\nFileSystem : vfat\n" >> /dtv/usb/log)

	for i in $S_MOUNTS ; do
		i="$(echo -n $i | sed -e 's/SGOspace/ /g')"
		M_POINT="$DEST_DIR/$1/$(echo -n $i | sed -e "s/\\\$/_/g")"
		mkdir -p "$M_POINT" 
		if [ `cat /proc/mounts | grep -c "$M_POINT"` -lt "1" ] ; then	
			/bin/busybox mount -o "${M_OPTS}" -t cifs "//$1/$i" "$M_POINT"
		else
			echo "$M_POINT is mounted!"
		fi

	done
}

get_shares()
{
	echo "Search Shares" 
	for i in $SERVERS ; do
	echo "on: $i" 
		S_MOUNTS=$(smbclient -s "$SYSROOT/etc/samba/smb.conf" -U ${USER}%${PASSWD} \
		-g -L $i | grep "Disk|" | grep -v "\\$" | grep -v " Service" | sed -r 's/.*\|(.*)\|.*/\1/' | sed -r 's/ /SGOspace/g')	
		# -g -L $i | grep "Disk|" | grep -v "\\$" | grep -v " Service" | cut -d "|" -f2)	
	[ -n "$S_MOUNTS" ] && do_mount $i
	done
}

get_servers()
{
	if [ -z "$SERVER" ] ; then
		# SERVERS=$(cat /proc/net/arp | grep -v "IP address" | cut -d " " -f1)
		SERVERS=$(cat /proc/net/arp | grep -v "IP address" | sed 's/^\(\w*.\w*.\w*.\w*\) *.*/\1/')
	else
		SERVERS=$SERVER
	fi
}

case $1 in 
	start)
	insmod $MOD_DIR/kernel/fs/cifs/cifs.ko
	mkdir -p "$DEST_DIR"
	get_servers
	get_shares
	# mount -o username=guest,password=,nounix,sec=ntlmssp -t cifs //192.168.1.5/PUBLIC /dtv/usb/sda/smb
	;;
	stop)
	# may can fail if device access the mount from content library
	# for i in $(cat /proc/mounts | grep cifs | cut -d " " -f2) ; do
	for i in $(cat /proc/mounts | grep cifs | grep "$DEST_DIR" | sed 's/^\(.*\) \(.*\) cifs .*/\2/') ; do
		i="$(echo -n $i | sed -r 's/\\040/ /g')"
		/bin/busybox umount "$i"
	done
	;;
	status)
	/bin/mount | grep "$DEST_DIR"
	;;
	*)
	echo "Usage: $0 {start|stop}" 1>&2
	exit 0
	;;
esac
and the smb.conf

Code: Select all

[global]
wins support = no
unix extensions = no
unix charset = UTF-8
dos charset = UTF-8
display charset = UTF-8
security = share
client lanman auth = Yes
# auth methods = guest sam winbind
# client ntlmv2 auth = Yes
fstype = Samba

# set workgroup, own share etc...
include = /mtd_rwarea/smb.conf
workgroup = HOME
netbios name = Samsung-TV
server string = Some Server

load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
guest account = root
guest ok = yes
guest only = yes
null passwords = yes
smb passwd file = /dtv/pp

[Samsung TV]
  comment = USB Drives on TV
  path = /dtv/usb
  public = yes
  writable = yes
Topic can be regarded as SOLVED :D

Thanks to all who have helped me.
AVOID TO PUBLISH AND DISCLOSE SAMYGO PROJECTS ON OTHER FORUM.

Post Reply

Return to “[E] Support”