[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:
@ -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.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
# $Id$
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=samba
|
PKG_NAME:=samba
|
||||||
PKG_VERSION:=3.6.3
|
PKG_VERSION:=3.6.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE_URL_SUBDIR:=/
|
PKG_SOURCE_URL_SUBDIR:=/
|
||||||
PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba$(PKG_SOURCE_URL_SUBDIR)
|
PKG_SOURCE_URL:=http://ftp.samba.org/pub/samba$(PKG_SOURCE_URL_SUBDIR)
|
||||||
|
@ -4,28 +4,63 @@
|
|||||||
START=60
|
START=60
|
||||||
|
|
||||||
smb_header() {
|
smb_header() {
|
||||||
local name
|
local interface
|
||||||
local workgroup
|
config_get interface $1 interface "loopback lan"
|
||||||
local description
|
|
||||||
|
# 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
|
local homes
|
||||||
|
config_get_bool homes $1 homes 0
|
||||||
|
[ $homes -gt 0 ] && {
|
||||||
|
cat <<EOT >> /var/etc/smb.conf
|
||||||
|
|
||||||
config_get name $1 name
|
[homes]
|
||||||
config_get workgroup $1 workgroup
|
comment = Home Directories
|
||||||
config_get description $1 description
|
browsable = no
|
||||||
config_get homes $1 homes
|
read only = no
|
||||||
|
create mode = 0750
|
||||||
[ -z "$name" ] && name=openwrt
|
EOT
|
||||||
[ -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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
smb_add_share() {
|
smb_add_share() {
|
||||||
@ -47,12 +82,12 @@ smb_add_share() {
|
|||||||
|
|
||||||
[ -z "$name" -o -z "$path" ] && return
|
[ -z "$name" -o -z "$path" ] && return
|
||||||
|
|
||||||
echo -e "\n[$name]\n\tpath = $path" >> /tmp/smb.conf
|
echo -e "\n[$name]\n\tpath = $path" >> /var/etc/smb.conf
|
||||||
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /tmp/smb.conf
|
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/smb.conf
|
||||||
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /tmp/smb.conf
|
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/smb.conf
|
||||||
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /tmp/smb.conf
|
[ -n "$guest_ok" ] && echo -e "\tguest ok = $guest_ok" >> /var/etc/smb.conf
|
||||||
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /tmp/smb.conf
|
[ -n "$create_mask" ] && echo -e "\tcreate mask = $create_mask" >> /var/etc/smb.conf
|
||||||
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /tmp/smb.conf
|
[ -n "$dir_mask" ] && echo -e "\tdirectory mask = $dir_mask" >> /var/etc/smb.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
[global]
|
[global]
|
||||||
netbios name = |NAME|
|
netbios name = |NAME|
|
||||||
workgroup = |WORKGROUP|
|
display charset = |CHARSET|
|
||||||
|
interfaces = |INTERFACES|
|
||||||
server string = |DESCRIPTION|
|
server string = |DESCRIPTION|
|
||||||
|
unix charset = |CHARSET|
|
||||||
|
workgroup = |WORKGROUP|
|
||||||
browseable = yes
|
browseable = yes
|
||||||
deadtime = 15
|
deadtime = 30
|
||||||
|
domain master = yes
|
||||||
encrypt passwords = true
|
encrypt passwords = true
|
||||||
enable core files = no
|
enable core files = no
|
||||||
guest account = nobody
|
guest account = nobody
|
||||||
|
guest ok = yes
|
||||||
invalid users = root
|
invalid users = root
|
||||||
load printers = no
|
|
||||||
local master = yes
|
local master = yes
|
||||||
|
load printers = no
|
||||||
map to guest = Bad User
|
map to guest = Bad User
|
||||||
max protocol = SMB2
|
max protocol = SMB2
|
||||||
min receivefile size = 16384
|
min receivefile size = 16384
|
||||||
@ -17,24 +22,13 @@
|
|||||||
obey pam restrictions = yes
|
obey pam restrictions = yes
|
||||||
os level = 20
|
os level = 20
|
||||||
passdb backend = smbpasswd
|
passdb backend = smbpasswd
|
||||||
#passdb backend = tdbsam
|
|
||||||
preferred master = yes
|
preferred master = yes
|
||||||
printable = no
|
printable = no
|
||||||
reset on zero vc = yes
|
|
||||||
remote announce = 192.168.1.255
|
|
||||||
security = user
|
security = user
|
||||||
smb encrypt = disableennounce = 192.168.1.255
|
smb encrypt = disabled
|
||||||
security = user
|
|
||||||
smb encrypt = disabled
|
|
||||||
smb passwd file = /etc/samba/smbpasswd
|
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
|
syslog = 2
|
||||||
writeable = yes
|
|
||||||
unix charset = UTF-8
|
|
||||||
use sendfile = yes
|
use sendfile = yes
|
||||||
|
|
||||||
[template]
|
|
||||||
browseable = yes
|
|
||||||
guest ok = yes
|
|
||||||
writeable = yes
|
writeable = yes
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user