comparison net-fs/samba/samba-3.2.6.ebuild @ 88:7c953ae90177

samba 3.2.6 stable
author holger@hoho.dyndns.org
date Sat, 27 Dec 2008 15:17:11 +0100
parents
children 7f53c44576cc
comparison
equal deleted inserted replaced
87:e948db201a1e 88:7c953ae90177
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-fs/samba/samba-3.2.0_rc2.ebuild,v 1.1 2008/06/12 12:10:25 dev-zero Exp $
4
5 inherit eutils pam multilib versionator confutils
6
7 MY_P=${PN}-${PV/_/}
8
9 DESCRIPTION="A suite of SMB and CIFS client/server programs for UNIX"
10 HOMEPAGE="http://www.samba.org/"
11 SRC_URI="mirror://samba/${MY_P}.tar.gz"
12 LICENSE="GPL-3"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE_LINGUAS="linguas_ja linguas_pl"
16 IUSE="${IUSE_LINGUAS} acl ads async automount caps cups doc examples ipv6 kernel_linux ldap fam
17 pam quotas readline selinux swat syslog winbind"
18
19 RDEPEND="dev-libs/popt
20 dev-libs/iniparser
21 virtual/libiconv
22 acl? ( kernel_linux? ( sys-apps/acl ) )
23 cups? ( net-print/cups )
24 ipv6? ( sys-apps/xinetd )
25 ads? ( virtual/krb5 sys-fs/e2fsprogs )
26 ldap? ( net-nds/openldap )
27 pam? ( virtual/pam )
28 readline? ( sys-libs/readline )
29 selinux? ( sec-policy/selinux-samba )
30 swat? ( sys-apps/xinetd )
31 syslog? ( virtual/logger )
32 fam? ( virtual/fam )
33 caps? ( sys-libs/libcap )"
34 DEPEND="${RDEPEND}"
35
36 S="${WORKDIR}/${MY_P}"
37 CONFDIR="${FILESDIR}/config-3.2"
38 PRIVATE_DST=/var/lib/samba/private
39
40 # Tests are currently broken due to hardcoded paths (due to --with-fhs)
41 # The problem is that --without-fhs lets samba use lockdir (which can be changed in smb.conf)
42 # which is wrong as well.
43 RESTRICT="test"
44
45 pkg_setup() {
46 confutils_use_depend_all ads ldap
47
48 ewarn "This is a pre-release. That means it is _not_ stable and only for testing."
49 ewarn "Bugs in the ebuild can be reported in our bugtracker at https://bugs.gentoo.org"
50 ewarn "Bugs in Samba should be reported at https://bugzilla.samba.org _after_"
51 ewarn "carefully checking whether it is a Samba bug. If you can't find out whether"
52 ewarn "it's in the ebuild, your setup or Samba itself, you should definitely _not_ use"
53 ewarn "this package and wait until the final release."
54 ewarn
55 ewarn "There is no python-support anymore."
56 ebeep 5
57 }
58
59 src_unpack() {
60 unpack ${A}
61 cd "${S}/source"
62
63 # Ok, agreed, this is ugly. But it avoids a patch we
64 # need for every samba version and we don't need autotools
65 sed -i \
66 -e 's|"lib32" ||' \
67 -e 's|if test -d "$i/$l" ;|if test -d "$i/$l" -o -L "$i/$l";|' \
68 configure || die "sed failed"
69
70 rm "${S}/docs/manpages"/{mount,umount}.cifs.8
71
72 sed -i \
73 -e 's|tdbsam|tdbsam:${PRIVATEDIR}/passdb.tdb|' \
74 "${S}/source/script/tests/selftest.sh" || die "sed failed"
75 }
76
77 src_compile() {
78 cd "${S}/source"
79
80 local myconf
81 local mylangs
82 local mymod_shared
83
84 mylangs="--with-manpages-langs=en"
85 use linguas_ja && mylangs="${mylangs},ja"
86 use linguas_pl && mylangs="${mylangs},pl"
87
88 use winbind && mymod_shared="--with-shared-modules=idmap_rid"
89 if use ldap ; then
90 myconf="${myconf} $(use_with ads)"
91 use winbind && mymod_shared="${mymod_shared},idmap_ad"
92 fi
93
94 [[ ${CHOST} == *-*bsd* ]] && myconf="${myconf} --disable-pie"
95 use hppa && myconf="${myconf} --disable-pie"
96
97 use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no
98
99 # Otherwise we get the whole swat stuff installed
100 if ! use swat ; then
101 sed -i \
102 -e 's/^\(install:.*\)installswat \(.*\)/\1\2/' \
103 Makefile.in || die "sed failed"
104 fi
105
106 econf \
107 --with-fhs \
108 --sysconfdir=/etc/samba \
109 --localstatedir=/var \
110 --with-configdir=/etc/samba \
111 --with-libdir=/usr/$(get_libdir)/samba \
112 --with-pammodulesdir=$(getpam_mod_dir) \
113 --with-swatdir=/usr/share/doc/${PF}/swat \
114 --with-piddir=/var/run/samba \
115 --with-lockdir=/var/cache/samba \
116 --with-logfilebase=/var/log/samba \
117 --with-privatedir=${PRIVATE_DST} \
118 --with-libsmbclient \
119 --without-spinlocks \
120 --enable-socket-wrapper \
121 --enable-nss-wrapper \
122 --with-cifsmount=no \
123 $(use_with acl acl-support) \
124 $(use_with async aio-support) \
125 $(use_with automount) \
126 $(use_enable cups) \
127 $(use_enable fam) \
128 $(use_with ads krb5) \
129 $(use_with ads dnsupdate) \
130 $(use_with ldap) \
131 $(use_with pam) $(use_with pam pam_smbpass) \
132 $(use_with quotas) $(use_with quotas sys-quotas) \
133 $(use_with readline) \
134 $(use_with syslog) \
135 $(use_with winbind) \
136 ${myconf} ${mylangs} ${mymod_shared} || die "econf failed"
137
138 emake proto || die "emake proto failed"
139 emake everything || die "emake everything failed"
140
141 }
142
143 src_test() {
144 cd "${S}/source"
145 emake test || die "tests failed"
146 }
147
148 src_install() {
149 cd "${S}/source"
150
151 emake DESTDIR="${D}" install-everything || die "emake install-everything failed"
152
153 # Extra rpctorture progs
154 local extra_bins="rpctorture"
155 for i in ${extra_bins} ; do
156 [[ -x "${S}/bin/${i}" ]] && dobin "${S}/bin/${i}"
157 done
158
159 # remove .old stuff from /usr/bin:
160 rm -f "${D}"/usr/bin/*.old
161
162 # Removing executable bits from header-files
163 fperms 644 /usr/include/libsmbclient.h
164
165 # Nsswitch extensions. Make link for wins and winbind resolvers
166 if use winbind ; then
167 dolib.so nsswitch/libnss_wins.so
168 dosym libnss_wins.so /usr/$(get_libdir)/libnss_wins.so.2
169 dolib.so nsswitch/libnss_winbind.so
170 dosym libnss_winbind.so /usr/$(get_libdir)/libnss_winbind.so.2
171 fi
172
173 # bug #46389: samba doesn't create symlink anymore
174 # beaviour seems to be changed in 3.0.6, see bug #61046
175 dosym samba/libsmbclient.so /usr/$(get_libdir)/libsmbclient.so.0
176 dosym samba/libsmbclient.so /usr/$(get_libdir)/libsmbclient.so
177
178 # make the smb backend symlink for cups printing support (bug #133133)
179 if use cups ; then
180 dodir $(cups-config --serverbin)/backend
181 dosym /usr/bin/smbspool $(cups-config --serverbin)/backend/smb
182 fi
183
184 cd "${S}/source"
185
186 # General config files
187 insinto /etc/samba
188 doins "${CONFDIR}"/{smbusers,lmhosts}
189 newins "${CONFDIR}/smb.conf.example-samba3" smb.conf.example
190
191 newpamd "${CONFDIR}/samba.pam" samba
192 use winbind && dopamd "${CONFDIR}/system-auth-winbind"
193 if use swat ; then
194 insinto /etc/xinetd.d
195 newins "${CONFDIR}/swat.xinetd" swat
196 else
197 rm -f "${D}/usr/sbin/swat"
198 rm -f "${D}/usr/share/man/man8/swat.8"
199 fi
200
201 newinitd "${FILESDIR}/samba-init" samba
202 newconfd "${FILESDIR}/samba-conf" samba
203
204 if use ldap ; then
205 insinto /etc/openldap/schema
206 doins "${S}/examples/LDAP/samba.schema"
207 fi
208
209 if use ipv6 ; then
210 insinto /etc/xinetd.d
211 newins "${FILESDIR}/samba-xinetd" smb
212 fi
213
214 # dirs
215 diropts -m0700 ; keepdir "${PRIVATE_DST}"
216 diropts -m1777 ; keepdir /var/spool/samba
217
218 diropts -m0755
219 keepdir /var/{log,run,cache}/samba
220 keepdir /var/lib/samba/{netlogon,profiles}
221 keepdir /var/lib/samba/printers/{W32X86,WIN40,W32ALPHA,W32MIPS,W32PPC,X64,IA64,COLOR}
222 keepdir /usr/$(get_libdir)/samba/{rpc,idmap,auth}
223
224 # docs
225 dodoc "${FILESDIR}/README.gentoo"
226 dodoc "${S}"/{MAINTAINERS,README,Roadmap,WHATSNEW.txt}
227 dodoc "${CONFDIR}/nsswitch.conf-wins"
228 use winbind && dodoc "${CONFDIR}/nsswitch.conf-winbind"
229
230 if use examples ; then
231 insinto /usr/share/doc/${PF}
232 doins -r "${S}/examples/"
233 find "${D}/usr/share/doc/${PF}" -type d -print0 | xargs -0 chmod 755
234 find "${D}/usr/share/doc/${PF}/examples" ! -type d -print0 | xargs -0 chmod 644
235 fi
236
237 if ! use doc ; then
238 if ! use swat ; then
239 rm -rf "${D}/usr/share/doc/${PF}/swat"
240 else
241 rm -rf "${D}/usr/share/doc/${PF}/swat/help"/{guide,howto,devel}
242 rm -rf "${D}/usr/share/doc/${PF}/swat/using_samba"
243 fi
244 fi
245
246 }
247
248 pkg_preinst() {
249 local PRIVATE_SRC=/etc/samba/private
250 if [[ ! -r "${ROOT}/${PRIVATE_DST}/secrets.tdb" \
251 && -r "${ROOT}/${PRIVATE_SRC}/secrets.tdb" ]] ; then
252 ebegin "Copying ${ROOT}/${PRIVATE_SRC}/* to ${ROOT}/${PRIVATE_DST}/"
253 mkdir -p "${D}/${PRIVATE_DST}"
254 cp -pPRf "${ROOT}/${PRIVATE_SRC}"/* "${D}/${PRIVATE_DST}/"
255 eend $?
256 fi
257
258 if [[ ! -f "${ROOT}/etc/samba/smb.conf" ]] ; then
259 touch "${D}/etc/samba/smb.conf"
260 fi
261 }
262
263 pkg_postinst() {
264 if use swat ; then
265 einfo "swat must be enabled by xinetd:"
266 einfo " change the /etc/xinetd.d/swat configuration"
267 fi
268
269 if use ipv6 ; then
270 einfo "ipv6 support must be enabled by xinetd:"
271 einfo " change the /etc/xinetd.d/smb configuration"
272 fi
273
274 elog "It is possible to start/stop daemons separately:"
275 elog " Create a symlink from /etc/init.d/samba.{smbd,nmbd,winbind} to"
276 elog " /etc/init.d/samba. Calling /etc/init.d/samba directly will start"
277 elog " the daemons configured in /etc/conf.d/samba"
278
279 elog "The mount/umount.cifs helper applications are not included anymore."
280 elog "Please install net-fs/mount-cifs instead."
281
282 ewarn "If you're upgrading from 3.0.24 or earlier, please make sure to"
283 ewarn "restart your clients to clear any cached information about the server."
284 ewarn "Otherwise they might not be able to connect to the volumes."
285 }