# $Id$ PNAME="samba" PVER="4.8.2" PBUILD="r1" PCAT="net-fs" DESCRIPTION="Samba provides seamless file and print services to SMB/CIFS clients." HOMEPAGE="http://www.samba.org" # todo: external ldb and tevent! DEPEND=">= virtual/glibc >= net-print/libcups-2.2 >= dev-db/tdb-1.3 >= dev-libs/popt-1.16 >= dev-libs/talloc-2.1 >= sys-apps/acl-2.2 >= sys-libs/ncurses-6.0 >= sys-libs/readline-7.0 >= sys-libs/pam-1.1 >= sys-libs/libsystemd-230 >= app-admin/gamin-0.1.10 >= net-dns/avahi-0.7 >= app-crypt/gnutls-3.6 >= net-nds/libldap-2.4 >= net-fs/cifs-utils-6.4" SDEPEND=">= sys-dev/automake-4 >= sys-dev/autoconf-5 >= virtual/sed >= dev-lang/perl-5.26.1 >= dev-lang/python-2.7 >= net-nds/openldap-2.4 >= app-text/docbook-xsl-stylesheets-1.78" SRCFILE="${PNAME}-${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" msetfeature "!check" # no check target in Makefile sminclude mtools multilib systemd # imap modules SMB_SHARED_MODULES="idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2" # pdb modules SMB_SHARED_MODULES+=",pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4,auth_unix" # auth modules SMB_SHARED_MODULES+=",auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4" # use external tdb SMB_BUNDLED_LIBRARIES="!tdb" # use external talloc SMB_BUNDLED_LIBRARIES+=",!talloc,!pytalloc-util" # use internal tevent SMB_BUNDLED_LIBRARIES+=",tevent" # use external popt SMB_BUNDLED_LIBRARIES+=",!popt" # use internal ldb SMB_BUNDLED_LIBRARIES+=",ldb,pyldb-util" CONFD_VER=1.2 SMBD_SVC_VER=1.5 NMBD_SVC_VER=1.3 WINBINDD_SVC_VER=1.2 SRC_URI=( http://us1.samba.org/samba/ftp/stable/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/lmhosts mirror://${PNAME}/smbusers mirror://${PNAME}/samba.confd-${CONFD_VER} mirror://${PNAME}/samba.pamd mirror://${PNAME}/samba.logrotate mirror://${PNAME}/samba.service mirror://${PNAME}/nmbd.service-${NMBD_SVC_VER} mirror://${PNAME}/smbd.service-${SMBD_SVC_VER} mirror://${PNAME}/winbindd.service-${WINBINDD_SVC_VER} ) UP2DATE="updatecmd http://ftp.samba.org/pub/samba | grep '${PNAME}-[0-9].*' | highesttarball gz" src_prepare() { munpack ${SRCFILE} || die # add our vendor suffix all-abis 'sed -i "s:^\(SAMBA_VERSION_VENDOR_SUFFIX=\).*:\1\"magellan\":" VERSION || die' #all-abis 'sh script/mkversion.sh || die' # new waf build system creates this one automatically } src_compile() { mconfigure \ --enable-fhs \ --libexecdir=/usr/'$(mlibdir)'/samba \ --sysconfdir=/etc/samba \ --localstatedir=/var \ --with-configdir=/etc/samba \ --with-modulesdir=/usr/'$(mlibdir)'/samba \ --with-piddir=/run/samba \ --with-lockdir=/var/cache/samba \ --with-logfilebase=/var/log/samba \ --with-privatedir=/var/lib/samba/private \ --bundled-libraries="${SMB_BUNDLED_LIBRARIES}" \ --with-shared-modules="${SMB_SHARED_MODULES}" \ --with-syslog \ --with-acl-support \ --enable-cups \ --with-ads \ --with-ldap \ --with-winbind \ --with-pam \ --with-quotas \ --with-systemd \ --enable-gnutls \ --enable-avahi \ --disable-rpath \ --disable-rpath-install \ || die mmake || die } src_install() { # required directories minstalldir /etc/samba || die all-abis 'minstalldir /usr/$(mlibdir)/cups/backend || die' minstalldir /usr/share/doc/${PNAME}-${PVER}/examples || die # required directories by samba at runtime mkeepdir /var/log/samba || die mkeepdir /run/samba || die mkeepdir /var/cache/samba || die mkeepdir /var/lib/samba/netlogon || die mkeepdir /var/lib/samba/profiles || die mkeepdir /var/lib/samba/printers/W32X86 || die mkeepdir /var/lib/samba/printers/WIN40 || die mkeepdir /var/lib/samba/printers/W32ALPHA || die mkeepdir /var/lib/samba/printers/W32MIPS || die mkeepdir /var/lib/samba/printers/W32PPC || die mkeepdir /var/lib/samba/private || die mkeepdir /var/spool/samba || die # fix permissions mchmod 0700 /var/lib/samba/private || die mchmod 1777 /var/spool/samba || die mmake DESTDIR=${BINDIR} install || die # if exist remove *.old binaries if [[ -n $(find ${BINDIR}/usr/bin -type f -name '*.old') ]] then for i in ${BINDIR}/usr/bin/*.old do [[ -e ${i} ]] && rm -f ${i} || die done fi # add cups printing support all-abis 'mlink ../../../bin/smbspool /usr/$(mlibdir)/cups/backend/smb || die' # install our config files # fake smb.conf to get smbmount work memptyfile /etc/samba/smb.conf || die # our smb example config minstalletc examples/smb.conf.default smb.conf.example /etc/samba || die # fix logrotate sed -i 's:log.%m:%m.log:g' ${BINDIR}/etc/samba/smb.conf.example || die # our lmhosts and smbusers config minstalletc lmhosts lmhosts /etc/samba || die minstalletc smbusers smbusers /etc/samba || die # install systemd units minstallconf samba.confd-${CONFD_VER} samba || die minstallunit nmbd.service-${NMBD_SVC_VER} nmbd.service || die minstallunit smbd.service-${SMBD_SVC_VER} smbd.service || die minstallunit winbindd.service-${WINBINDD_SVC_VER} winbindd.service || die minstallunit samba.service || die minstalldir /etc/tmpfiles.d || die MCONFIG=/etc/tmpfiles.d/samba.conf mclearconfig || die maddconfig 'd /run/samba 0755 root root -' # install pam configuration minstallpam samba.pamd samba || die # install logrotate config minstalllog samba.logrotate samba || die # other docs minstalldocs COPYING Manifest README REVISION Read-Manifest-Now Roadmap WHATSNEW.txt || die } postinstall() { mstartunit nmbd.service mstartunit winbindd.service mstartunit smbd.service echo echo "To initialize samba's password database, please run:" echo " pdbedit --force-initialized-passwords" echo echo "If you experience client locks in file transfers _only_, try the parameter" echo " use sendfile = no (man smb.conf(5), man sendfile(2))" echo echo "There also seem some problems with the smbfs implementation of the recent 2.6 kernels." echo "If you experience problems (lockups) with smbfs, try cifs as an alternative." echo } postremove() { mstopunit nmbd.service mstopunit winbindd.service mstopunit smbd.service }