samba: external drives autoshare

This commit is contained in:
Stefan Saraev 2013-12-18 00:02:06 +02:00
parent 5916628845
commit 3e54bdda5b
3 changed files with 40 additions and 0 deletions

View File

@ -181,6 +181,7 @@ makeinstall_target() {
mkdir -p $INSTALL/usr/lib/samba mkdir -p $INSTALL/usr/lib/samba
cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba cp $PKG_DIR/scripts/samba-config $INSTALL/usr/lib/samba
cp $PKG_DIR/scripts/samba-autoshare $INSTALL/usr/lib/samba
if [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then if [ -f $PROJECT_DIR/$PROJECT/config/smb.conf ]; then
mkdir -p $INSTALL/etc/samba mkdir -p $INSTALL/etc/samba

View File

@ -0,0 +1,29 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
if [ -f /storage/.cache/services/samba.conf ]; then
. /storage/.cache/services/samba.conf
if [ "$SAMBA_AUTOSHARE" == "true" ] ; then
systemctl restart samba-config.service
systemctl restart smbd.service
fi
fi

View File

@ -33,6 +33,16 @@ if [ -f /storage/.cache/services/samba.conf ]; then
cp $SMB_DEFCONF $SMB_CONF cp $SMB_DEFCONF $SMB_CONF
fi fi
# handle external drives
if [ "$SAMBA_AUTOSHARE" == "true" ] ; then
for dir in /media/* ; do
if [ -d "$dir" ] ; then
name=$(basename "$dir")
echo -e "[$name]\n path = $dir\n available = yes\n browsable = yes\n public = yes\n writable = yes\n" >> $SMB_CONF
fi
done
fi
# only letters & numbers permitted for username & password # only letters & numbers permitted for username & password
SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"` SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"`
SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"` SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"`