# Maintainer: Natanael Copa pkgname=samba pkgver=4.4.3 pkgrel=0 pkgdesc="Tools to access a server's filespace and printers via SMB" url="http://www.samba.org" arch="all" license="GPL3" subpackages="$pkgname-dev $pkgname-doc $pkgname-common $pkgname-initscript $pkgname-common-tools:_common_tools $pkgname-common-server-libs:_common_server_libs $pkgname-common-libs:_common_libs libsmbclient $pkgname-client $pkgname-client-libs:_client_libs $pkgname-winbind libwbclient $pkgname-winbind-clients:_winbind_clients $pkgname-winbind-krb5-locator:_winbind_krb5_locator $pkgname-libnss-winbind:_libnss_winbind $pkgname-server $pkgname-server-libs:_server_libs $pkgname-pidl py-$pkgname:_py $pkgname-test:_test $pkgname-libs-py:_libs_py $pkgname-libs" depends="$pkgname-server=$pkgver-r$pkgrel $pkgname-client=$pkgver-r$pkgrel $pkgname-common-tools=$pkgver-r$pkgrel" # note that heimdal is required (over mit krb5) for AD DC functionality makedepends="popt-dev ncurses-dev openldap-dev e2fsprogs-dev krb5-dev talloc-dev tdb-dev py-tdb ldb-dev cups-dev python-dev libcap-dev tevent-dev py-tevent iniparser-dev perl subunit-dev docbook-xsl libarchive-dev" source="http://us1.samba.org/samba/ftp/stable/samba-$pkgver.tar.gz uclibc-xattr-create.patch domain.patch getpwent_r.patch samba.initd samba.confd samba.logrotate " pkggroups="winbind" _builddir="$srcdir"/samba-$pkgver prepare() { cd "$_builddir" for i in $source; do case $i in *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; esac done } build() { cd "$_builddir" local _jobs=$JOBS if [ -z "$_jobs" ]; then _jobs=$(awk '/^core id/ {n++} END{print n}' /proc/cpuinfo) fi ./configure --prefix=/usr \ --jobs=${_jobs:-2} \ --sysconfdir=/etc/samba \ --with-configdir=/etc/samba \ --localstatedir=/var \ --enable-fhs \ --with-lockdir=/var/cache/samba \ --with-piddir=/var/run/samba \ --with-logfilebase=/var/log/samba \ --without-pam \ --without-systemd \ --with-ads \ --with-system-mitkrb5 \ --with-shared-modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2,pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4,auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4 \ --enable-cups \ --without-gettext \ --bundled-libraries=NONE,ntdb \ --disable-rpath-install \ || return 1 make || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install || return 1 install -d "$pkgdir"/var/log/samba \ "$pkgdir"/usr/share/doc/samba \ || return 1 install -d -m 0755 "$pkgdir"/var/lib/samba/sysvol || return 1 install -D packaging/RHEL/setup/smbusers "$pkgdir"/etc/samba/smbusers \ || return 1 install -m 0744 packaging/printing/smbprint "$pkgdir"/usr/bin/smbprint \ || return 1 install -Dm644 "$srcdir"/samba.logrotate "$pkgdir"/etc/logrotate.d/samba # needed only by DC rm -r "$pkgdir"/usr/lib/samba/ldb } initscript() { pkgdesc="Init script for Samba" depends="" install -Dm755 $srcdir/samba.initd "$subpkgdir"/etc/init.d/samba install -Dm644 $srcdir/samba.confd "$subpkgdir"/etc/conf.d/samba } _mv_files() { local i for i in "$@"; do case $i in */*) mkdir -p "$subpkgdir"/${i%/*};; *) mkdir -p "$subpkgdir";; esac mv "$pkgdir"/$i "$subpkgdir"/$i || return 1 done } common() { pkgdesc="Samba common files for both client an servers" depends= cd "$pkgdir" _mv_files \ etc \ var \ || return 1 install -d -m700 "$subpkgdir"/var/lib/samba/private } # common-libs is an attempt to avoid libpython dependency for libsmbclient _libs_py() { pkgdesc="Libraries that require libpython" depends= cd "$pkgdir" _mv_files \ usr/lib/samba/libsamba-net-samba4.so \ usr/lib/samba/libsamba-python-samba4.so \ || return 1 return 0 } _common_tools() { pkgdesc="Tools for Samba servers and clients" depends= cd "$pkgdir" _mv_files \ usr/bin/net \ usr/bin/pdbedit \ usr/bin/profiles \ usr/bin/smbcontrol \ usr/bin/smbpasswd \ usr/bin/testparm \ usr/lib/samba/libgpo-samba4.so \ usr/lib/samba/libnet-keytab-samba4.so \ || return 1 } _common_server_libs() { pkgdesc="Samba libraries shared by common-tools and servers" depends="" cd "$pkgdir" _mv_files \ usr/lib/libnetapi.so.* \ usr/lib/libsmbldap.so.* \ usr/lib/samba/libads-samba4.so \ usr/lib/samba/libauth-samba4.so \ usr/lib/samba/libnpa-tstream-samba4.so \ usr/lib/samba/libprinting-migrate-samba4.so \ usr/lib/samba/libsmbd-base-samba4.so \ usr/lib/samba/libsmbd-conn-samba4.so \ usr/lib/samba/libsmbldaphelper-samba4.so \ usr/lib/samba/pdb \ || return 1 } _common_libs() { pkgdesc="Samba libraries shared by common-tools, server and clients" depends="" cd "$pkgdir" _mv_files \ usr/lib/samba/libcli-spoolss-samba4.so \ usr/lib/samba/libtrusts-util-samba4.so \ usr/lib/libdcerpc-binding.so.* \ usr/lib/libsamba-passdb.so.* \ usr/lib/samba/libdcerpc-samba-samba4.so \ usr/lib/samba/liblibcli-lsa3-samba4.so \ usr/lib/samba/liblibcli-netlogon3-samba4.so \ usr/lib/samba/liblibsmb-samba4.so \ usr/lib/samba/libmsrpc3-samba4.so \ usr/lib/samba/libndr-samba4.so \ || return 1 } libsmbclient() { pkgdesc="The SMB client library" depends= cd "$pkgdir" _mv_files \ usr/lib/libsmbclient.so.* \ || return 1 } _client_libs() { pkgdesc="Samba libraries used by clients" depends= cd "$pkgdir" _mv_files \ usr/lib/libdcerpc.so.* \ usr/lib/samba/libcli-ldap-samba4.so \ usr/lib/samba/libcmdline-credentials-samba4.so \ usr/lib/samba/libevents-samba4.so \ usr/lib/samba/libhttp-samba4.so \ usr/lib/samba/libnetif-samba4.so \ usr/lib/samba/libregistry-samba4.so \ usr/lib/samba/libsmbclient-raw-samba4.so \ || return 1 } client() { pkgdesc="Samba client programs" depends="$pkgname-common=$pkgver-r$pkgrel" cd "$pkgdir" _mv_files \ usr/bin/cifsdd \ usr/bin/dbwrap_tool \ usr/bin/nmblookup \ usr/bin/oLschema2ldif \ usr/bin/regdiff \ usr/bin/regpatch \ usr/bin/regshell \ usr/bin/regtree \ usr/bin/rpcclient \ usr/bin/samba-regedit \ usr/bin/sharesec \ usr/bin/smbcacls \ usr/bin/smbclient \ usr/bin/smbcquotas \ usr/bin/smbget \ usr/bin/smbprint \ usr/bin/smbspool \ usr/bin/smbtar \ usr/bin/smbtree \ usr/libexec/samba/smbspool_krb5_wrapper \ || return 1 } # usr/lib/samba/libLIBWBCLIENT-OLD-samba4.so \ # usr/lib/samba/libauth-unix-token-samba4.so \ # usr/lib/samba/libauth4-samba4.so \ _server_libs() { pkgdesc="Samba libraries shared by server and windbind" depends= cd "$pkgdir" _mv_files \ usr/lib/samba/libMESSAGING-samba4.so \ usr/lib/samba/libdcerpc-samba4.so \ usr/lib/samba/libidmap-samba4.so \ usr/lib/samba/libnss-info-samba4.so \ \ usr/lib/samba/libxattr-tdb-samba4.so \ usr/lib/samba/libnon-posix-acls-samba4.so \ || return 1 } winbind() { pkgdesc="Samba user and group resolver" depends="$pkgname-common=$pkgver-r$pkgrel" install="winbind.pre-install winbind.pre-upgrade winbind.post-install winbind.post-upgrade" cd "$pkgdir" _mv_files \ usr/sbin/winbindd \ usr/lib/samba/idmap \ usr/lib/samba/nss_info \ || return 1 install -d -g winbind -m 750 \ "$subpkgdir"/var/cache/samba/winbindd_privileged } libwbclient() { pkgdesc="Samba winbind client libraries" depends= cd "$pkgdir" _mv_files \ usr/lib/libwbclient.so.* \ usr/lib/samba/libreplace-samba4.so \ usr/lib/samba/libwinbind-client-samba4.so \ || return 1 } _winbind_clients() { pkgdesc="Samba winbind client tools" depends= cd "$pkgdir" _mv_files \ usr/bin/ntlm_auth \ usr/bin/wbinfo \ || return 1 } _libnss_winbind() { pkgdesc="Samba winbind NSS plugin" depends= cd "$pkgdir" _mv_files \ usr/lib/libnss_winbind.so* \ usr/lib/libnss_wins.so* \ || return 1 } _winbind_krb5_locator() { pkgdesc="Samba winbind krb5 locator" depends= cd "$pkgdir" _mv_files \ usr/lib/winbind_krb5_locator.so \ || return 1 } server() { pkgdesc="Samba server" depends="$pkgname-common=$pkgver-r$pkgrel $pkgname-initscript=$pkgver-r$pkgrel" cd "$pkgdir" _mv_files \ usr/sbin/nmbd \ usr/sbin/smbd \ usr/bin/eventlogadm \ usr/bin/smbstatus \ \ usr/lib/samba/auth \ usr/lib/samba/vfs \ || return 1 } pidl() { pkgdesc="Perl IDL compiler" depends="perl" cd "$pkgdir" _mv_files \ usr/bin/pidl \ usr/share/perl* \ || return 1 } _py() { pkgdesc="Samba python libraries" depends="py-tdb" mkdir -p "$subpkgdir"/usr/lib mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ } _test() { pkgdesc="Samba server and client testing tools" depends= cd "$pkgdir" _mv_files \ usr/bin/gentest \ usr/bin/locktest \ usr/bin/masktest \ usr/bin/ndrdump \ usr/bin/smbtorture \ usr/lib/samba/libcluster-samba4.so \ usr/lib/samba/libdsdb-module-samba4.so \ usr/lib/samba/libshares-samba4.so \ usr/lib/samba/libsmbpasswdparser-samba4.so \ usr/lib/samba/libtorture-samba4.so \ || return 1 } libs() { pkgdesc="Samba core libraries" depends= cd "$pkgdir" _mv_files \ usr/lib/libndr-krb5pac.so.* \ usr/lib/libndr-nbt.so.* \ usr/lib/libndr-standard.so.* \ usr/lib/libndr.so.* \ usr/lib/libsamba-credentials.so.* \ usr/lib/libsamba-errors.so.* \ usr/lib/libsamba-hostconfig.so.* \ usr/lib/libsamba-util.so.* \ usr/lib/libsamdb.so.* \ usr/lib/libsmbconf.so.* \ usr/lib/libtevent-unix-util.so.* \ usr/lib/libtevent-util.so.* \ usr/lib/samba/libCHARSET3-samba4.so \ usr/lib/samba/libaddns-samba4.so \ usr/lib/samba/libasn1util-samba4.so \ usr/lib/samba/libauth-sam-reply-samba4.so \ usr/lib/samba/libauthkrb5-samba4.so \ usr/lib/samba/libcli-cldap-samba4.so \ usr/lib/samba/libcli-ldap-common-samba4.so \ usr/lib/samba/libcli-nbt-samba4.so \ usr/lib/samba/libcli-smb-common-samba4.so \ usr/lib/samba/libcliauth-samba4.so \ usr/lib/samba/libdbwrap-samba4.so \ usr/lib/samba/libflag-mapping-samba4.so \ usr/lib/samba/libgenrand-samba4.so \ usr/lib/samba/libgensec-samba4.so \ usr/lib/samba/libgse-samba4.so \ usr/lib/samba/libinterfaces-samba4.so \ usr/lib/samba/libiov-buf-samba4.so \ usr/lib/samba/libkrb5samba-samba4.so \ usr/lib/samba/libldbsamba-samba4.so \ usr/lib/samba/libmessages-dgm-samba4.so \ usr/lib/samba/libmessages-util-samba4.so \ usr/lib/samba/libmsghdr-samba4.so \ usr/lib/samba/libndr-samba-samba4.so \ usr/lib/samba/libpopt-samba3-samba4.so \ usr/lib/samba/libsamba-cluster-support-samba4.so \ usr/lib/samba/libsamba-debug-samba4.so \ usr/lib/samba/libsamba-modules-samba4.so \ usr/lib/samba/libsamba-security-samba4.so \ usr/lib/samba/libsamba-sockets-samba4.so \ usr/lib/samba/libsamba3-util-samba4.so \ usr/lib/samba/libsamdb-common-samba4.so \ usr/lib/samba/libsecrets3-samba4.so \ usr/lib/samba/libserver-id-db-samba4.so \ usr/lib/samba/libserver-role-samba4.so \ usr/lib/samba/libsmb-transport-samba4.so \ usr/lib/samba/libsmbd-shim-samba4.so \ usr/lib/samba/libsmbregistry-samba4.so \ usr/lib/samba/libsocket-blocking-samba4.so \ usr/lib/samba/libsys-rw-samba4.so \ usr/lib/samba/libtalloc-report-samba4.so \ usr/lib/samba/libtdb-wrap-samba4.so \ usr/lib/samba/libtime-basic-samba4.so \ usr/lib/samba/libutil-cmdline-samba4.so \ usr/lib/samba/libutil-reg-samba4.so \ usr/lib/samba/libutil-setid-samba4.so \ usr/lib/samba/libutil-tdb-samba4.so \ || return 1 } md5sums="83b1af8a9899ab4de99f155fc42c83dd samba-4.4.3.tar.gz f9ee1f13e59c60ee7e481f51329bf7d4 uclibc-xattr-create.patch f0d10a87a2067d0d3accdcb6c9b64ea9 domain.patch 6a220b2471764e6e189829ac9cc81996 getpwent_r.patch c1702b2ad7b68f7d704f50a1bfef3ad3 samba.initd c150433426e18261e6e3eed3930e1a76 samba.confd b7cafabfb4fa5b3ab5f2e857d8d1c733 samba.logrotate" sha256sums="031e6ada6d15deae6850845eed41497af32207fb679d6c6c74f19acc99d437ba samba-4.4.3.tar.gz dcf6a7118297d6567d8ff31c9eff1afffdf2f548db36fd17d00cdf0ffc555fe3 uclibc-xattr-create.patch 5554fff0df5d31e67a705c60d97e187b4109c79c8a4063c8ea7ebe1e0e4a7e7e domain.patch 7956274b412a268339abb63f8e1bd63b5049cd4ab7c6270235d9d0b9bcf6c81a getpwent_r.patch 3866a15ab73a9fd704ec8315cff48caf98937c490ba8dc40ce3701cef5ca22c9 samba.initd 1d12f98a7727967b04eb123109b34cfffef320822dc0e8059286b6e3394c3fc0 samba.confd 4c2b7d529126b2fc4f62fb09d99e49a87632d723a2d9d289a61e37dd84145be1 samba.logrotate" sha512sums="25c447f476a54c7e5992d3010957401373eb99b89bcab3e80d7a5aee08413fab87d0dc87d43e7c541b4fa1778a8707121639f56a208dd634e0b1f905eb8afa7c samba-4.4.3.tar.gz b43809d7ecbf3968f5154c2ded6ed47dae36921f1895ea98bcce50557eb2ad39b736345ffb4214655ed3154c143c20431d248cde828285380bafbf4d2627df9b uclibc-xattr-create.patch 62d373dbaee75121a1d73f2c09cdca7239705808ff807b171d1d5a28fd4ffc66bdb52494b62786d7aaba8aeece5c08433b532ca96a28d712452fe9daac8d8d2e domain.patch 0d4fd9862191554dc9c724cec0b94fd19afbfd0c4ed619e4c620c075e849cb3f3d44db1e5f119d890da23a3dd0068d9873703f3d86c47b91310521f37356208b getpwent_r.patch 6bee83aab500f27248b315d8a5f567940d7232269b021d801b3d51c20ed9e4aad513ee0117f356fb388014a63a145beacb55307ef9addbf7997987304b548fcf samba.initd 4faf581ecef3ec38319e3c4ab6d3995c51fd7ba83180dc5553a2ff4dfb92efadb43030c543292130c4ed0c281dc0972c6973d52d48062c5edb39bb1c4bbb6dd6 samba.confd f88ebe59ca3a9e9b77dd5993c13ef3e73a838efb8ed858088b464a330132d662f33e25c27819e38835389dee23057a3951de11bae1eef55db8ff5e1ec6760053 samba.logrotate"