diff --git a/aur/samba4/PKGBUILD b/aur/samba4/PKGBUILD deleted file mode 100644 index 843bf18c5..000000000 --- a/aur/samba4/PKGBUILD +++ /dev/null @@ -1,200 +0,0 @@ -# Maintainer: Michael Hansen -# Contributor: Marco A Rojas -# Contributor: Netanel Shine -# Contributor: ngoonee -# Contributor: Adam Russell -# Contributor: Dhananjay Sathe -# -# Alarm: moonman - - -pkgname=('libwbclient4' 'smbclient4' 'samba4') - -pkgbase='samba4' -pkgver=4.0.5 -# We use the 'A' to fake out pacman's version comparators. Samba chooses -# to append 'a','b',etc to their subsequent releases, which pamcan -# misconstrues as alpha, beta, etc. Bad samba! -_realver=$pkgver -pkgrel=1 -arch=('arm') -url="http://www.samba.org" -license=('GPL3') -makedepends=('python2' 'docbook-xsl' 'pkg-config' 'tdb' 'talloc' 'gnutls' - 'openldap' 'libbsd' 'libcups' 'ldb>=1.1.15' 'tevent' 'readline' - 'dnsutils') -options=(!makeflags) -source=(http://ftp.samba.org/pub/samba/stable/samba-${_realver}.tar.gz) -md5sums=('58ec2fec08872b72f8fd526f2da20a9e') - -build() { - # Use samba-pkg as a staging directory for the split packages - # (This is so RPATHS and symlinks are generated correctly via - # make install, but the otherwise unsplit pieces can be split) - #_pkgsrc=${srcdir}/samba-pkg - - rm -rf ${srcdir}/samba-pkg - cd ${srcdir}/samba-${_realver} - - # change to use python2 - SAVEIFS=${IFS} - IFS=$(echo -en "\n\b") - PYTHON_CALLERS="$(find ${srcdir}/samba-${_realver} -name '*.py') -$(find ${srcdir}/samba-${_realver} -name 'wscript*') -$(find ${srcdir}/samba-${_realver} -name 'configure.ac') -$(find ${srcdir}/samba-${_realver} -name 'upgrade_from_s3') -$(find ${srcdir}/samba-${_realver}/buildtools -type f) -$(find ${srcdir}/samba-${_realver}/source4/scripting -type f)" - sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \ - -e "s|python-config|python2-config|" \ - -e "s|bin/python|bin/python2|" \ - ${PYTHON_CALLERS} - IFS=${SAVEIFS} - - export PYTHON=/usr/bin/python2 - - cd ${srcdir}/samba-${_realver} - ./configure --enable-fhs \ - --prefix=/usr \ - --libdir=/usr/lib \ - --localstatedir=/var \ - --with-configdir=/etc/samba \ - --with-lockdir=/var/cache/samba \ - --with-sockets-dir=/var/run/samba \ - --with-piddir=/var/run \ - --with-ads \ - --with-ldap \ - --with-swat \ - --with-winbind \ - --with-acl-support \ - --enable-gnutls \ - --disable-rpath-install - - # Add this to the options once it's working... - #--with-system-mitkrb5 /opt/heimdal - make || return 1 - make DESTDIR="${srcdir}/samba-pkg/" install || return 1 - - # This gets skipped somehow - if [ ! -e ${srcdir}/samba-pkg/usr/bin/smbtar ]; then - install -m755 ${srcdir}/samba-${_realver}/source3/script/smbtar ${srcdir}/samba-pkg/usr/bin/ - fi -} - -package_libwbclient4() { -pkgdesc="Samba winbind client library" -depends=('glibc' 'libbsd') -conflicts=('libwbclient') -provides=("libwbclient=${pkgver}") - - install -d -m755 ${pkgdir}/usr/lib - mv ${srcdir}/samba-pkg/usr/lib/libwbclient*.so* ${pkgdir}/usr/lib/ - - install -d -m755 ${pkgdir}/usr/lib/samba - mv ${srcdir}/samba-pkg/usr/lib/samba/libwinbind-client*.so* ${pkgdir}/usr/lib/samba/ - mv ${srcdir}/samba-pkg/usr/lib/samba/libreplace.so* ${pkgdir}/usr/lib/samba/ - - install -d -m755 ${pkgdir}/usr/lib/pkgconfig - mv ${srcdir}/samba-pkg/usr/lib/pkgconfig/wbclient.pc ${pkgdir}/usr/lib/pkgconfig/ - - install -d -m755 ${pkgdir}/usr/include/samba-4.0 - mv ${srcdir}/samba-pkg/usr/include/samba-4.0/wbclient.h ${pkgdir}/usr/include/samba-4.0/ -} - - -package_smbclient4() { -pkgdesc="Tools to access a server's filespace and printers via SMB" -depends=('popt' 'cifs-utils4' 'tdb' 'libwbclient4>=4.0.2-1' 'ldb>=1.1.15' - 'tevent' 'talloc' 'readline' 'gnutls' 'openldap' 'libcups' 'dnsutils') -conflicts=('smbclient') -provides=("smbclient=${pkgver}") - _smbclient_bins=('smbclient' 'smbclient4' 'rpcclient' 'smbspool' - 'smbtree' 'smbcacls' 'smbcquotas' 'smbget' 'net' - 'nmblookup' 'nmblookup4' 'smbtar') - - install -d -m755 ${pkgdir}/usr/bin - for bin in ${_smbclient_bins[@]}; do - mv ${srcdir}/samba-pkg/usr/bin/${bin} ${pkgdir}/usr/bin/ - done - - # smbclient binaries link to the majority of the samba - # libs, so this is a shortcut instead of resolving the - # whole dependency tree by hand - install -d -m755 ${pkgdir}/usr/lib - for lib in ${srcdir}/samba-pkg/usr/lib/lib*.so*; do - mv ${lib} ${pkgdir}/usr/lib/ - done - - install -d -m755 ${pkgdir}/usr/lib/samba - for lib in ${srcdir}/samba-pkg/usr/lib/samba/lib*.so*; do - mv ${lib} ${pkgdir}/usr/lib/samba/ - done - - install -d -m755 ${pkgdir}/usr/lib/pkgconfig - mv ${srcdir}/samba-pkg/usr/lib/pkgconfig/smbclient.pc ${pkgdir}/usr/lib/pkgconfig/ - mv ${srcdir}/samba-pkg/usr/lib/pkgconfig/smbclient-raw.pc ${pkgdir}/usr/lib/pkgconfig/ - mv ${srcdir}/samba-pkg/usr/lib/pkgconfig/netapi.pc ${pkgdir}/usr/lib/pkgconfig/ - - install -d -m755 ${pkgdir}/usr/share/man/man1 - install -d -m755 ${pkgdir}/usr/share/man/man7 - install -d -m755 ${pkgdir}/usr/share/man/man8 - for bin in ${_smbclient_bins[@]}; do - if [ -e ${srcdir}/samba-pkg/usr/share/man/man1/${bin}.1 ]; then - mv ${srcdir}/samba-pkg/usr/share/man/man1/${bin}.1 ${pkgdir}/usr/share/man/man1/ - fi - if [ -e ${srcdir}/samba-pkg/usr/share/man/man8/${bin}.8 ]; then - mv ${srcdir}/samba-pkg/usr/share/man/man8/${bin}.8 ${pkgdir}/usr/share/man/man8/ - fi - done - mv ${srcdir}/samba-pkg/usr/share/man/man7/libsmbclient.7 ${pkgdir}/usr/share/man/man7/ - - install -d -m755 ${pkgdir}/usr/include/samba-4.0 - mv ${srcdir}/samba-pkg/usr/include/samba-4.0/libsmbclient.h ${pkgdir}/usr/include/samba-4.0/ - mv ${srcdir}/samba-pkg/usr/include/samba-4.0/netapi.h ${pkgdir}/usr/include/samba-4.0/ - - mkdir -p ${pkgdir}/usr/lib/cups/backend - ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb -} - -package_samba4() { -pkgdesc="SMB Fileserver and AD Domain server" -depends=('db>=4.7' 'popt' 'libcups' 'libcap>=2.16' 'gamin' 'gnutls>=2.4.1' - 'talloc' 'tdb' 'libgcrypt' 'python2' 'smbclient4>=4.0.2-1') -replaces=('sambabase4') -conflicts=('samba') -provides=("samba=${pkgver}") -backup=('etc/samba/smb.conf') - - # Everything that libwbclient and smbclient didn't install goes - # into the samba package... - mv ${srcdir}/samba-pkg/* ${pkgdir}/ - rmdir ${srcdir}/samba-pkg - - _pyver=`python2 -c 'import sys; print(sys.version[:3])'` - - find ${pkgdir}/usr/lib/python${_pyver}/site-packages/ -name '*.py' | \ - xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" - find ${pkgdir}/usr/bin ${pkgdir}/usr/sbin -type f -executable | \ - xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" - - # Make admin scripts look in the right place for the samba python module - for script in sbin/samba_dnsupdate sbin/samba_kcc sbin/samba_spnupdate \ - sbin/samba_upgradedns bin/samba-tool - do - sed -i "/^sys\.path\.insert/ a\ -sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \ - ${pkgdir}/usr/${script} - done - - install -d -m755 ${pkgdir}/usr/lib/systemd/system - for sd in samba smb nmb winbind; do - install -m644 ${srcdir}/samba-${_realver}/packaging/systemd/${sd}.service ${pkgdir}/usr/lib/systemd/system/${sd}.service - done - - install -d -m755 ${pkgdir}/etc/samba - install -m644 ${srcdir}/samba-${_realver}/packaging/LSB/smb.conf ${pkgdir}/etc/samba/smb.conf - - install -d -m755 ${pkgdir}/usr/lib/tmpfiles.d - echo "d /var/run/samba 0700 root root" > ${pkgdir}/usr/lib/tmpfiles.d/samba.conf -} - diff --git a/extra/samba/PKGBUILD b/extra/samba/PKGBUILD new file mode 100644 index 000000000..f43d86af1 --- /dev/null +++ b/extra/samba/PKGBUILD @@ -0,0 +1,257 @@ + +# Maintainer: Tobias Powalowski +# Contributor: judd +# Contributor: Michael Hansen +# Contributor: Marco A Rojas +# Contributor: Netanel Shine +# Contributor: ngoonee +# Contributor: Adam Russell +# Contributor: Dhananjay Sathe + +# ALARM: Kevin Mihelich +# - pkgrel bump to 1.1 for aur migration, remove when bumped upstream + +pkgbase=samba +pkgname=('libwbclient' 'smbclient' 'samba') +pkgver=4.0.5 +# We use the 'A' to fake out pacman's version comparators. Samba chooses +# to append 'a','b',etc to their subsequent releases, which pamcan +# misconstrues as alpha, beta, etc. Bad samba! +_realver=4.0.5 +pkgrel=1.1 +arch=(i686 x86_64) +url="http://www.samba.org" +license=('GPL3') +makedepends=('python2' 'docbook-xsl' 'pkg-config' 'libbsd' 'db' 'popt' 'libcups' + 'readline' 'tevent' 'acl' 'libldap' 'libcap' 'ldb>=1.1.15' 'krb5' 'pam' + 'gamin' 'gnutls>=2.4.1' 'talloc' 'tdb') +source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${_realver}.tar.gz + samba.logrotate + swat.xinetd + samba.pam + smbd.service + smbd.socket + nmbd.service + smbd@.service + swat.socket + swat@.service + winbindd.service + samba.conf) +### UNINSTALL dmapi package before building!!! + +build() { + # Use samba-pkg as a staging directory for the split packages + # (This is so RPATHS and symlinks are generated correctly via + # make install, but the otherwise unsplit pieces can be split) + _pkgsrc=${srcdir}/samba-pkg + rm -rf ${_pkgsrc} + cd ${srcdir}/samba-${_realver} + # change to use python2 + SAVEIFS=${IFS} + IFS=$(echo -en "\n\b") + PYTHON_CALLERS="$(find ${srcdir}/samba-${_realver} -name '*.py') +$(find ${srcdir}/samba-${_realver} -name 'wscript*') +$(find ${srcdir}/samba-${_realver} -name 'configure.ac') +$(find ${srcdir}/samba-${_realver} -name 'upgrade_from_s3') +$(find ${srcdir}/samba-${_realver}/buildtools -type f) +$(find ${srcdir}/samba-${_realver}/source4/scripting -type f)" + sed -i -e "s|/usr/bin/env python$|/usr/bin/env python2|" \ + -e "s|python-config|python2-config|" \ + -e "s|bin/python|bin/python2|" \ + ${PYTHON_CALLERS} + IFS=${SAVEIFS} + + export PYTHON=/usr/bin/python2 +_samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2 +_samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4 +_samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4 + cd ${srcdir}/samba-${_realver} + ./configure --enable-fhs \ + --prefix=/usr \ + --libdir=/usr/lib \ + --localstatedir=/var \ + --with-configdir=/etc/samba \ + --with-lockdir=/var/cache/samba \ + --with-sockets-dir=/var/run/samba \ + --with-piddir=/var/run \ + --with-ads \ + --with-ldap \ + --with-swat \ + --with-winbind \ + --with-acl-support \ + --enable-gnutls \ + --with-pam \ + --with-pammodulesdir=/usr/lib/security \ + --with-shared-modules=${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules} \ + --disable-rpath-install + + # Add this to the options once it's working... + #--with-system-mitkrb5 /opt/heimdal + make + make DESTDIR="${_pkgsrc}/" install + + # This gets skipped somehow + if [ ! -e ${_pkgsrc}/usr/bin/smbtar ]; then + install -m755 ${srcdir}/samba-${_realver}/source3/script/smbtar ${_pkgsrc}/usr/bin/ + fi +} + +package_libwbclient() { +pkgdesc="Samba winbind client library" +depends=('glibc' 'libbsd') + # Use samba-pkg as a staging directory for the split packages + # (This is so RPATHS and symlinks are generated correctly via + # make install, but the otherwise unsplit pieces can be split) + _pkgsrc=${srcdir}/samba-pkg + install -d -m755 ${pkgdir}/usr/lib + mv ${_pkgsrc}/usr/lib/libwbclient*.so* ${pkgdir}/usr/lib/ + + install -d -m755 ${pkgdir}/usr/lib/samba + mv ${_pkgsrc}/usr/lib/samba/libwinbind-client*.so* ${pkgdir}/usr/lib/samba/ + mv ${_pkgsrc}/usr/lib/samba/libreplace.so* ${pkgdir}/usr/lib/samba/ + + install -d -m755 ${pkgdir}/usr/lib/pkgconfig + mv ${_pkgsrc}/usr/lib/pkgconfig/wbclient.pc ${pkgdir}/usr/lib/pkgconfig/ + + install -d -m755 ${pkgdir}/usr/include/samba-4.0 + mv ${_pkgsrc}/usr/include/samba-4.0/wbclient.h ${pkgdir}/usr/include/samba-4.0/ +} + +package_smbclient() { +pkgdesc="Tools to access a server's filespace and printers via SMB" +depends=('popt' 'cifs-utils' 'tdb' "libwbclient>=$pkgver" 'ldb' + 'tevent' 'libgcrypt' 'python2' 'talloc' 'readline' 'gnutls' + 'libbsd' 'libldap' 'libcups') + + _smbclient_bins=('smbclient' 'smbclient4' 'rpcclient' 'smbspool' + 'smbtree' 'smbcacls' 'smbcquotas' 'smbget' 'net' + 'nmblookup' 'nmblookup4' 'smbtar') + # Use samba-pkg as a staging directory for the split packages + # (This is so RPATHS and symlinks are generated correctly via + # make install, but the otherwise unsplit pieces can be split) + _pkgsrc=${srcdir}/samba-pkg + install -d -m755 ${pkgdir}/usr/bin + for bin in ${_smbclient_bins[@]}; do + mv ${_pkgsrc}/usr/bin/${bin} ${pkgdir}/usr/bin/ + done + + # smbclient binaries link to the majority of the samba + # libs, so this is a shortcut instead of resolving the + # whole dependency tree by hand + install -d -m755 ${pkgdir}/usr/lib + for lib in ${_pkgsrc}/usr/lib/lib*.so*; do + mv ${lib} ${pkgdir}/usr/lib/ + done + + install -d -m755 ${pkgdir}/usr/lib/samba + for lib in ${_pkgsrc}/usr/lib/samba/lib*.so*; do + mv ${lib} ${pkgdir}/usr/lib/samba/ + done + + install -d -m755 ${pkgdir}/usr/lib/pkgconfig + mv ${_pkgsrc}/usr/lib/pkgconfig/smbclient.pc ${pkgdir}/usr/lib/pkgconfig/ + mv ${_pkgsrc}/usr/lib/pkgconfig/smbclient-raw.pc ${pkgdir}/usr/lib/pkgconfig/ + mv ${_pkgsrc}/usr/lib/pkgconfig/netapi.pc ${pkgdir}/usr/lib/pkgconfig/ + + install -d -m755 ${pkgdir}/usr/share/man/man1 + install -d -m755 ${pkgdir}/usr/share/man/man7 + install -d -m755 ${pkgdir}/usr/share/man/man8 + for bin in ${_smbclient_bins[@]}; do + if [ -e ${_pkgsrc}/usr/share/man/man1/${bin}.1 ]; then + mv ${_pkgsrc}/usr/share/man/man1/${bin}.1 ${pkgdir}/usr/share/man/man1/ + fi + if [ -e ${_pkgsrc}/usr/share/man/man8/${bin}.8 ]; then + mv ${_pkgsrc}/usr/share/man/man8/${bin}.8 ${pkgdir}/usr/share/man/man8/ + fi + done + mv ${_pkgsrc}/usr/share/man/man7/libsmbclient.7 ${pkgdir}/usr/share/man/man7/ + + install -d -m755 ${pkgdir}/usr/include/samba-4.0 + mv ${_pkgsrc}/usr/include/samba-4.0/libsmbclient.h ${pkgdir}/usr/include/samba-4.0/ + mv ${_pkgsrc}/usr/include/samba-4.0/netapi.h ${pkgdir}/usr/include/samba-4.0/ + + mkdir -p ${pkgdir}/usr/lib/cups/backend + ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb +} + +package_samba() { +pkgdesc="SMB Fileserver and AD Domain server" +depends=('db>=4.7' 'popt' 'libcups' 'libcap>=2.16' 'gamin' 'gnutls>=2.4.1' + 'talloc' 'ldb' 'libbsd' 'python2' 'tdb' "smbclient>=$pkgver") +backup=(etc/logrotate.d/samba + etc/pam.d/samba + etc/samba/smb.conf + etc/xinetd.d/swat + etc/conf.d/samba) +install=samba.install + # Use samba-pkg as a staging directory for the split packages + # (This is so RPATHS and symlinks are generated correctly via + # make install, but the otherwise unsplit pieces can be split) + _pkgsrc=${srcdir}/samba-pkg + # Everything that libwbclient and smbclient didn't install goes + # into the samba package... + mv ${_pkgsrc}/* ${pkgdir}/ + rmdir ${_pkgsrc} + + _pyver=`python2 -c 'import sys; print(sys.version[:3])'` + + find ${pkgdir}/usr/lib/python${_pyver}/site-packages/ -name '*.py' | \ + xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" + find ${pkgdir}/usr/bin ${pkgdir}/usr/sbin -type f -executable | \ + xargs sed -i "s|#!/usr/bin/env python$|#!/usr/bin/env python2|" + + # Make admin scripts look in the right place for the samba python module + for script in sbin/samba_dnsupdate sbin/samba_kcc sbin/samba_spnupdate \ + sbin/samba_upgradedns bin/samba-tool + do + sed -i "/^sys\.path\.insert/ a\ +sys.path.insert(0, '/usr/lib/python${_pyver}/site-packages')" \ + ${pkgdir}/usr/${script} + done + + # install systemd files + install -d -m755 ${pkgdir}/usr/lib/systemd/system + for i in smbd nmbd swat winbindd; do + install -m644 ${srcdir}/*.service ${pkgdir}/usr/lib/systemd/system/ + install -m644 ${srcdir}/*.socket ${pkgdir}/usr/lib/systemd/system/ + done + # create ephemeral dirs via tmpfiles rather than shipping them in package + install -D -m644 ${srcdir}/samba.conf ${pkgdir}/usr/lib/tmpfiles.d/samba.conf + # install sample smb.conf + install -d -m755 ${pkgdir}/etc/samba + install -m644 ${srcdir}/samba-${_realver}/packaging/LSB/smb.conf ${pkgdir}/etc/samba/smb.conf.default + + mkdir -p ${pkgdir}/etc/samba/private + chmod 700 ${pkgdir}/etc/samba/private + + install -D -m644 ${srcdir}/samba.logrotate ${pkgdir}/etc/logrotate.d/samba + install -D -m644 ${srcdir}/swat.xinetd ${pkgdir}/etc/xinetd.d/swat + install -D -m644 ${srcdir}/samba.pam ${pkgdir}/etc/pam.d/samba + + # winbind krb5 locator + mkdir -p ${pkgdir}/usr/lib/krb5/plugins/libkrb5 + mv ${pkgdir}/usr/lib/*.so ${pkgdir}/usr/lib/krb5/plugins/libkrb5/ + + # fix logrotate + sed -i -e 's|log.%m|%m.log|g' ${pkgdir}/etc/samba/smb.conf.default + + # spool directory + install -d -m1777 ${pkgdir}/var/spool/samba + + rm -rf ${pkgdir}/var/run + + # copy ldap example + install -D -m644 ${srcdir}/samba-${_realver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema +} +md5sums=('58ec2fec08872b72f8fd526f2da20a9e' + '5697da77590ec092cc8a883bae06093c' + 'a4bbfa39fee95bba2e7ad6b535fae7e6' + '96f82c38f3f540b53f3e5144900acf17' + 'd0b18dd7f5fafc8d25cb3a7c37c6d920' + 'a78b9aa93eb14b0ac445897395693225' + '90845b89f2321cb19c0b13f385f1782a' + '70186fa43510bf99e3afd5951e814fbf' + '6db11f3dd2112a4b7a73007b189bef3f' + 'b0de262f9c62acd162e873658f33d063' + '64a52bc798033aeabfae3410bd559aa4' + '49abd7b719e3713a3f75a8a50958e381') diff --git a/extra/samba/nmbd.service b/extra/samba/nmbd.service new file mode 100644 index 000000000..4f86c4db9 --- /dev/null +++ b/extra/samba/nmbd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Samba NetBIOS name server +After=network.target + +[Service] +Type=forking +PIDFile=/var/run/nmbd.pid +ExecStart=/usr/sbin/nmbd -D +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/extra/samba/samba b/extra/samba/samba new file mode 100755 index 000000000..6098ee0cb --- /dev/null +++ b/extra/samba/samba @@ -0,0 +1,54 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +[ -f /etc/conf.d/samba ] && . /etc/conf.d/samba + +[ -z "$SAMBA_DAEMONS" ] && SAMBA_DAEMONS=(smbd nmbd) + +case "$1" in + start) + rc=0 + stat_busy "Starting Samba Server" + if [ ! -x /var/log/samba ] ; then + install -m755 -d /var/log/samba + fi + for d in ${SAMBA_DAEMONS[@]}; do + PID=`pidof -o %PPID /usr/sbin/$d` + [ -z "$PID" ] && /usr/sbin/$d -D + rc=$(($rc+$?)) + done + if [ $rc -gt 0 ]; then + stat_fail + else + add_daemon samba + stat_done + fi + ;; + stop) + rc=0 + stat_busy "Stopping Samba Server" + for d in ${SAMBA_DAEMONS[@]}; do + PID=`pidof -o %PPID /usr/sbin/$d` + [ -z "$PID" ] || kill $PID &> /dev/null + rc=$(($rc+$?)) + done + if [ $rc -gt 0 ]; then + stat_fail + else + rm /run/samba/smbd.pid &>/dev/null + rm /run/samba/nmbd.pid &>/dev/null + rm /run/samba/winbindd.pid &>/dev/null + rm_daemon samba + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/extra/samba/samba-4.0.3-fix_pidl_with_gcc48.patch b/extra/samba/samba-4.0.3-fix_pidl_with_gcc48.patch new file mode 100644 index 000000000..cb2378a78 --- /dev/null +++ b/extra/samba/samba-4.0.3-fix_pidl_with_gcc48.patch @@ -0,0 +1,60 @@ +From 1ac743a7d0d20e16fc325749d593edaaed89d706 Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Wed, 6 Feb 2013 10:17:57 +0200 +Subject: [PATCH] PIDL: fix parsing linemarkers in preprocessor output + +When PIDL calls out to C preprocessor to expand IDL files +and parse the output, it filters out linemarkers and line control +information as described in http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html +and http://gcc.gnu.org/onlinedocs/cpp/Line-Control.html#Line-Control + +With gcc 4.8 stdc-predef.h is included automatically and linemarker for the +file has extended flags that PIDL couldn't parse ('system header that needs to +be extern "C" protected for C++') + +Thanks to Jakub Jelinek for explanation of the linemarker format. + +Fixes https://bugzilla.redhat.com/show_bug.cgi?id=906517 + +Reviewed-by: Andreas Schneider +(cherry picked from commit 6ba7ab5c14801aecae96373d5a9db7ab82957526) + +Signed-off-by: Andreas Schneider +--- + pidl/idl.yp | 4 +++- + pidl/lib/Parse/Pidl/IDL.pm | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/pidl/idl.yp b/pidl/idl.yp +index b5c5185..c8a65f6 100644 +--- a/pidl/idl.yp ++++ b/pidl/idl.yp +@@ -610,7 +610,9 @@ again: + + for ($parser->YYData->{INPUT}) { + if (/^\#/) { +- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) { ++ # Linemarker format is described at ++ # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html ++ if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) { + $parser->YYData->{LINE} = $1-1; + $parser->YYData->{FILE} = $2; + goto again; +diff --git a/pidl/lib/Parse/Pidl/IDL.pm b/pidl/lib/Parse/Pidl/IDL.pm +index d4820ff..6927c89 100644 +--- a/pidl/lib/Parse/Pidl/IDL.pm ++++ b/pidl/lib/Parse/Pidl/IDL.pm +@@ -2576,7 +2576,9 @@ again: + + for ($parser->YYData->{INPUT}) { + if (/^\#/) { +- if (s/^\# (\d+) \"(.*?)\"( \d+|)//) { ++ # Linemarker format is described at ++ # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html ++ if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) { + $parser->YYData->{LINE} = $1-1; + $parser->YYData->{FILE} = $2; + goto again; +-- +1.8.1.1 + diff --git a/extra/samba/samba.conf b/extra/samba/samba.conf new file mode 100644 index 000000000..32e722845 --- /dev/null +++ b/extra/samba/samba.conf @@ -0,0 +1,2 @@ +D /run/samba 0755 - - - +d /var/log/samba 0755 - - - \ No newline at end of file diff --git a/extra/samba/samba.conf.d b/extra/samba/samba.conf.d new file mode 100644 index 000000000..8721f956a --- /dev/null +++ b/extra/samba/samba.conf.d @@ -0,0 +1,7 @@ +# +# Configuration for the samba init script +# + +# space separated list of daemons to launch +SAMBA_DAEMONS=(smbd nmbd) +#SAMBA_DAEMONS=(smbd nmbd winbindd) diff --git a/extra/samba/samba.install b/extra/samba/samba.install new file mode 100644 index 000000000..420643f0e --- /dev/null +++ b/extra/samba/samba.install @@ -0,0 +1,14 @@ +#!/bin/sh + +post_install() { + systemd-tmpfiles --create samba.conf +} + +post_upgrade() { + if [ "$(vercmp $2 4.0.4)" -lt 0 ]; then + echo "Major upgrade from samba 3.x to 4.x," + echo "please read the Samba4 migration guide:" + echo "http://wiki.samba.org/index.php/Samba4/samba3upgrade/HOWTO" + fi +} +# vim:set ts=2 sw=2 et: diff --git a/extra/samba/samba.logrotate b/extra/samba/samba.logrotate new file mode 100644 index 000000000..581f4c33b --- /dev/null +++ b/extra/samba/samba.logrotate @@ -0,0 +1,9 @@ +/var/log/samba/log.smbd /var/log/samba/log.nmbd /var/log/samba/*.log { + notifempty + missingok + sharedscripts + copytruncate + postrotate + /bin/kill -HUP `cat /var/run/samba/*.pid 2>/dev/null` 2>/dev/null || true + endscript +} diff --git a/extra/samba/samba.pam b/extra/samba/samba.pam new file mode 100644 index 000000000..53724d1f8 --- /dev/null +++ b/extra/samba/samba.pam @@ -0,0 +1,3 @@ +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so diff --git a/extra/samba/smbd.service b/extra/samba/smbd.service new file mode 100644 index 000000000..12c08474a --- /dev/null +++ b/extra/samba/smbd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Samba SMB/CIFS server +After=network.target nmbd.service winbindd.service + +[Service] +Type=forking +PIDFile=/var/run/smbd.pid +ExecStart=/usr/sbin/smbd -D +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/extra/samba/smbd.socket b/extra/samba/smbd.socket new file mode 100644 index 000000000..833bf4388 --- /dev/null +++ b/extra/samba/smbd.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Samba SMB/CIFS server socket + +[Socket] +ListenStream=445 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/extra/samba/smbd@.service b/extra/samba/smbd@.service new file mode 100644 index 000000000..e1f71be3f --- /dev/null +++ b/extra/samba/smbd@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Samba SMB/CIFS server instance + +[Service] +ExecStart=/usr/sbin/smbd -F +ExecReload=/bin/kill -HUP $MAINPID +StandardInput=socket diff --git a/extra/samba/swat.socket b/extra/samba/swat.socket new file mode 100644 index 000000000..e703413fc --- /dev/null +++ b/extra/samba/swat.socket @@ -0,0 +1,9 @@ +[Unit] +Description=SWAT Samba Web Admin Tool + +[Socket] +ListenStream=127.0.0.1:901 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/extra/samba/swat.xinetd b/extra/samba/swat.xinetd new file mode 100644 index 000000000..2e62a82b2 --- /dev/null +++ b/extra/samba/swat.xinetd @@ -0,0 +1,10 @@ +service swat +{ + socket_type = stream + wait = no + user = root + server = /usr/sbin/swat + log_on_success += HOST DURATION + log_on_failure += HOST + disable = yes +} diff --git a/extra/samba/swat@.service b/extra/samba/swat@.service new file mode 100644 index 000000000..a036b2c03 --- /dev/null +++ b/extra/samba/swat@.service @@ -0,0 +1,7 @@ +[Unit] +Description=SWAT Samba Web Admin Tool +After=local-fs.target + +[Service] +ExecStart=/usr/sbin/swat +StandardInput=socket diff --git a/extra/samba/winbindd.service b/extra/samba/winbindd.service new file mode 100644 index 000000000..02e3014b1 --- /dev/null +++ b/extra/samba/winbindd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Samba Winbind daemon +After=network.target nmbd.service + +[Service] +Type=forking +PIDFile=/var/run/winbindd.pid +ExecStart=/usr/sbin/winbindd -D +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target