[packages] samba36: update init script and config template (#11106)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31150 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-03-30 09:46:16 +00:00
parent 5550c32586
commit 43ac9d946e
3 changed files with 73 additions and 45 deletions

View File

@ -1,16 +1,15 @@
#
# Copyright (C) 2007 OpenWrt.org
# Copyright (C) 2007-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
include $(TOPDIR)/rules.mk
PKG_NAME:=samba
PKG_VERSION:=3.6.3
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_URL_SUBDIR:=/
PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba$(PKG_SOURCE_URL_SUBDIR)

View File

@ -4,28 +4,63 @@
START=60
smb_header() {
local name
local workgroup
local description
local interface
config_get interface $1 interface "loopback lan"
# resolve interfaces
local interfaces=$(
include /lib/network
scan_interfaces
local net
for net in $interface; do
local ifname
config_get ifname "$net" ifname
[ -n "$ifname" ] && {
local ipaddr netmask
config_get ipaddr "$net" ipaddr
config_get netmask "$net" netmask
[ -n "$ipaddr" ] && echo -n "$ipaddr/${netmask:-255.255.255.255} "
local ip6addr
config_get ip6addr "$net" ip6addr
[ -n "$ip6addr" ] && echo -n "$ip6addr "
}
echo -n "${ifname:-$net} "
done
)
local name workgroup description charset
local hostname="$(uci_get system.@system[0].hostname)"
config_get name $1 name "${hostname:-OpenWrt}"
config_get workgroup $1 workgroup "${hostname:-OpenWrt}"
config_get description $1 description "Samba on ${hostname:-OpenWrt}"
config_get charset $1 charset "UTF-8"
mkdir -p /var/etc
sed -e "s#|NAME|#$name#g" \
-e "s#|WORKGROUP|#$workgroup#g" \
-e "s#|DESCRIPTION|#$description#g" \
-e "s#|INTERFACES|#$interfaces#g" \
-e "s#|CHARSET|#$charset#g" \
/etc/samba/smb.conf.template > /var/etc/smb.conf
local homes
config_get_bool homes $1 homes 0
[ $homes -gt 0 ] && {
cat <<EOT >> /var/etc/smb.conf
config_get name $1 name
config_get workgroup $1 workgroup
config_get description $1 description
config_get homes $1 homes
[ -z "$name" ] && name=openwrt
[ -z "$workgroup" ] && workgroup=openwrt
[ -z "$description" ] && description=openwrt
cp /etc/samba/smb.conf.template /tmp/smb.conf
[ -L /etc/samba/smb.conf ] || ln -nsf /tmp/smb.conf /etc/samba/smb.conf
sed -i "s/|NAME|/$name/g" /tmp/smb.conf
sed -i "s/|WORKGROUP|/$workgroup/g" /tmp/smb.conf
sed -i "s/|DESCRIPTION|/$description/g" /tmp/smb.conf
[ "$homes" == "1" ] && {
echo -e "\n[homes]\n\tcomment = Home Directories\n\tbrowseable = no\n\tread only = no\n\tcreate mode = 0750" >> /tmp/smb.conf
[homes]
comment = Home Directories
browsable = no
read only = no
create mode = 0750
EOT
}
[ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf
}
smb_add_share() {
@ -47,12 +82,12 @@ smb_add_share() {
[ -z "$name" -o -z "$path" ] && return
echo -e "\n[$name]\n\tpath = $path" >> /tmp/smb.conf
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /tmp/smb.conf
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /tmp/smb.conf
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /tmp/smb.conf
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /tmp/smb.conf
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /tmp/smb.conf
echo -e "\n[$name]\n\tpath = $path" >> /var/etc/smb.conf
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/smb.conf
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/smb.conf
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/smb.conf
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /var/etc/smb.conf
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /var/etc/smb.conf
}
start() {

View File

@ -1,15 +1,20 @@
[global]
netbios name = |NAME|
workgroup = |WORKGROUP|
display charset = |CHARSET|
interfaces = |INTERFACES|
server string = |DESCRIPTION|
unix charset = |CHARSET|
workgroup = |WORKGROUP|
browseable = yes
deadtime = 15
deadtime = 30
domain master = yes
encrypt passwords = true
enable core files = no
guest account = nobody
guest ok = yes
invalid users = root
load printers = no
local master = yes
load printers = no
map to guest = Bad User
max protocol = SMB2
min receivefile size = 16384
@ -17,24 +22,13 @@
obey pam restrictions = yes
os level = 20
passdb backend = smbpasswd
#passdb backend = tdbsam
preferred master = yes
printable = no
reset on zero vc = yes
remote announce = 192.168.1.255
security = user
smb encrypt = disableennounce = 192.168.1.255
security = user
smb encrypt = disabled
smb encrypt = disabled
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65535 SO_SNDBUF=65535
socket options = TCP_NODELAY IPTOS_LOWDELAY
syslog = 2
writeable = yes
unix charset = UTF-8
use sendfile = yes
[template]
browseable = yes
guest ok = yes
writeable = yes