diff --git a/srcpkgs/cifs-utils b/srcpkgs/cifs-utils deleted file mode 120000 index cba1f39180..0000000000 --- a/srcpkgs/cifs-utils +++ /dev/null @@ -1 +0,0 @@ -samba \ No newline at end of file diff --git a/srcpkgs/samba/INSTALL b/srcpkgs/samba/INSTALL new file mode 100644 index 0000000000..944ab9175b --- /dev/null +++ b/srcpkgs/samba/INSTALL @@ -0,0 +1,20 @@ +case "${ACTION}" in +post) + # create runtime required dirs. + bin/systemd-tmpfiles --create usr/lib/tmpfiles.d/samba.conf + cat << _EOF +========================================================================== + +To start the Samba SMB/CIFS server: + # systemctl start smbd.service + +To start the Samba NETBIOS name server: + # systemctl start nmbd.service + +To start the Samba Winbind daemon: + # systemctl start winbindd.service + +========================================================================== +_EOF + ;; +esac diff --git a/srcpkgs/samba/REMOVE b/srcpkgs/samba/REMOVE new file mode 100644 index 0000000000..c7b0c440d3 --- /dev/null +++ b/srcpkgs/samba/REMOVE @@ -0,0 +1,7 @@ +case ${ACTION} in +purge) + [ -d var/samba ] && rm -rf var/samba + [ -d var/spool/samba ] && rm -rf var/spool/samba + [ -d etc/samba/private ] && rm -rf etc/samba/private + ;; +esac diff --git a/srcpkgs/samba/cifs-utils.rshlibs b/srcpkgs/samba/cifs-utils.rshlibs deleted file mode 100644 index 631aa1dda4..0000000000 --- a/srcpkgs/samba/cifs-utils.rshlibs +++ /dev/null @@ -1 +0,0 @@ -libc.so.6 diff --git a/srcpkgs/samba/cifs-utils.template b/srcpkgs/samba/cifs-utils.template deleted file mode 100644 index 8b97059aa1..0000000000 --- a/srcpkgs/samba/cifs-utils.template +++ /dev/null @@ -1,19 +0,0 @@ -# Template file for 'cifs-utils'. -# -revision=1 -short_desc="Common Internet File System utilities" -long_desc=" - The SMB/CIFS protocol provides support for cross-platform file sharing with - Microsoft Windows, OS X, and other Unix systems. - - This package provides utilities for managing mounts of CIFS network file - systems." - - -do_install() -{ - install -d ${DESTDIR}/usr/share/man/man8 ${DESTDIR}/usr/sbin - mv ${SRCPKGDESTDIR}/usr/sbin/*cifs* ${DESTDIR}/usr/sbin - mv ${SRCPKGDESTDIR}/usr/share/man/man8/*cifs* \ - ${DESTDIR}/usr/share/man/man8 -} diff --git a/srcpkgs/samba/files/nmbd.service b/srcpkgs/samba/files/nmbd.service new file mode 100644 index 0000000000..6e22ef2fb6 --- /dev/null +++ b/srcpkgs/samba/files/nmbd.service @@ -0,0 +1,8 @@ +[Unit] +Description=Samba NetBIOS name server + +[Service] +ExecStart=/usr/sbin/nmbd -F + +[Install] +WantedBy=multi-user.target diff --git a/srcpkgs/samba/files/samba.logrotate b/srcpkgs/samba/files/samba.logrotate new file mode 100644 index 0000000000..1a278bd4ae --- /dev/null +++ b/srcpkgs/samba/files/samba.logrotate @@ -0,0 +1,10 @@ +/var/log/samba/*.log /var/log/samba/log.* { + notifempty + missingok + sharedscripts + copytruncate + postrotate + /bin/systemctl try-restart smbd.service nmbd.service winbindd.service \ + 2>/dev/null || true + endscript +} diff --git a/srcpkgs/samba/files/samba.pam b/srcpkgs/samba/files/samba.pam new file mode 100644 index 0000000000..53724d1f86 --- /dev/null +++ b/srcpkgs/samba/files/samba.pam @@ -0,0 +1,3 @@ +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so diff --git a/srcpkgs/samba/files/samba.tmpfiles b/srcpkgs/samba/files/samba.tmpfiles new file mode 100644 index 0000000000..061b3b1bea --- /dev/null +++ b/srcpkgs/samba/files/samba.tmpfiles @@ -0,0 +1,7 @@ +# Required directories at runtime by samba. +d /run/samba 0755 root root - - +d /run/samba/socket 0755 root root - - +d /etc/samba/private 0700 root root - - +d /var/samba 0750 root root - - +d /var/spool/samba 1777 root root - - +d /var/log/samba 0750 root root - - diff --git a/srcpkgs/samba/files/smbd.service b/srcpkgs/samba/files/smbd.service new file mode 100644 index 0000000000..beb9bfad7f --- /dev/null +++ b/srcpkgs/samba/files/smbd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Samba SMB/CIFS server + +[Service] +ExecStart=/usr/sbin/smbd -F +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/srcpkgs/samba/files/winbindd.service b/srcpkgs/samba/files/winbindd.service new file mode 100644 index 0000000000..509c896281 --- /dev/null +++ b/srcpkgs/samba/files/winbindd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Samba Winbind daemon + +[Service] +ExecStart=/usr/sbin/winbindd -F +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/srcpkgs/samba/libsmbclient.rshlibs b/srcpkgs/samba/libsmbclient.rshlibs index 8a4f0f4dc6..4ec6af290d 100644 --- a/srcpkgs/samba/libsmbclient.rshlibs +++ b/srcpkgs/samba/libsmbclient.rshlibs @@ -12,3 +12,4 @@ libldap-2.4.so.2 liblber-2.4.so.2 libz.so.1 libpthread.so.0 +librt.so.1 diff --git a/srcpkgs/samba/libsmbclient.template b/srcpkgs/samba/libsmbclient.template index d7d62f68db..12371bd2c5 100644 --- a/srcpkgs/samba/libsmbclient.template +++ b/srcpkgs/samba/libsmbclient.template @@ -5,14 +5,8 @@ long_desc=" This package provides a shared library that enables client applications to talk to Microsoft Windows and Samba servers using the SMB/CIFS protocol." - -revision=2 - -do_install() -{ - install -d ${DESTDIR}/usr/lib ${DESTDIR}/usr/share/man/man7 - mv ${SRCPKGDESTDIR}/usr/lib/libwbclient.so* ${DESTDIR}/usr/lib - mv ${SRCPKGDESTDIR}/usr/lib/libsmbclient.so* ${DESTDIR}/usr/lib - mv ${SRCPKGDESTDIR}/usr/share/man/man7/libsmbclient.7 \ - ${DESTDIR}/usr/share/man/man7 +do_install() { + vmove "usr/lib/libwbclient.so*" usr/lib + vmove "usr/lib/libsmbclient.so*" usr/lib + vmove usr/share/man/man7/libsmbclient.7 usr/share/man/man7 } diff --git a/srcpkgs/samba/samba-devel.template b/srcpkgs/samba/samba-devel.template index 54c2201a21..d69daba57a 100644 --- a/srcpkgs/samba/samba-devel.template +++ b/srcpkgs/samba/samba-devel.template @@ -6,24 +6,8 @@ long_desc=" This package provides development files: headers, static libraries, etc." -Add_dependency run libcap-devel -Add_dependency run popt-devel -Add_dependency run mit-krb5-devel -Add_dependency run e2fsprogs-devel -Add_dependency run libldap-devel -Add_dependency run zlib-devel -Add_dependency run pam-devel -Add_dependency run acl-devel -Add_dependency run attr-devel -Add_dependency run avahi-libs-devel -Add_dependency run readline-devel -Add_dependency run tdb-devel Add_dependency run libsmbclient -revision=2 - -do_install() -{ - mkdir -p ${DESTDIR}/usr/lib - mv ${SRCPKGDESTDIR}/usr/include ${DESTDIR}/usr +do_install() { + vmove usr/include usr } diff --git a/srcpkgs/samba/samba.rshlibs b/srcpkgs/samba/samba.rshlibs index c37250b509..8694b8b25e 100644 --- a/srcpkgs/samba/samba.rshlibs +++ b/srcpkgs/samba/samba.rshlibs @@ -18,3 +18,4 @@ libacl.so.1 libattr.so.1 libavahi-client.so.3 libavahi-common.so.3 +librt.so.1 diff --git a/srcpkgs/samba/smbclient.rshlibs b/srcpkgs/samba/smbclient.rshlibs index db654d72a4..a318898204 100644 --- a/srcpkgs/samba/smbclient.rshlibs +++ b/srcpkgs/samba/smbclient.rshlibs @@ -14,3 +14,5 @@ libcom_err.so.2 libgssapi_krb5.so.2 libz.so.1 libreadline.so.6 +librt.so.1 +libuuid.so.1 diff --git a/srcpkgs/samba/smbclient.template b/srcpkgs/samba/smbclient.template index 9abb782593..461e5d9802 100644 --- a/srcpkgs/samba/smbclient.template +++ b/srcpkgs/samba/smbclient.template @@ -6,12 +6,7 @@ long_desc=" Windows and Samba servers, including smbclient, smbtar, and smbspool. Utilities for mounting shares locally are found in the package cifs-utils." - -revision=2 - -do_install() -{ - install -d ${DESTDIR}/usr/share/man - mv ${SRCPKGDESTDIR}/usr/bin ${DESTDIR}/usr - mv ${SRCPKGDESTDIR}/usr/share/man/man1 ${DESTDIR}/usr/share/man +do_install() { + vmove usr/bin usr + vmove usr/share/man/man1 usr/share/man } diff --git a/srcpkgs/samba/template b/srcpkgs/samba/template index cf30944355..77dce2e1f4 100644 --- a/srcpkgs/samba/template +++ b/srcpkgs/samba/template @@ -1,18 +1,20 @@ # Template file for 'samba' pkgname=samba -version=3.5.6 -revision=2 +version=3.6.2 build_wrksrc=source3 distfiles="http://us1.samba.org/samba/ftp/stable/$pkgname-$version.tar.gz" build_style=gnu-configure -configure_args="--with-fhs --with-pthreads ---with-configdir=/etc/samba --with-lockdir=/var/lock/samba ---with-piddir=/var/run/samba --with-pammodulesdir=/lib/security ---with-syslog --enable-external-libtalloc --with-cifsumount ---enable-external-libtdb --disable-fam" +configure_args="--with-fhs --with-pam --with-pam_smbpass --with-ldap +--with-configdir=/etc/samba --with-lockdir=/var/samba +--with-cachedir=/var/samba --with-nmbdsocketdir=/run/samba/socket +--with-statedir=/var/samba --with-piddir=/run/samba --with-dnsupdate +--with-pammodulesdir=/lib/security --with-automount --disable-swat +--with-syslog --enable-external-libtalloc --with-quotas --disable-cups +--enable-external-libtdb --disable-fam --with-ads --with-acl-support +--with-shared-modules=idmap_ad,idmap_adex,idmap_rid,idmap_hash,idmap_tdb2" short_desc="SMB/CIFS file, print, and login server for Unix" maintainer="Juan RP " -checksum=466410868375d19a286ac3fc5d9f3c267ce359189f8e0d76e72ec10bd54247da +checksum=f6ce5f39b23540b82a00b1fcf6735bcef65cc1cf3639679c9e2e0cb850a3014f long_desc=" Samba is an implementation of the SMB/CIFS protocol for Unix systems, providing support for cross-platform file and printer sharing with Microsoft @@ -20,34 +22,74 @@ long_desc=" NT4-style domain controller, and can integrate with both NT4 domains and Active Directory realms as a member server." -# XXX: Prepare rc service, conf files, etc. -subpackages="cifs-utils smbclient libsmbclient samba-devel" +# Require a newer libsmclient. +shlib_depends="libsmbclient>=${version}" +subpackages="smbclient libsmbclient samba-devel" + +# Don't restart services automatically. +systemd_services=" +nmbd.service off +smbd.service off +winbindd.service off" + +conf_files="/etc/samba/smb.conf /etc/pam.d/samba" -Add_dependency run readline Add_dependency run smbclient +Add_dependency build perl +Add_dependency build python-devel Add_dependency build gettext Add_dependency build libcap-devel Add_dependency build popt-devel -Add_dependency build mit-krb5-devel Add_dependency build e2fsprogs-devel +Add_dependency build mit-krb5-devel Add_dependency build libldap-devel Add_dependency build zlib-devel Add_dependency build pam-devel Add_dependency build acl-devel -Add_dependency build attr-devel Add_dependency build avahi-libs-devel Add_dependency build readline-devel Add_dependency build tdb-devel Add_dependency build talloc-devel -post_install() -{ - # Remove tdb manpages! - rm -f ${DESTDIR}/usr/share/man/man8/tdb* +post_install() { + # conf file + cat examples/smb.conf.default | \ + sed 's|log file = .*$|log file = /var/log/samba/%m.log|g' > \ + ${DESTDIR}/etc/samba/smb.conf - # Remove swat (outdated, unsecure). - rm -f ${DESTDIR}/usr/sbin/swat - rm -f ${DESTDIR}/usr/share/man/man8/swat - rm -rf ${DESTDIR}/usr/share/samba/swat + # fix logrotate + sed -i -e 's|log.%m|%m.log|g' ${DESTDIR}/etc/samba/smb.conf + + # fix spool directory + sed -i 's|/usr/spool/samba|/var/spool/samba|g' \ + ${DESTDIR}/etc/samba/smb.conf + + # nsswitch libraries + vinstall nsswitch/libnss_wins.so 755 lib + ln -s libnss_wins.so ${DESTDIR}/lib/libnss_wins.so.2 + + vinstall nsswitch/libnss_winbind.so 755 lib + ln -s libnss_winbind.so ${DESTDIR}/lib/libnss_winbind.so.2 + + # winbind krb5 locator + vinstall source3/bin/winbind_krb5_locator.so 755 \ + usr/lib/krb5/plugins/libkrb5 + + # Remove unused manpages + rm -f ${DESTDIR}/usr/share/man/man8/tdb* + rm -f ${DESTDIR}/usr/share/man/man8/swat* + + # systemd units + for f in nmbd smbd winbindd; do + vinstall ${FILESDIR}/${f}.service 644 lib/systemd/system + done + # systemd tmpfiles + vinstall ${FILESDIR}/samba.tmpfiles 644 usr/lib/tmpfiles.d samba.conf + + # PAM support + vinstall ${FILESDIR}/samba.pam 644 etc/pam.d samba + + # logrotate file + vinstall ${FILESDIR}/samba.logrotate 644 etc/logrotate.d samba }