samba4: add package samba-4.8
authorAndy Walsh <redacted>
Wed, 31 Jan 2018 13:17:11 +0000 (14:17 +0100)
committerAndy Walsh <redacted>
Thu, 26 Jul 2018 19:38:19 +0000 (21:38 +0200)
Signed-off-by: Andy Walsh <redacted>
16 files changed:
net/samba4/Config.in [new file with mode: 0644]
net/samba4/Makefile [new file with mode: 0644]
net/samba4/files/samba.config [new file with mode: 0644]
net/samba4/files/samba.init [new file with mode: 0644]
net/samba4/files/smb.conf.template [new file with mode: 0644]
net/samba4/patches/001-samba-4.4.0-pam.patch [new file with mode: 0644]
net/samba4/patches/002-dnsserver-4.7.0.patch [new file with mode: 0644]
net/samba4/patches/010-source3-msgsock-nvram-fix.patch [new file with mode: 0644]
net/samba4/patches/011-source4-msgsock-nvram-fix.patch [new file with mode: 0644]
net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch [new file with mode: 0644]
net/samba4/patches/101-do-not-check-xsltproc-manpages.patch [new file with mode: 0644]
net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch [new file with mode: 0644]
net/wsdd2/Makefile [new file with mode: 0644]
net/wsdd2/files/wsdd2.init [new file with mode: 0644]
net/wsdd2/patches/001-add_uuid_boot_id.patch [new file with mode: 0644]
utils/qemu-userspace/Makefile [new file with mode: 0644]

diff --git a/net/samba4/Config.in b/net/samba4/Config.in
new file mode 100644 (file)
index 0000000..404f62a
--- /dev/null
@@ -0,0 +1,90 @@
+config SAMBA4_SERVER_ACL
+       bool "ACL support (xattr)"
+       depends on PACKAGE_samba4-server
+       select PACKAGE_acl
+       help
+               installs: sharesec
+                       modules: vfs_acl_xattr vfs_acl_tdb vfs_posixacl
+
+               Extended access control list support
+       default n
+
+config SAMBA4_SERVER_AD_DC
+       bool "Active Directory Domain Controller support (requires krb5-server) (EXPERIMENTAL)"
+       depends on PACKAGE_samba4-server
+       select PACKAGE_python-base
+       select PACKAGE_python-crypto
+       select PACKAGE_libopenssl
+       select PACKAGE_libgnutls
+       select PACKAGE_libopenldap
+       help
+               installs: samba (meta-daemon) python-crypt ntlm_auth
+                       scripts: samba-tool
+
+               Run as a Active Directory Domain Controller
+               see: https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
+               HINT: see section (# Using the Domain Controller as a File Server)
+               NOTE: Extroot is recommend for this setup, as it is not optimized to run completely from RAM/tempfs!
+       default n
+
+config SAMBA4_SERVER_AVAHI
+       bool "Avahi support"
+       depends on PACKAGE_samba4-server
+       select PACKAGE_libavahi-client
+       help
+               Announce Samba resources via DNS/DNS-SD using the Avahi daemon
+       default n
+
+config SAMBA4_SERVER_VFS
+       bool "Common VFS modules"
+       depends on PACKAGE_samba4-server
+       help
+               installs:
+                       modules: (vfs_btrfs) vfs_fruit vfs_shadow_copy2 vfs_recycle vfs_fake_perms vfs_readonly vfs_cap vfs_offline vfs_crossrename
+
+               Commonly used VFS modules, vfs_btrfs requires kmod-fs-btrfs to be selected separately
+        default y
+
+config SAMBA4_SERVER_QUOTAS
+       bool "Disk quota support"
+       depends on PACKAGE_samba4-server
+       help
+               installs:
+                       modules: vfs_default_quota
+
+               Support for disk quotas using the quotas VFS module (vfs_default_quota)
+       default n
+
+config SAMBA4_SERVER_VFSX
+       bool "Extended VFS modules"
+       depends on PACKAGE_samba4-server
+       help
+               installs:
+                       modules: vfs_virusfilter vfs_shell_snap vfs_commit vfs_worm vfs_xattr_tdb vfs_streams_xattr vfs_aio_fork vfs_aio_pthread (vfs_linux_xfs_sgid) vfs_netatalk vfs_dirsort vfs_fileid vfs_catia
+
+               Additional VFS modules that aren't commonly used, vfs_linux_xfs_sgid requires kmod-fs-xfs to be selected separately
+       default n
+
+config SAMBA4_SERVER_NETBIOS
+       bool "NetBIOS support"
+       depends on PACKAGE_samba4-server
+       help
+               installs: nmbd (daemon)
+
+               Announce Samba resources via NetBIOS using the nmbd daemon
+               WSD (Web Services for Devices) replaces the functionality of NetBIOS and is provided by the wsdd2 package (selected by default).
+               Note: As of Windows 10 Fall Creators Update (1709) NetBIOS isn't supported unless the old SMB1 feature is reinstalled (not recommended).
+               Network shares can be directly accessed via network paths '\\hostname\sharename' and mounted via 'map network drive' without NetBIOS or WSD.
+       default n
+
+config SAMBA4_SERVER_WINBIND
+       bool "Winbind support"
+       depends on PACKAGE_samba4-server
+       depends on SAMBA4_SERVER_AD_DC
+       help
+               installs: winbindd (daemon) wbinfo
+
+               Support using domain users and groups in local commands, such as chown and chgrp.
+               Display domain users and groups in local command's output, such as ls.
+               see: https://wiki.samba.org/index.php/Configuring_Winbindd_on_a_Samba_AD_DC
+       default n
diff --git a/net/samba4/Makefile b/net/samba4/Makefile
new file mode 100644 (file)
index 0000000..071e1c5
--- /dev/null
@@ -0,0 +1,384 @@
+# Based partially on (wongsyrone/hbl0307106015) versions
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=samba
+PKG_VERSION:=4.8.3
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
+PKG_LICENSE:=GPL-3.0-only
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE_URL:=https://download.samba.org/pub/samba/stable/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=e0569a8a605d5dfb49f1fdd11db796f4d36fe0351c4a7f21387ef253010b82ed
+
+# Buildroot bug? Can't add target deps via '+SAMBA4_SERVER_AD_DC:python-crypto' (as work-around we select via config.in)
+PKG_BUILD_DEPENDS:=perl/host python/host qemu-userspace/host SAMBA4_SERVER_AD_DC:python-crypto
+
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_SAMBA4_SERVER_NETBIOS \
+       CONFIG_SAMBA4_SERVER_AVAHI \
+       CONFIG_SAMBA4_SERVER_VFS \
+       CONFIG_SAMBA4_SERVER_VFSX \
+       CONFIG_SAMBA4_SERVER_QUOTAS \
+       CONFIG_SAMBA4_SERVER_ACL \
+       CONFIG_SAMBA4_SERVER_AD_DC \
+       CONFIG_SAMBA4_SERVER_WINBIND \
+       CONFIG_PACKAGE_kmod-fs-btrfs \
+       CONFIG_PACKAGE_kmod-fs-xfs
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/samba4/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=Samba $(PKG_VERSION)
+  URL:=http://www.samba.org/
+endef
+
+define Package/samba4/Default/description
+  The Samba software suite is a collection of programs that implements the
+  SMB/CIFS protocol for UNIX systems, allowing you to serve files and printers.
+
+  Samba 4 implements up-to protocol version SMB v3.1.1 (Win10), supports mDNS via AVAHI and a AD-DC setup via krb5.
+  NOTE: No cluster and printer support.
+endef
+
+define Package/samba4-libs
+  $(call Package/samba4/Default)
+  TITLE+= libs
+  DEPENDS:= +zlib +libtirpc +krb5-libs +libpopt \
+       +PACKAGE_libcap:libcap +PACKAGE_jansson:jansson +PACKAGE_libpthread:libpthread +PACKAGE_libnettle:libnettle +PACKAGE_libarchive:libarchive \
+       +SAMBA4_SERVER_ACL:acl +SAMBA4_SERVER_ACL:attr \
+       +SAMBA4_SERVER_AVAHI:libavahi-client \
+       +SAMBA4_SERVER_AD_DC:python-base +SAMBA4_SERVER_AD_DC:libopenssl +SAMBA4_SERVER_AD_DC:libgnutls +SAMBA4_SERVER_AD_DC:libopenldap
+endef
+
+define Package/samba4-server
+  $(call Package/samba4/Default)
+  TITLE+= server
+  DEPENDS:= +samba4-libs
+endef
+
+define Package/samba4-server/description
+  installs: smbd (daemon) smbpasswd pdbedit testparm
+
+    This provides the basic fileserver service and is the minimum needed to serve file shares.
+    HINT: https://fitzcarraldoblog.wordpress.com/2016/10/17/a-correct-method-of-configuring-samba-for-browsing-smb-shares-in-a-home-network/
+endef
+
+define Package/samba4-server/config
+  select PACKAGE_wsdd2
+  source "$(SOURCE)/Config.in"
+endef
+
+define Package/samba4-client
+  $(call Package/samba4/Default)
+  TITLE+= client
+  DEPENDS:= +samba4-libs
+endef
+
+define Package/samba4-client/description
+  installs: smbclient cifsdd
+
+  The smbclient program implements a simple ftp-like client for accessing SMB shares
+endef
+
+define Package/samba4-admin
+  $(call Package/samba4/Default)
+  TITLE+= admin tools
+  DEPENDS:= +samba4-libs
+endef
+
+define Package/samba4-admin/description
+  installs: net smbcontrol profiles rpcclient smbcacls smbcquotas
+
+  Administration tools collection
+endef
+
+define Package/samba4-utils
+  $(call Package/samba4/Default)
+  TITLE+= utils
+  DEPENDS:= +samba4-libs
+endef
+
+define Package/samba4-utils/description
+  installs: smbstatus smbtree smbget nmblookup mvxattr
+
+  Utilities collection
+endef
+
+TARGET_CFLAGS += -ffunction-sections -fdata-sections
+TARGET_LDFLAGS += -Wl,--gc-sections
+
+CONFIGURE_VARS += \
+       CPP="$(TARGET_CROSS)cpp"
+
+CONFIGURE_CMD = ./buildtools/bin/waf
+
+# Strip options that WAF configure script does not recognize
+CONFIGURE_ARGS:=$(filter-out   \
+       --host=%                \
+       --build=%               \
+       --program-suffix=%      \
+       --disable-nls           \
+       --disable-ipv6          \
+       , $(CONFIGURE_ARGS))
+
+CONFIGURE_ARGS += \
+               --hostcc="$(HOSTCC)" \
+               --cross-compile \
+               --cross-execute="qemu-$(ARCH) -L $(STAGING_DIR_ROOT)" \
+               --disable-cups \
+               --disable-iprint \
+               --disable-cephfs \
+               --disable-fault-handling \
+               --disable-glusterfs \
+               --disable-rpath \
+               --disable-rpath-install \
+               --disable-rpath-private-install \
+               --enable-fhs \
+               --without-automount \
+               --without-iconv \
+               --without-lttng \
+               --without-ntvfs-fileserver \
+               --without-pam \
+               --without-systemd \
+               --without-utmp \
+               --without-dmapi \
+               --without-fam \
+               --without-gettext \
+               --without-regedit \
+               --without-gpgme
+
+# Optional AES-NI support - https://lists.samba.org/archive/samba-technical/2017-September/122738.html
+# Support for Nettle wasn't comitted
+CONFIGURE_ARGS += --accel-aes=none
+
+CONFIGURE_ARGS += \
+               --with-lockdir=/var/lock \
+               --with-logfilebase=/var/log \
+               --with-piddir=/var/run \
+               --with-privatedir=/etc/samba
+
+CONFIGURE_ARGS += \
+               --with-system-mitkrb5 "$(STAGING_DIR)/usr" \
+               --with-system-mitkdc=/usr/sbin/krb5kdc
+
+               ## embedded-heimdal
+               # --bundled-libraries=talloc,tevent,tdb,ldb,com_err,cmocka,roken,wind,hx509,asn1,heimbase,hcrypto,krb5,gssapi,heimntlm,hdb,kdc,NONE
+
+ifeq ($(CONFIG_SAMBA4_SERVER_AVAHI),y)
+       CONFIGURE_ARGS += --enable-avahi
+else
+       CONFIGURE_ARGS += --disable-avahi
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_QUOTAS),y)
+       CONFIGURE_ARGS += --with-quotas
+else
+       CONFIGURE_ARGS += --without-quotas
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
+       CONFIGURE_ARGS += --with-acl-support
+else
+       CONFIGURE_ARGS += --without-acl-support
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
+       CONFIGURE_ARGS += --enable-gnutls --with-dnsupdate --with-ads --with-ldap
+       TARGET_CFLAGS := -I$(STAGING_DIR)/usr/include/python2.7 $(TARGET_CFLAGS)
+else
+       CONFIGURE_ARGS += --without-ad-dc --disable-python --nopyc --nopyo --disable-gnutls --without-dnsupdate --without-ads --without-ldap
+       CONFIGURE_VARS += \
+               python_LDFLAGS="" \
+               python_LIBDIR=""
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_WINBIND),y)
+       CONFIGURE_ARGS += --with-winbind
+else
+       CONFIGURE_ARGS += --without-winbind
+endif
+
+SAMBA4_IDMAP_MODULES :=
+SAMBA4_IDMAP_MODULES_SHARED :=
+SAMBA4_PDB_MODULES :=pdb_smbpasswd,pdb_tdbsam,
+SAMBA4_AUTH_MODULES :=auth_builtin,auth_sam,auth_unix,auth_script,
+SAMBA4_VFS_MODULES :=vfs_default,
+ifeq ($(CONFIG_SAMBA4_SERVER_VFS),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_fruit,vfs_shadow_copy2,vfs_recycle,vfs_fake_perms,vfs_readonly,vfs_cap,vfs_offline,vfs_crossrename,
+ifeq ($(CONFIG_PACKAGE_kmod-fs-btrfs),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_btrfs,
+endif
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_VFSX),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_virusfilter,vfs_shell_snap,vfs_commit,vfs_worm,vfs_xattr_tdb,vfs_streams_xattr,vfs_aio_fork,vfs_aio_pthread,vfs_netatalk,vfs_dirsort,vfs_fileid,vfs_catia,
+ifeq ($(CONFIG_PACKAGE_kmod-fs-xfs),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_linux_xfs_sgid,
+endif
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_QUOTAS),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_default_quota,
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
+       SAMBA4_VFS_MODULES :=$(SAMBA4_VFS_MODULES)vfs_posixacl,vfs_acl_xattr,vfs_acl_tdb,
+       # vfs_zfsacl needs https://github.com/zfsonlinux/zfs/tree/master/include/sys/zfs_acl.h
+       # vfs_nfs4acl_xattr needs https://github.com/notriddle/libdrpc/blob/master/rpc/xdr.h
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
+       SAMBA4_PDB_MODULES :=$(SAMBA4_PDB_MODULES)pdb_samba_dsdb,
+       SAMBA4_AUTH_MODULES :=$(SAMBA4_AUTH_MODULES)auth_samba4,
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_WINBIND),y)
+       SAMBA4_IDMAP_MODULES :=$(SAMBA4_IDMAP_MODULES)idmap_passdb,idmap_nss,idmap_tdb,idmap_tdb2,idmap_script,nss_info_template,
+       SAMBA4_IDMAP_MODULES_SHARED :=$(SAMBA4_IDMAP_MODULES_SHARED)idmap_autorid,idmap_rid,idmap_ad,idmap_rfc2307,
+       # idmap_ad needs --with-ads
+       # idmap_rfc2307 needs ldap headers
+       SAMBA4_AUTH_MODULES :=$(SAMBA4_AUTH_MODULES)auth_winbind,
+endif
+
+SAMBA4_MODULES :=${SAMBA4_AUTH_MODULES}${SAMBA4_PDB_MODULES}${SAMBA4_IDMAP_MODULES}${SAMBA4_VFS_MODULES}
+SAMBA4_MODULES_SHARDED :=${SAMBA4_IDMAP_MODULES_SHARED}
+
+CONFIGURE_ARGS += \
+               --with-static-modules=$(SAMBA4_MODULES)!DEFAULT,!FORCED \
+               --with-shared-modules=$(SAMBA4_MODULES_SHARDED)!DEFAULT,!FORCED
+
+# Setup build/install targets
+# CONFIG_PACKAGE_samba4-server
+BUILD_TARGETS_SERVER :=smbd/smbd,smbpasswd,pdbedit,testparm
+# Optional server targets
+ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
+       BUILD_TARGETS_SERVER :=$(BUILD_TARGETS_SERVER),sharesec
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_NETBIOS),y)
+       BUILD_TARGETS_SERVER :=$(BUILD_TARGETS_SERVER),nmbd
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
+       BUILD_TARGETS_SERVER :=$(BUILD_TARGETS_SERVER),samba,nsstest,ntlm_auth
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_WINBIND),y)
+       BUILD_TARGETS_SERVER :=$(BUILD_TARGETS_SERVER),winbindd,wbinfo,winbind_krb5_locator
+endif
+# CONFIG_PACKAGE_samba4-client
+BUILD_TARGETS_CLIENT :=client/smbclient,client/cifsdd
+# CONFIG_PACKAGE_samba4-admin
+BUILD_TARGETS_ADMIN :=net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas
+# CONFIG_PACKAGE_samba4-utils
+BUILD_TARGETS_UTILS :=smbstatus,smbtree,smbget,mvxattr,nmblookup
+
+# lib bundling
+# NOTE: Compile some unique libs into related bins, so we end-up with a unified samba4-libs base, mainly to allow package separation (server, client, admin, utils)
+CONFIGURE_ARGS += --builtin-libraries=smbclient,netapi,samba-passdb,ads,auth,cli-spoolss,libcli-lsa3,gpext,talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace
+#CONFIGURE_ARGS += --nonshared-binary=$(BUILD_TARGETS_SERVER)
+# NOTE: bundle + make private, we want to avoid version configuration (build, link) conflicts
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
+CONFIGURE_ARGS += --bundled-libraries=talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace,pytalloc-util,pyldb-util,NONE
+else
+CONFIGURE_ARGS += --bundled-libraries=talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace,NONE
+endif
+CONFIGURE_ARGS += --private-libraries=talloc,tevent,texpect,tdb,ldb,tdr,cmocka,replace
+
+define Build/Prepare
+       $(Build/Prepare/Default)
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),)
+       # un-bundle dnspython
+       $(SED) '/"dns.resolver":/d' $(PKG_BUILD_DIR)/third_party/wscript
+       # unbundle iso8601
+       $(SED) '/"iso8601":/d' $(PKG_BUILD_DIR)/third_party/wscript
+endif
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default,configure)
+endef
+
+# BUG: We need to use "waf install --targets=" otherwise a "make install" or "waf install" will retrigger a full recompile of all possible targets!
+define Build/Compile
+       (cd $(PKG_BUILD_DIR); \
+               ./buildtools/bin/waf install -j$(shell nproc) \
+               --targets=$(SAMBA4_MODULES)$(SAMBA4_MODULES_SHARDED)$(BUILD_TARGETS_SERVER),$(BUILD_TARGETS_UTILS),$(BUILD_TARGETS_ADMIN),$(BUILD_TARGETS_CLIENT) \
+               --destdir="$(PKG_INSTALL_DIR)" \
+       )
+endef
+
+# No default install see above
+define Build/Install
+endef
+
+define Package/samba4-libs/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/*.so* $(1)/usr/lib/
+endef
+
+define Package/samba4-client/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbclient,cifsdd} $(1)/usr/bin/
+endef
+
+define Package/samba4-admin/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{net,smbcontrol,profiles,rpcclient,smbcacls,smbcquotas} $(1)/usr/bin/
+endef
+
+define Package/samba4-utils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbstatus,smbtree,smbget,mvxattr,nmblookup} $(1)/usr/bin/
+endef
+
+define Package/samba4-server/install
+       $(INSTALL_DIR) $(1)/usr/lib/samba
+       if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/idmap ]; then \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/idmap $(1)/usr/lib/samba/; \
+       fi
+       if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/auth ]; then \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/auth $(1)/usr/lib/samba/; \
+       fi
+       if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/vfs ]; then \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/vfs $(1)/usr/lib/samba/; \
+       fi
+       if [ -d $(PKG_INSTALL_DIR)/usr/lib/samba/pdb ]; then \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/samba/pdb $(1)/usr/lib/samba/; \
+       fi
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{smbpasswd,pdbedit,testparm} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smbd $(1)/usr/sbin/
+ifeq ($(CONFIG_SAMBA4_SERVER_AD_DC),y)
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7 $(1)/usr/lib/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{samba-tool,ntlm_auth} $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{samba,samba_gpoupdate,samba_dnsupdate,samba_kcc,samba_spnupdate,samba_upgradedns} $(1)/usr/sbin/
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_NETBIOS),y)
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nmbd $(1)/usr/sbin/
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_WINBIND),y)
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wbinfo $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/winbindd $(1)/usr/sbin/
+endif
+ifeq ($(CONFIG_SAMBA4_SERVER_ACL),y)
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sharesec $(1)/usr/bin/
+endif
+       $(INSTALL_DIR) $(1)/etc/config $(1)/etc/samba $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/samba.config $(1)/etc/config/samba4
+       $(INSTALL_DATA) ./files/smb.conf.template $(1)/etc/samba
+       $(INSTALL_BIN) ./files/samba.init $(1)/etc/init.d/samba4
+endef
+
+define Package/samba4-server/conffiles
+/etc/config/samba4
+/etc/samba/smb.conf.template
+/etc/samba/smb.conf
+/etc/samba/smbpasswd
+/etc/samba/secrets.tdb
+/etc/samba/passdb.tdb
+/etc/samba/idmap.ldb
+/etc/samba/lmhosts
+/etc/nsswitch.conf
+endef
+
+$(eval $(call BuildPackage,samba4-libs))
+$(eval $(call BuildPackage,samba4-server))
+$(eval $(call BuildPackage,samba4-client))
+$(eval $(call BuildPackage,samba4-admin))
+$(eval $(call BuildPackage,samba4-utils))
diff --git a/net/samba4/files/samba.config b/net/samba4/files/samba.config
new file mode 100644 (file)
index 0000000..1d62dca
--- /dev/null
@@ -0,0 +1,7 @@
+config samba
+       option 'name'                   'OpenWrt-SMB'
+       option 'workgroup'              'WORKGROUP'
+       option 'description'    'Samba on OpenWrt'
+       option 'charset'                'UTF-8'
+       option 'homes'                  '0'
+
diff --git a/net/samba4/files/samba.init b/net/samba4/files/samba.init
new file mode 100644 (file)
index 0000000..9487875
--- /dev/null
@@ -0,0 +1,192 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+USE_PROCD=1
+
+smb_header() {
+       config_get samba_iface $1 interface "loopback lan"
+
+       # resolve interfaces
+       local interfaces=$(
+               . /lib/functions/network.sh
+
+               local net
+               for net in $samba_iface; do
+                       local device
+                       network_is_up $net || continue
+                       network_get_device device "$net"
+                       echo -n "${device:-$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:-WORKGROUP}"
+       config_get description          $1 description  "Samba on ${hostname:-OpenWrt}"
+       config_get charset              $1 charset      "UTF-8"
+
+       config_get_bool DISABLE_NETBIOS $1 disable_netbios      0
+       config_get_bool DISABLE_AD_DC   $1 disable_ad_dc        0
+       config_get_bool DISABLE_WINBIND $1 disable_winbind      0
+
+       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
+
+       echo -e "\n######### Dynamic written config options #########\n" >> /var/etc/smb.conf
+       if [ "$DISABLE_NETBIOS" -eq 1 ] || [ ! -x /usr/sbin/nmbd ]; then
+               echo -e "\tdisable netbios = yes" >> /var/etc/smb.conf
+       fi
+
+       local homes
+       config_get_bool homes $1 homes 0
+       [ $homes -gt 0 ] && {
+               cat <<EOT >> /var/etc/smb.conf
+
+[homes]
+       comment     = Home Directories
+       browsable   = no
+       writable = yes
+       read only   = no
+       create mask = 0750
+EOT
+       }
+
+       [ -L /etc/samba/smb.conf ] || ln -nsf /var/etc/smb.conf /etc/samba/smb.conf
+}
+
+smb_add_share() {
+       local name
+       local path
+       local users
+       local public
+       local writable
+       local printable
+       local create_mask
+
+       local browseable
+       local read_only
+       local guest_ok
+       local guest_only
+       local inherit_owner
+       local vfs_objects
+
+       config_get name $1 name
+       config_get path $1 path
+       config_get users $1 users
+       config_get public $1 public
+       config_get writable $1 writable
+       config_get printable $1 printable
+       config_get create_mask $1 create_mask
+       config_get dir_mask $1 dir_mask
+
+
+       config_get browseable $1 browseable
+       config_get read_only $1 read_only
+       config_get guest_ok $1 guest_ok
+       config_get guest_only $1 guest_only
+       config_get inherit_owner $1 inherit_owner
+       config_get vfs_objects $1 vfs_objects
+
+
+       [ -z "$name" -o -z "$path" ] && return
+
+       echo -e "\n[$name]\n\tpath = $path" >> /var/etc/smb.conf
+       [ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/smb.conf
+       [ -n "$public" ] && echo -e "\tpublic = $public" >> /var/etc/smb.conf
+       [ -n "$writable" ] && echo -e "\twritable = $writable" >> /var/etc/smb.conf
+       [ -n "$printable" ] && echo -e "\tprintable = $printable" >> /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
+
+       [ -n "$browseable" ] && echo -e "\tbrowseable = $browseable" >> /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 "$guest_only" ] && echo -e "\tguest only = $guest_only" >> /var/etc/smb.conf
+       [ -n "$inherit_owner" ] && echo -e "\tinherit owner = $inherit_owner" >> /var/etc/smb.conf
+       [ -n "$vfs_objects" ] && echo -e "\tvfs objects = $vfs_objects" >> /var/etc/smb.conf
+}
+
+init_config() {
+       # Create samba dirs
+       [ -d /var/lib/samba ] || mkdir -p /var/lib/samba
+       [ -d /var/cache/samba ] || mkdir -p /var/cache/samba
+       [ -d /var/run/samba ] || mkdir -p /var/run/samba
+       [ -d /var/log/samba ] || mkdir -p /var/log/samba
+       [ -d /var/lock ] && chmod 0755 /var/lock || {
+               mkdir -p /var/lock
+               chmod 0755 /var/lock
+       }
+
+       config_load samba4
+       config_foreach smb_header samba
+       config_foreach smb_add_share sambashare
+}
+
+reload_service() {
+       init_config
+
+       killall -HUP samba
+       killall -HUP smbd
+       killall -HUP nmbd
+       killall -HUP winbindd
+}
+
+service_triggers() {
+       procd_add_reload_trigger samba4
+
+       local i
+       for i in $samba_iface; do
+               procd_add_reload_interface_trigger $i
+       done
+}
+
+start_service() {
+       init_config
+
+       # start main AC-DC daemon, will spawn (smbd,nmbd,winbindd) as needed/configured.
+       if [ "$DISABLE_AD_DC" -ne 1 ] && [ -x /usr/sbin/samba ]; then
+               procd_open_instance
+               procd_set_param command /usr/sbin/samba -F
+               procd_set_param respawn
+               procd_set_param file /var/etc/smb.conf
+               procd_close_instance
+       else
+               # start fileserver daemon
+               procd_open_instance
+               procd_set_param command /usr/sbin/smbd -F
+               procd_set_param respawn
+               procd_set_param file /var/etc/smb.conf
+               procd_close_instance
+
+               # start netbios daemon
+               if [ "$DISABLE_NETBIOS" -ne 1 ] && [ -x /usr/sbin/nmbd ]; then
+                       procd_open_instance
+                       procd_set_param command /usr/sbin/nmbd -F
+                       procd_set_param respawn
+                       procd_set_param file /var/etc/smb.conf
+                       procd_close_instance
+               fi
+               # start winbind daemon
+               if [ "$DISABLE_WINBIND" -ne 1 ] && [ -x /usr/sbin/winbindd ]; then
+                       procd_open_instance
+                       procd_set_param command /usr/sbin/winbindd -F
+                       procd_set_param respawn
+                       procd_set_param file /var/etc/smb.conf
+                       procd_close_instance
+               fi
+       fi
+       # lower priority using renice (if found)
+       if [ -x /usr/bin/renice ]; then
+               [ -x /usr/sbin/samba ] && renice -n 2 $(pidof samba)
+               [ -x /usr/sbin/smbd ] && renice -n 2 $(pidof smbd)
+               [ -x /usr/sbin/nmbd ] && renice -n 2 $(pidof nmbd)
+               [ -x /usr/sbin/winbindd ] && renice -n 2 $(pidof winbindd)
+       fi
+}
diff --git a/net/samba4/files/smb.conf.template b/net/samba4/files/smb.conf.template
new file mode 100644 (file)
index 0000000..77f4e96
--- /dev/null
@@ -0,0 +1,100 @@
+[global]
+       netbios name = |NAME| 
+       interfaces = |INTERFACES|
+       server string = |DESCRIPTION|
+       unix charset = |CHARSET|
+       workgroup = |WORKGROUP|
+
+       ## This global parameter allows the Samba admin to limit what interfaces on a machine will serve SMB requests.
+       bind interfaces only = yes
+       
+       ## time for inactive connections to-be closed in minutes
+       deadtime = 15
+       
+       ## disable core dumps
+       enable core files = no
+       
+       ## set security (auto, user, domain, ads)
+       security = user
+       
+       ## This parameter controls whether a remote client is allowed or required to use SMB encryption.
+       ## It has different effects depending on whether the connection uses SMB1 or SMB2 and newer:
+    ## If the connection uses SMB1, then this option controls the use of a Samba-specific extension to the SMB protocol introduced in Samba 3.2 that makes use of the Unix extensions.
+       ## If the connection uses SMB2 or newer, then this option controls the use of the SMB-level encryption that is supported in SMB version 3.0 and above and available in Windows 8 and newer. 
+       ##(default/auto,desired,required,off)
+       #smb encrypt = default
+       
+       ## set invalid users
+       invalid users = root
+       
+       ## map unknow users to guest
+       map to guest = Bad User
+
+       ## allow client access to accounts that have null passwords. 
+       null passwords = yes
+       
+       ## The old plaintext passdb backend. Some Samba features will not work if this passdb backend is used. (NOTE: enabled for size reasons)
+       ## (tdbsam,smbpasswd,ldapsam)
+       passdb backend = smbpasswd
+       
+       ## Set location of smbpasswd ('smbd -b' will show default compiled location)
+       #smb passwd file = /etc/samba/smbpasswd 
+       
+       ## LAN/WAN options (IPTOS_LOWDELAY TCP_NODELAY) WAN (IPTOS_THROUGHPUT)
+       socket options = IPTOS_LOWDELAY TCP_NODELAY
+       
+       ## lower CPU useage if supported
+       use sendfile = yes
+       
+       ## samba will behave as previous versions of Samba would and will fail the lock request immediately if the lock range cannot be obtained.
+       #blocking locks = No
+       
+       ## disable loading of all printcap printers by default (iprint, cups, lpstat)
+       load printers = No
+       printcap name = /dev/null
+       
+       ## Disable that nmbd is acting as a WINS server for unknow netbios names
+       #dns proxy = No
+       
+       ## win/unix user mapping backend
+       #idmap config * : backend = tdb
+       
+       ## Allows the server name that is advertised through MDNS to be set to the hostname rather than the Samba NETBIOS name.
+       ## This allows an administrator to make Samba registered MDNS records match the case of the hostname rather than being in all capitals.
+       ## (netbios, mdns)
+       #mdns name = mdns
+       
+       ## Clients that only support netbios won't be able to see your samba server when netbios support is disabled.
+       #disable netbios = Yes
+       
+       ## Setting this value to no will cause nmbd never to become a local master browser.
+       #local master = no
+
+       ## (auto, yes) If this is set to yes, on startup, nmbd will force an election, and it will have a slight advantage in winning the election. It is recommended that this parameter is used in conjunction with domain master = yes, so that nmbd can guarantee becoming a domain master. 
+       #preferred master = yes
+
+       ## (445 139) Specifies which ports the server should listen on for SMB traffic.
+       ## 139 is netbios/nmbd
+       #smb ports = 445 139
+       
+       ## This is a list of files and directories that are neither visible nor accessible.
+       ## Each entry in the list must be separated by a '/', which allows spaces to be included in the entry. '*' and '?' can be used to specify multiple files or directories as in DOS wildcards.
+       veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/
+       
+       ## If a directory that is to be deleted contains nothing but veto files this deletion will fail unless you also set the delete veto files parameter to yes.
+       delete veto files = yes
+       
+################ Filesystem and creation rules ################
+       ## reported filesystem type (NTFS,Samba,FAT)
+       #fstype = FAT
+       
+       ## Allows a user who has write access to the file (by whatever means, including an ACL permission) to modify the permissions (including ACL) on it.
+       #dos filemode = Yes
+       
+       ## file/dir creating rules
+       #create mask = 0666
+       #directory mask = 0777
+       #force group = root
+       #force user = root
+       #inherit owner = windows and unix
+################################################################
diff --git a/net/samba4/patches/001-samba-4.4.0-pam.patch b/net/samba4/patches/001-samba-4.4.0-pam.patch
new file mode 100644 (file)
index 0000000..4516013
--- /dev/null
@@ -0,0 +1,29 @@
+--- samba-4.4.0rc2/source3/wscript
++++ samba-4.4.0rc2/source3/wscript
+@@ -870,7 +870,7 @@
+         if conf.env.with_iconv:
+             conf.DEFINE('HAVE_ICONV', 1)
+-    if Options.options.with_pam:
++    if Options.options.with_pam != False:
+         use_pam=True
+         conf.CHECK_HEADERS('security/pam_appl.h pam/pam_appl.h')
+         if not conf.CONFIG_SET('HAVE_SECURITY_PAM_APPL_H') and not conf.CONFIG_SET('HAVE_PAM_PAM_APPL_H'):
+@@ -943,6 +943,17 @@
+             conf.DEFINE('WITH_PAM', 1)
+             conf.DEFINE('WITH_PAM_MODULES', 1)
++    else:
++        Logs.warn("PAM disabled")
++        use_pam=False
++        conf.undefine('WITH_PAM')
++        conf.undefine('WITH_PAM_MODULES')
++        conf.undefine('HAVE_SECURITY_PAM_APPL_H')
++        conf.undefine('PAM_RHOST')
++        conf.undefine('PAM_TTY')
++        conf.undefine('HAVE_PAM_PAM_APPL_H')
++
++
+     seteuid = False
+ #
diff --git a/net/samba4/patches/002-dnsserver-4.7.0.patch b/net/samba4/patches/002-dnsserver-4.7.0.patch
new file mode 100644 (file)
index 0000000..0c7592f
--- /dev/null
@@ -0,0 +1,19 @@
+samba: build dnsserver_common code
+
+Just 'install' does not seem to do it.
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+--- a/source4/dns_server/wscript_build
++++ b/source4/dns_server/wscript_build
+@@ -4,7 +4,7 @@ bld.SAMBA_LIBRARY('dnsserver_common',
+         source='dnsserver_common.c',
+         deps='samba-util samba-errors ldbsamba clidns',
+         private_library=True,
+-        install=bld.AD_DC_BUILD_IS_ENABLED()
++        enabled=bld.AD_DC_BUILD_IS_ENABLED()
+         )
+ bld.SAMBA_MODULE('service_dns',
diff --git a/net/samba4/patches/010-source3-msgsock-nvram-fix.patch b/net/samba4/patches/010-source3-msgsock-nvram-fix.patch
new file mode 100644 (file)
index 0000000..c2e69d3
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/source3/lib/messages.c
++++ b/source3/lib/messages.c
+@@ -221,7 +221,7 @@ struct messaging_context *messaging_init
+               return NULL;
+       }
+-      priv_path = private_path("msg.sock");
++      priv_path = lock_path("msg.sock");
+       if (priv_path == NULL) {
+               TALLOC_FREE(ctx);
+               return NULL;
+@@ -311,7 +311,7 @@ NTSTATUS messaging_reinit(struct messagi
+       msg_ctx->msg_dgm_ref = messaging_dgm_ref(
+               msg_ctx, msg_ctx->event_ctx, &msg_ctx->id.unique_id,
+-              private_path("msg.sock"), lck_path,
++              lock_path("msg.sock"), lck_path,
+               messaging_recv_cb, msg_ctx, &ret);
+       if (msg_ctx->msg_dgm_ref == NULL) {
diff --git a/net/samba4/patches/011-source4-msgsock-nvram-fix.patch b/net/samba4/patches/011-source4-msgsock-nvram-fix.patch
new file mode 100644 (file)
index 0000000..c9cf955
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/source4/lib/messaging/messaging.c
++++ b/source4/lib/messaging/messaging.c
+@@ -323,7 +323,7 @@ struct imessaging_context *imessaging_in
+               goto fail;
+       }
+-      msg->sock_dir = lpcfg_private_path(msg, lp_ctx, "msg.sock");
++      msg->sock_dir = lpcfg_lock_path(msg, lp_ctx, "msg.sock");
+       if (msg->sock_dir == NULL) {
+               goto fail;
+       }
diff --git a/net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch b/net/samba4/patches/100-do-not-import-target-module-while-cross-compile.patch
new file mode 100644 (file)
index 0000000..e112b3b
--- /dev/null
@@ -0,0 +1,58 @@
+Some modules such as dynamic library maybe cann't be imported while cross compile, 
+we just check whether does the module exist.
+
+Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Index: samba-4.4.2/buildtools/wafsamba/samba_bundled.py
+===================================================================
+--- samba-4.4.2.orig/buildtools/wafsamba/samba_bundled.py
++++ samba-4.4.2/buildtools/wafsamba/samba_bundled.py
+@@ -2,6 +2,7 @@
+ import sys
+ import Build, Options, Logs
++import imp, os
+ from Configure import conf
+ from samba_utils import TO_LIST
+@@ -230,17 +231,32 @@ def CHECK_BUNDLED_SYSTEM_PYTHON(conf, li
+     # versions
+     minversion = minimum_library_version(conf, libname, minversion)
+-    try:
+-        m = __import__(modulename)
+-    except ImportError:
+-        found = False
+-    else:
++    # Find module in PYTHONPATH
++    stuff = imp.find_module(modulename, [os.environ["PYTHONPATH"]])
++    if stuff:
+         try:
+-            version = m.__version__
+-        except AttributeError:
++            m = imp.load_module(modulename, stuff[0], stuff[1], stuff[2])
++        except ImportError:
+             found = False
++
++            if conf.env.CROSS_COMPILE:
++                # Some modules such as dynamic library maybe cann't be imported
++                # while cross compile, we just check whether the module exist
++                Logs.warn('Cross module[%s] has been found, but can not be loaded.' % (stuff[1]))
++                found = True
+         else:
+-            found = tuplize_version(version) >= tuplize_version(minversion)
++            try:
++                version = m.__version__
++            except AttributeError:
++                found = False
++            else:
++                found = tuplize_version(version) >= tuplize_version(minversion)
++        finally:
++            if stuff[0]:
++                stuff[0].close()
++    else:
++        found = False
++
+     if not found and not conf.LIB_MAY_BE_BUNDLED(libname):
+         Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion))
+         sys.exit(1)
diff --git a/net/samba4/patches/101-do-not-check-xsltproc-manpages.patch b/net/samba4/patches/101-do-not-check-xsltproc-manpages.patch
new file mode 100644 (file)
index 0000000..c37cfcd
--- /dev/null
@@ -0,0 +1,43 @@
+Don't check xsltproc manpages
+
+Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
+
+Index: samba-4.4.2/lib/ldb/wscript
+===================================================================
+--- samba-4.4.2.orig/lib/ldb/wscript
++++ samba-4.4.2/lib/ldb/wscript
+@@ -65,7 +65,7 @@ def configure(conf):
+                 conf.define('USING_SYSTEM_LDB', 1)
+     if conf.env.standalone_ldb:
+-        conf.CHECK_XSLTPROC_MANPAGES()
++        #conf.CHECK_XSLTPROC_MANPAGES()
+         # we need this for the ldap backend
+         if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'):
+Index: samba-4.4.2/lib/talloc/wscript
+===================================================================
+--- samba-4.4.2.orig/lib/talloc/wscript
++++ samba-4.4.2/lib/talloc/wscript
+@@ -56,7 +56,7 @@ def configure(conf):
+     if conf.env.standalone_talloc:
+         conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1
+-    conf.CHECK_XSLTPROC_MANPAGES()
++    #conf.CHECK_XSLTPROC_MANPAGES()
+     if not conf.env.disable_python:
+         # also disable if we don't have the python libs installed
+Index: samba-4.4.2/lib/tdb/wscript
+===================================================================
+--- samba-4.4.2.orig/lib/tdb/wscript
++++ samba-4.4.2/lib/tdb/wscript
+@@ -92,7 +92,7 @@ def configure(conf):
+         not conf.env.disable_tdb_mutex_locking):
+         conf.define('USE_TDB_MUTEX_LOCKING', 1)
+-    conf.CHECK_XSLTPROC_MANPAGES()
++    #conf.CHECK_XSLTPROC_MANPAGES()
+     if not conf.env.disable_python:
+         # also disable if we don't have the python libs installed
diff --git a/net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch b/net/samba4/patches/102-samba-4.8.2-unbundle-libreadline.patch
new file mode 100644 (file)
index 0000000..e164d56
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/libcli/smbreadline/wscript_configure
++++ b/libcli/smbreadline/wscript_configure
+@@ -1,11 +1,13 @@
+ #!/usr/bin/env python
+-conf.CHECK_HEADERS('readline.h history.h readline/readline.h readline/history.h')
+-for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
+-    if conf.CHECK_FUNCS_IN('tgetent', termlib):
+-        conf.env['READLINE_TERMLIB'] = termlib
+-        break
++#conf.CHECK_HEADERS('readline.h history.h readline/readline.h readline/history.h')
++#for termlib in ['ncurses', 'curses', 'termcap', 'terminfo', 'termlib', 'tinfo']:
++#    if conf.CHECK_FUNCS_IN('tgetent', termlib):
++#        conf.env['READLINE_TERMLIB'] = termlib
++#        break
++
++conf.undefine('HAVE_READLINE_READLINE_H')
+ #
+ # Check if we need to work around readline/readline.h
diff --git a/net/wsdd2/Makefile b/net/wsdd2/Makefile
new file mode 100644 (file)
index 0000000..1cda1ae
--- /dev/null
@@ -0,0 +1,46 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wsdd2
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/Andy2244/wsdd2.git
+PKG_SOURCE_DATE:=2018-07-24
+PKG_SOURCE_VERSION:=2c31ba3b720af81848c47dff7ad7c6c30c0c0f50
+PKG_MIRROR_HASH:=eb903a870d99c6001996dbfc22c15e1020278c45ed2441ceb61bc5395f417afa
+
+PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
+PKG_LICENSE:=GPL-3.0-only
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wsdd2
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=IP Addresses and Names
+  TITLE:=Web Services for Devices (WSD) daemon
+  URL:=https://kb.netgear.com/2649/NETGEAR-Open-Source-Code-for-Programmers-GPL
+endef
+
+define Package/wsdd2/description
+  Web Services for Devices or Web Services on Devices (WSD),
+  is a Microsoft API to simplify programming connections to web service
+  enabled devices, such as printers, scanners and file shares.
+
+  This daemon advertises and responds to probe requests from Windows clients looking for file shares.
+  It also implements LLMNR multicast name lookup services.
+endef
+
+define Build/Compile
+  $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(PKG_BUILD_DIR)/{wsdd2.c,wsd.c,llmnr.c} -o $(PKG_BUILD_DIR)/wsdd2
+endef
+
+define Package/wsdd2/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/wsdd2 $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/wsdd2.init $(1)/etc/init.d/wsdd2
+endef
+
+$(eval $(call BuildPackage,wsdd2))
diff --git a/net/wsdd2/files/wsdd2.init b/net/wsdd2/files/wsdd2.init
new file mode 100644 (file)
index 0000000..b795d8e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+USE_PROCD=1
+
+start_service() {
+    procd_open_instance
+    procd_set_param command /usr/bin/wsdd2 -w
+    procd_set_param respawn
+    procd_set_param file /var/etc/smb.conf
+    procd_close_instance
+}
diff --git a/net/wsdd2/patches/001-add_uuid_boot_id.patch b/net/wsdd2/patches/001-add_uuid_boot_id.patch
new file mode 100644 (file)
index 0000000..5f60f22
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/wsd.c    2018-07-20
++++ b/wsd.c    2018-07-20
+@@ -97,12 +97,17 @@ static void uuid_endpoint(char *uuid, si
+       FILE *fp = fopen("/etc/machine-id", "r");
+       int c, i = 0;
++      if (!fp) {
++              DEBUG(0, W, "Can't open '/etc/machine-id', trying '/proc/sys/kernel/random/boot_id'");
++              fp = fopen("/proc/sys/kernel/random/boot_id", "r");
++      }
++              
+       if (!fp)
+               return;
+       while (i < 36 && (c = getc(fp)) != EOF &&
+-              (isdigit(c) || (islower(c) && isxdigit(c)))) {
+-              if (i == 8 || i == 13 || i == 18 || i == 23)
++              ((c == '-') || isdigit(c) || (islower(c) && isxdigit(c)))) {
++              if ((c != '-') && (i == 8 || i == 13 || i == 18 || i == 23))
+                       uuid[i++] = '-';
+               uuid[i++] = c;
+       }
diff --git a/utils/qemu-userspace/Makefile b/utils/qemu-userspace/Makefile
new file mode 100644 (file)
index 0000000..92d7aff
--- /dev/null
@@ -0,0 +1,149 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=qemu
+PKG_VERSION:=3.0.0-rc2
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://download.qemu.org/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_HASH:=b02b30c7d460996835416ef09161f6faef2700e339cf11cd99481ca51b5954f2
+PKG_LICENSE:=GPL-2.0
+
+PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
+
+HOST_BUILD_PARALLEL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+HOST_BUILD_DEPENDS:=glib2/host
+
+define Package/qemu-userspace
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Virtualization
+  TITLE:=qemu $(PKG_VERSION) (Linux/BSD User space emulation)
+  URL:=https://www.qemu.org
+  DEPENDS:=+glib2 +zlib +libpthread @BROKEN
+endef
+
+define Package/qemu-userspace/description
+       QEMU is a generic and open source machine emulator and virtualizer. 
+       (This package version is for user space emulation only, not full system.)
+endef
+
+HOST_CONFIGURE_ARGS += \
+       --audio-drv-list=''             \
+       --disable-slirp                 \
+       --disable-debug-info    \
+       --disable-modules               \
+       --disable-sdl                   \
+       --disable-qom-cast-debug        \
+       --disable-virtfs                \
+       --disable-vnc                   \
+       --disable-debug-tcg             \
+       --disable-sparse                \
+       --disable-strip                 \
+       --disable-vnc-sasl              \
+       --disable-vnc-jpeg              \
+       --disable-vnc-png               \
+       --disable-vde                   \
+       --disable-netmap                \
+       --disable-xen                   \
+       --disable-xen-pci-passthrough   \
+       --disable-xen-pv-domain-build   \
+       --disable-brlapi                \
+       --disable-bluez                 \
+       --disable-tcg-interpreter       \
+       --disable-cap-ng                \
+       --disable-spice                 \
+       --disable-libiscsi              \
+       --disable-libnfs                \
+       --disable-cocoa                 \
+       --disable-werror                \
+       --disable-stack-protector       \
+       --disable-curl                  \
+       --disable-crypto-afalg  \
+       --disable-docs                  \
+       --disable-vhost-net             \
+       --disable-vhost-scsi    \
+       --disable-vhost-vsock   \
+       --disable-opengl                \
+       --disable-rbd                   \
+       --disable-xfsctl                \
+       --disable-smartcard             \
+       --disable-libusb                \
+       --disable-usb-redir             \
+       --disable-zlib-test             \
+       --disable-lzo                   \
+       --disable-snappy                \
+       --disable-bzip2                 \
+       --disable-guest-agent-msi       \
+       --without-vss-sdk               \
+       --without-win-sdk               \
+       --disable-tools                 \
+       --disable-glusterfs             \
+       --disable-gtk                   \
+       --disable-gnutls                \
+       --disable-nettle                \
+       --disable-gcrypt                \
+       --disable-rdma                  \
+       --disable-vte                   \
+       --disable-virglrenderer \
+       --disable-tpm                   \
+       --disable-libssh2               \
+       --disable-strip                 \
+       --disable-replication   \
+       --disable-vxhs                  \
+       --disable-system                \
+       --disable-guest-agent   \
+       --disable-pie                   \
+       --disable-live-block-migration \
+       --disable-numa                  \
+       --disable-libxml2               \
+       --disable-capstone              \
+       --disable-debug-mutex   \
+       --disable-git-update    \
+       --disable-hax                   \
+       --disable-kvm                   \
+       --disable-hvf                   \
+       --disable-whpx                  \
+       --disable-blobs
+
+#      --disable-tcg
+#      --disable-bsd-user
+#      --disable-linux-aio
+#      --disable-attr
+#      --disable-seccomp
+#      --disable-coroutine-pool
+#      --disable-tcmalloc
+#      --disable-jemalloc
+#      --disable-vhost-user
+
+# QEMU configure script does not recognize these options
+HOST_CONFIGURE_ARGS:=$(filter-out      \
+       --target=%              \
+       --host=%                \
+       --build=%               \
+       --program-prefix=%      \
+       --program-suffix=%      \
+       --exec-prefix=%         \
+       --disable-nls           \
+       , $(HOST_CONFIGURE_ARGS))
+
+# does this do anything in usermode?
+CONFIGURE_ARGS:=$(filter-out   \
+       --disable-hax   \
+       --disable-kvm   \
+       --disable-hvf   \
+       --disable-blobs \
+       , $(HOST_CONFIGURE_ARGS))
+       
+CONFIGURE_ARGS +=                      \
+       --cross-prefix=$(TARGET_CROSS)  \
+       --host-cc="$(HOSTCC)"
+       
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,qemu-userspace))
git clone https://git.99rst.org/PROJECT