summaryrefslogtreecommitdiff
path: root/extra/samba/PKGBUILD
blob: 0193aafa49d858efa439d847615372bf18796a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# $Id: PKGBUILD 165667 2012-08-28 12:51:24Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>
pkgbase=samba
pkgname=('libwbclient' 'smbclient' 'samba')
pkgver=3.6.7
# 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=3.6.7
pkgrel=2
arch=(i686 x86_64)
url="http://www.samba.org"
license=('GPL3')
makedepends=('db' 'popt' 'libcups' 'acl' 'libldap' 'libcap' 'krb5' 'pam' 'gamin' 'gnutls>=2.4.1' 'talloc' 'tdb')
source=(http://us1.samba.org/samba/ftp/stable/${pkgbase}-${_realver}.tar.gz
        samba samba.logrotate
        swat.xinetd
        samba.pam
        samba.conf.d
        smbd.service
        nmbd.service
        winbindd.service
        samba.conf)
### UNINSTALL dmapi package before building!!!

build() {
  cd ${srcdir}/${pkgbase}-${_realver}/source3
  ./configure --prefix=/usr \
              --libdir=/usr/lib/ \
              --localstatedir=/var \
              --with-configdir=/etc/samba \
              --with-lockdir=/var/cache/samba \
              --with-piddir=/var/run/samba \
              --with-fhs \
              --with-pam \
              --with-pam_smbpass \
              --with-pammodulesdir=/usr/lib/security \
              --with-dnsupdate \
              --with-automount \
              --with-quotas \
              --with-ads \
              --with-acl-support \
              --with-libsmbclient \
              --with-syslog \
              --enable-external-libtalloc \
              --disable-dnssd \
              --disable-avahi \
              --with-shared-modules=idmap_ad,idmap_adex,idmap_rid,idmap_hash,idmap_tdb2 \
              --enable-external-libtdb
  make
}

package_libwbclient () {
pkgdesc="Samba winbind client library"
depends=('glibc')
  cd ${srcdir}/${pkgbase}-${_realver}/source3
  mkdir -p ${pkgdir}/usr/lib  
  for i in libwbclient*; do
      cp  -a bin/${i}*.so* ${pkgdir}/usr/lib/
  done
}

package_smbclient () {
pkgdesc="Tools to access a server's filespace and printers via SMB"
depends=('readline' 'popt' 'libldap' 'cifs-utils' 'libcap' 'krb5' 'db' 'e2fsprogs' 'tdb' 'talloc' 'libwbclient')
  cd ${srcdir}/${pkgbase}-${_realver}/source3
  mkdir -p ${pkgdir}/usr/bin ${pkgdir}/usr/lib
  install -m755 bin/{smbclient,rpcclient,smbspool,smbtree,smbcacls,smbcquotas,smbget,net,nmblookup} ${pkgdir}/usr/bin/
  for i in libnetapi* libsmbclient*;do
      cp  -a bin/${i}*.so* ${pkgdir}/usr/lib/
  done
  install -m755 script/smbtar ${pkgdir}/usr/bin/
  mkdir -p ${pkgdir}/usr/lib/cups/backend
  ln -sf /usr/bin/smbspool ${pkgdir}/usr/lib/cups/backend/smb
  mkdir -p ${pkgdir}/usr/include
  install -m644 include/libsmbclient.h ${pkgdir}/usr/include/
  install -m644 lib/netapi/netapi.h ${pkgdir}/usr/include/
  mkdir -p ${pkgdir}/usr/share/man/man{1,7}
  for man in rpcclient smbcacls smbclient smbcquotas smbget \
      smbtree smbtar nmblookup; do
      install -m644 ../docs/manpages/${man}.1 ${pkgdir}/usr/share/man/man1/
  done
  install -m644 ../docs/manpages/libsmbclient.7 ${pkgdir}/usr/share/man/man7/
}

package_samba () {
pkgdesc="Tools to access a server's filespace and printers via SMB"
backup=(etc/logrotate.d/samba
        etc/pam.d/samba
        etc/samba/smb.conf
        etc/xinetd.d/swat
        etc/conf.d/samba)
depends=('db' 'popt' 'libcups' 'acl' 'libldap' "smbclient>=$pkgver" 'libcap' 'krb5' 'pam' 'gamin' 'gnutls' 'e2fsprogs' 'tdb' 'talloc')
install='samba.install'
  cd ${srcdir}/samba-${_realver}/source3
  mkdir -p ${pkgdir}/etc/samba/private
  chmod 700 ${pkgdir}/etc/samba/private
  make DESTDIR=${pkgdir} install
  chmod 644 ${pkgdir}/usr/include/*.h
  rm -rf ${pkgdir}/usr/var
  rm -rf ${pkgdir}/var/run/samba
  (cd script; cp installbin.sh i; cat i | sed 's/\/sbin\///' > installbin.sh)
  install -D -m755 ../../samba ${pkgdir}/etc/rc.d/samba
  install -D -m644 ../../samba.conf.d ${pkgdir}/etc/conf.d/samba
  mkdir -p ${pkgdir}/etc/samba
  cat ../examples/smb.conf.default | \
    sed 's|log file = .*$|log file = /var/log/samba/log.%m|g' >${pkgdir}/etc/samba/smb.conf.default
  install -D -m644 ../../samba.logrotate ${pkgdir}/etc/logrotate.d/samba
  install -D -m644 ../../swat.xinetd ${pkgdir}/etc/xinetd.d/swat
  install -D -m644 ../../samba.pam ${pkgdir}/etc/pam.d/samba
  # spool directory
  install -d -m1777 ${pkgdir}/var/spool/samba
  sed -i 's|/usr/spool/samba|/var/spool/samba|g' ${pkgdir}/etc/samba/smb.conf.default
  # fix logrotate
  sed -i -e 's|log.%m|%m.log|g' ${pkgdir}/etc/samba/smb.conf.default
  # nsswitch libraries
  install -D -m755 ${srcdir}/samba-${_realver}/nsswitch/libnss_wins.so ${pkgdir}/usr/lib/libnss_wins.so
  ln -s libnss_wins.so ${pkgdir}/usr/lib/libnss_wins.so.2
  install -D -m755 ${srcdir}/samba-${_realver}/nsswitch/libnss_winbind.so ${pkgdir}/usr/lib/libnss_winbind.so
  ln -s libnss_winbind.so ${pkgdir}/usr/lib/libnss_winbind.so.2
  # winbind krb5 locator
  mkdir -p ${pkgdir}/usr/lib/krb5/plugins/libkrb5
  install -d -m 0755 ${pkgdir}/usr/lib/krb5/plugins/libkrb5
  install -m 755 bin/winbind_krb5_locator.so ${pkgdir}/usr/lib/krb5/plugins/libkrb5/winbind_krb5_locator.so
  # remove conflict files of smbclient
  for man in libsmbclient smbspool \
      mount.cifs net cifs.upcall; do
      rm -f ${pkgdir}/usr/share/man/man8/${man}.8
  done
  for i in libnetapi* libwbclient* libsmbclient* winbind_krb5*;do
      rm -f ${pkgdir}/usr/lib/$i
  done
  for bin in net \
      nmblookup rpcclient smbcacls smbclient \
      smbcquotas smbget smbspool smbtar smbtree; do
      rm -f ${pkgdir}/usr/bin/$bin
  done
  rm -f ${pkgdir}/usr/sbin/cifs.upcall
  rm -f ${pkgdir}/usr/include/netapi.h
  for man in rpcclient smbcacls smbclient smbcquotas \
      smbtree smbtar nmblookup smbget; do
      rm -f ${pkgdir}/usr/share/man/man1/${man}.1
  done
  for man in tdbbackup tdbdump tdbtool; do
      rm -f ${pkgdir}/usr/share/man/man8/${man}.8
  done
  rm -f ${pkgdir}/usr/share/man/man7/libsmbclient.7
  rm -f ${pkgdir}/usr/include/libsmbclient.h
  # copy ldap example
  install -D -m644 ${srcdir}/samba-${_realver}/examples/LDAP/samba.schema ${pkgdir}/usr/share/doc/samba/examples/LDAP/samba.schema
  # install systemd files
  for i in smbd nmbd winbindd; do
  install -D -m644 ${srcdir}/$i.service ${pkgdir}/usr/lib/systemd/system/$i.service
  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
  rm -rf ${pkgdir}/var/run
}
md5sums=('b23be56c15dd52f64eb7ba54c0ea1ed5'
         'a45a4283723be2b0ae32439dc4496a09'
         '5697da77590ec092cc8a883bae06093c'
         'a4bbfa39fee95bba2e7ad6b535fae7e6'
         '96f82c38f3f540b53f3e5144900acf17'
         'f2f2e348acd1ccb566e95fa8a561b828'
         '4b9c54d6fed4d0a225a84963516fc46f'
         '67ce9229c4e343a91d70edba6de29437'
         '617079917cdc84b450d109557b1fe2e1'
         '8e7ed39b54968e427f9506e9107bfb45')