#!/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" mkdir /tmp/drives chown nobody /tmp/drives # # Get the lts.conf entries # eval `/bin/getltscfg -a` 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 # reg_info ${DEVVAR} 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 "${BASE_DEVICE}" in hd* ) modprobe ide-cd modprobe iso9660 RW="ro" FS="iso9660" ;; fd* ) modprobe floppy modprobe vfat RW="rw" FS="vfat" ;; sr* ) modprobe scsi_mod modprobe sr_mod RW="ro" FS="iso9660" ;; sd* ) modprobe scsi_mod modprobe sd_mod RW="rw" FS="auto" ;; * ) # assume modules are already loaded RW="ro" FS="auto" ;; esac mkdir /tmp/drives/${SHARE} if [ "${DEVICE}" != "hotplug" ] ; then mount -t supermount \ -o fs=${FS},dev=${DEVICE},--,${RW},uid=99,gid=99 none /tmp/drives/${SHARE} fi fi done if [ "${HOTPLUG}" = "Y" ]; then reg_info HOTPLUG mkdir /tmp/drives/.hotplug chown nobody /tmp/drives/.hotplug START_SAMBA=Y fi if [ "${START_SAMBA}" = "Y" ] ; then 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 unix extensions = No lock directory = /tmp/samba pid directory = /tmp/samba private dir = /tmp/samba [drives] path = /tmp/drives read only = no guest ok = Yes locking = no EOF smbd -D -s /tmp/smb.conf fi