Need help! How to mount CIFS/SAMBA share an folder.

General forum talking area for F series TVs.
Post Reply

Klauswimmer
SamyGO Project Donor
Posts: 5
Joined: Sat Nov 29, 2014 11:12 am

Need help! How to mount CIFS/SAMBA share an folder.

Post by Klauswimmer » Fri Jan 06, 2017 2:17 pm

Hello everybody.
I have a question about the CIFS/Samba release with SmayGo .
Is it possible to share a folder?
I have a Fritzbox NAS and i wan't that Samygo only mount the folder "Media-Server" from the NAS.
\\Fritznas\Homenet\Media_Server
How can i do this?

My 04_04_Samba.ini

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="Fritzbox"
PASSWD="Fritzbox"
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/Fritzbox
SERVER="192.168.0.1"
# SERVER="10.0.0.1" # if you want a fixed server
SHARES=""
FR_NAME=""
# M_OPTS="rw,user=${USER},password=${PASSWD}"
M_OPTS="$PERM,user=${USER},password=${PASSWD},codepage=cp1250,iocharset=utf8"

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")"	#disabled by levi
		M_POINT="$DEST_DIR/$1/$(basename $i)"						#enabled by levi
		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
	sleep 3
	mkdir -p "$DEST_DIR"
	get_servers
	get_shares
	lsmod
	;;
	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
But so I get all the folders on the NAS.

Can everyone tell me what i have to change to get only the Folder "Media-Server"?

Many thanks for your help.

Sorry for my bad english.

User avatar
juusso
SamyGO Moderator
Posts: 9776
Joined: Sun Mar 07, 2010 6:20 pm

Re: Need help! How to mount CIFS/SAMBA share an folder.

Post by juusso » Sat Jan 21, 2017 9:26 pm

Write your share name under SHARES="" in script. For example:

Code: Select all

SHARES="Media_Server"
LE40B653T5W,UE40D6750
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

Post Reply

Return to “[F] General”