[packages] samba3: expose interfaces configuration in uci, move generated smb.conf to /var/etc, bump pkg release
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29354 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
75fc5f5cf3
commit
124c94c90a
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=samba3
|
PKG_NAME:=samba3
|
||||||
PKG_VERSION:=3.0.37
|
PKG_VERSION:=3.0.37
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_MD5SUM:=11ed2bfef4090bd5736b194b43f67289
|
PKG_MD5SUM:=11ed2bfef4090bd5736b194b43f67289
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ config samba
|
|||||||
option 'workgroup' 'openwrt'
|
option 'workgroup' 'openwrt'
|
||||||
option 'description' 'openwrt'
|
option 'description' 'openwrt'
|
||||||
option 'homes' '1'
|
option 'homes' '1'
|
||||||
|
list 'interface' 'lo'
|
||||||
|
list 'interface' 'lan'
|
||||||
|
|
||||||
config sambashare
|
config sambashare
|
||||||
option 'name' 'tmp'
|
option 'name' 'tmp'
|
||||||
|
@ -8,23 +8,37 @@ smb_header() {
|
|||||||
local workgroup
|
local workgroup
|
||||||
local description
|
local description
|
||||||
local homes
|
local homes
|
||||||
|
local interface
|
||||||
|
|
||||||
config_get name $1 name
|
config_get name $1 name
|
||||||
config_get workgroup $1 workgroup
|
config_get workgroup $1 workgroup
|
||||||
config_get description $1 description
|
config_get description $1 description
|
||||||
config_get homes $1 homes
|
config_get homes $1 homes
|
||||||
|
config_get interface $1 interface "lan"
|
||||||
|
|
||||||
|
# resolve interfaces
|
||||||
|
local interfaces=$(
|
||||||
|
include /lib/network
|
||||||
|
scan_interfaces
|
||||||
|
local net ifname; for net in $interface; do
|
||||||
|
config_get ifname "$net" ifname "$net"
|
||||||
|
echo -n "$ifname "
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
[ -z "$name" ] && name=openwrt
|
[ -z "$name" ] && name=openwrt
|
||||||
[ -z "$workgroup" ] && workgroup=openwrt
|
[ -z "$workgroup" ] && workgroup=openwrt
|
||||||
[ -z "$description" ] && description=openwrt
|
[ -z "$description" ] && description=openwrt
|
||||||
|
|
||||||
cp /etc/samba/smb.conf.template /tmp/smb.conf
|
mkdir -p /var/etc
|
||||||
[ -L /etc/samba/smb.conf ] || ln -nsf /tmp/smb.conf /etc/samba/smb.conf
|
cp /etc/samba/smb.conf.template /var/etc/smb.conf
|
||||||
sed -i "s/|NAME|/$name/g" /tmp/smb.conf
|
[ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf
|
||||||
sed -i "s/|WORKGROUP|/$workgroup/g" /tmp/smb.conf
|
sed -i "s/|NAME|/$name/g" /var/etc/smb.conf
|
||||||
sed -i "s/|DESCRIPTION|/$description/g" /tmp/smb.conf
|
sed -i "s/|WORKGROUP|/$workgroup/g" /var/etc/smb.conf
|
||||||
|
sed -i "s/|DESCRIPTION|/$description/g" /var/etc/smb.conf
|
||||||
|
sed -i "s/|INTERFACES|/$interfaces/g" /var/etc/smb.conf
|
||||||
[ "$homes" == "1" ] && {
|
[ "$homes" == "1" ] && {
|
||||||
echo -e "\n[homes]\n\tcomment = Home Directories\n\tbrowseable = no\n\tread only = no\n\tcreate mode = 0750" >> /tmp/smb.conf
|
echo -e "\n[homes]\n\tcomment = Home Directories\n\tbrowseable = no\n\tread only = no\n\tcreate mode = 0750" >> /var/etc/smb.conf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,12 +61,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() {
|
||||||
|
@ -14,3 +14,4 @@
|
|||||||
guest account = nobody
|
guest account = nobody
|
||||||
invalid users = root
|
invalid users = root
|
||||||
smb passwd file = /etc/samba/smbpasswd
|
smb passwd file = /etc/samba/smbpasswd
|
||||||
|
interfaces = |INTERFACES|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user