mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-01 23:17:50 +00:00
samba: external drives autoshare
This commit is contained in:
parent
5916628845
commit
3e54bdda5b
@ -181,6 +181,7 @@ makeinstall_target() {
|
||||
|
||||
mkdir -p $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
|
||||
mkdir -p $INSTALL/etc/samba
|
||||
|
29
packages/network/samba/scripts/samba-autoshare
Executable file
29
packages/network/samba/scripts/samba-autoshare
Executable 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
|
@ -33,6 +33,16 @@ if [ -f /storage/.cache/services/samba.conf ]; then
|
||||
cp $SMB_DEFCONF $SMB_CONF
|
||||
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
|
||||
SAMBA_USERNAME=`echo $SAMBA_USERNAME | sed "s/[^a-zA-Z0-9]//g;"`
|
||||
SAMBA_PASSWORD=`echo $SAMBA_PASSWORD | sed "s/[^a-zA-Z0-9]//g;"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user