Hi, all.  Hey, kudos on 4.1!

I am attaching a modified rc.localdev, in case it might help anyone.  This one loads modules according to the SHARE name, ie. the Samba shared name.  So, if you share a device as *cdrom*, cdrom drivers are loaded, *usbhdd* usb-storage drivers are loaded, etc.

I've done limited testing with floppies, usb flash drives, etc.

I believe I read about a future release with a revised version of this file, but in the meantime, here's a solution for the super-ansy that seems to work...

Cheers,

-Gideon

-- 
--------------------------------------------------------
Gideon Romm | Product R&D [EMAIL PROTECTED]

Symbio Technologies                     o:(914) 576-1205
134 North Ave, Suites E&F               f:(914) 576-0944 
New Rochelle, NY 10801                  c:(914) 774-4691

                www.symbio-technologies.com
                    www.thesymbiont.com
#!/bin/sh
#
# local_cd
#
# This script will set up a local cdrom drive for supermount.
#
PATH=/bin:$PATH; export PATH
. /etc/ltsp_functions

SAMBATMP="/tmp/samba"
SAMBACNF="/tmp/smb.conf"

#
# Get the lts.conf entries
#
eval `/bin/getltscfg -a`

FOUND_ONE="N"

for i in 01 02 03 04 05 06 07 08 09 10; do
    DEVVAR=LOCAL_DEVICE_${i}
  
    if [ ! -z ${!DEVVAR} ] ; then
        #
        # As soon as we find at least 1 local device, we need to
        # setup the Samba config stuff
        #
        if [ "${FOUND_ONE}" = "N" ]; then
            FOUND_ONE=Y
            mkdir ${SAMBATMP}
            cat <<-EOF >${SAMBACNF}
		[global]
		   workgroup        = ${WORKGROUP:-"LTSP"}
		   security         = SHARE
		   smb passwd file  = /etc/passwd
		   guest account    = nobody
		   log file         = /tmp/samba/%m.log
		   max log size     = 2
		   socket options   = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
		   load printers    = No
		   dns proxy        = No
		   lock directory   = /tmp/samba
		   pid directory    = /tmp/samba
		   private dir      = /tmp/samba
		EOF
        fi
        DEVICE=`echo ${!DEVVAR} | sed 's/\(.*\):.*/\1/'`
        SHARE=`echo ${!DEVVAR} | sed 's/.*:\(.*\)/\1/'`
        BASE_DEVICE=`/usr/bin/basename ${DEVICE}`
        START_SAMBA="Y"

        if [ -z ${SHARE} ] ; then
            SHARE=${BASE_DEVICE}
        fi

        echo ${DEVICE} ${SHARE} ${BASE_DEVICE}

        case "${SHARE}" in
            *cdrom* ) modprobe ide-cd
                  modprobe iso9660
                  RW="ro"
                  SRW="yes"
                  FS="iso9660"
                  ;;
            *floppy* ) modprobe floppy
                  modprobe vfat
                  RW="rw"
                  SRW="no"
                  FS="vfat"
                  ;;
            *usbhdd* ) modprobe usb-storage
                  modprobe vfat
                  RW="rw"
                  SRW="no"
                  FS="vfat"
                  ;;
            * )   # assume modules are already loaded 
                  RW="ro"
                  SRW="yes"
                  FS="auto"
                  ;;
        esac

        cat <<-EOF >>${SAMBACNF}

		[${SHARE}]
		   path       = /tmp/${SHARE}
		   read only  = ${SRW}
		   guest ok   = Yes
	EOF
        mkdir /tmp/${SHARE}
        mount -t supermount	\
              -o fs=${FS},dev=${DEVICE},--,${RW} none /tmp/${SHARE}
    fi
done

if [ "${START_SAMBA}" = "Y" ] ; then
    smbd -D -s /tmp/smb.conf
fi

Reply via email to