comparison net-fs/samba/samba-3.3.6.ebuild @ 140:ae18a6f7faee

pull latest chagnes from Holgi
author Dirk Olmes <dirk.olmes@googlemail.com>
date Thu, 02 Jul 2009 14:12:03 +0200
parents cf4f92864e7c
children
comparison
equal deleted inserted replaced
112:4a719c618dfb 140:ae18a6f7faee
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.3"
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
49 src_unpack() {
50 unpack ${A}
51 cd "${S}/source"
52
53 # Ok, agreed, this is ugly. But it avoids a patch we
54 # need for every samba version and we don't need autotools
55 sed -i \
56 -e 's|"lib32" ||' \
57 -e 's|if test -d "$i/$l" ;|if test -d "$i/$l" -o -L "$i/$l";|' \
58 configure || die "sed failed"
59
60 rm "${S}/docs/manpages"/{mount,umount}.cifs.8
61
62 sed -i \
63 -e 's|tdbsam|tdbsam:${PRIVATEDIR}/passdb.tdb|' \
64 "${S}/source/script/tests/selftest.sh" || die "sed failed"
65 }
66
67 src_compile() {
68 cd "${S}/source"
69
70 local myconf
71 local mylangs
72 local mymod_shared
73
74 use winbind && mymod_shared="--with-shared-modules=idmap_rid"
75 if use ldap ; then
76 myconf="${myconf} $(use_with ads)"
77 use winbind && mymod_shared="${mymod_shared},idmap_ad"
78 fi
79
80 [[ ${CHOST} == *-*bsd* ]] && myconf="${myconf} --disable-pie"
81 use hppa && myconf="${myconf} --disable-pie"
82
83 use caps && export ac_cv_header_sys_capability_h=yes || export ac_cv_header_sys_capability_h=no
84
85 # Otherwise we get the whole swat stuff installed
86 if ! use swat ; then
87 sed -i \
88 -e 's/^\(install:.*\)installswat \(.*\)/\1\2/' \
89 Makefile.in || die "sed failed"
90 fi
91
92 econf \
93 --with-fhs \
94 --sysconfdir=/etc/samba \
95 --localstatedir=/var \
96 --with-configdir=/etc/samba \
97 --with-modulesdir=/usr/$(get_libdir)/samba \
98 --with-pammodulesdir=$(getpam_mod_dir) \
99 --with-swatdir=/usr/share/doc/${PF}/swat \
100 --with-piddir=/var/run/samba \
101 --with-lockdir=/var/cache/samba \
102 --with-logfilebase=/var/log/samba \
103 --with-privatedir=${PRIVATE_DST} \
104 --with-libsmbclient \
105 --enable-socket-wrapper \
106 --enable-nss-wrapper \
107 --with-cifsmount=no \
108 $(use_with acl acl-support) \
109 $(use_with async aio-support) \
110 $(use_with automount) \
111 $(use_enable cups) \
112 $(use_enable fam) \
113 $(use_with ads krb5) \
114 $(use_with ads dnsupdate) \
115 $(use_with ldap) \
116 $(use_with pam) $(use_with pam pam_smbpass) \
117 $(use_with quotas) $(use_with quotas sys-quotas) \
118 $(use_with readline) \
119 $(use_with syslog) \
120 $(use_with winbind) \
121 ${myconf} ${mylangs} ${mymod_shared} || die "econf failed"
122
123 emake proto || die "emake proto failed"
124 emake everything || die "emake everything failed"
125
126 }
127
128 src_test() {
129 cd "${S}/source"
130 emake test || die "tests failed"
131 }
132
133 src_install() {
134 cd "${S}/source"
135
136 emake DESTDIR="${D}" install-everything || die "emake install-everything failed"
137
138 # Extra rpctorture progs
139 local extra_bins="rpctorture"
140 for i in ${extra_bins} ; do
141 [[ -x "${S}/bin/${i}" ]] && dobin "${S}/bin/${i}"
142 done
143
144 # remove .old stuff from /usr/bin:
145 rm -f "${D}"/usr/bin/*.old
146
147 # Removing executable bits from header-files
148 fperms 644 /usr/include/libsmbclient.h
149
150 # Nsswitch extensions. Make link for wins and winbind resolvers
151 if use winbind ; then
152 dolib.so nsswitch/libnss_wins.so
153 dosym libnss_wins.so /usr/$(get_libdir)/libnss_wins.so.2
154 dolib.so nsswitch/libnss_winbind.so
155 dosym libnss_winbind.so /usr/$(get_libdir)/libnss_winbind.so.2
156 fi
157
158 # make the smb backend symlink for cups printing support (bug #133133)
159 if use cups ; then
160 dodir $(cups-config --serverbin)/backend
161 dosym /usr/bin/smbspool $(cups-config --serverbin)/backend/smb
162 fi
163
164 cd "${S}/source"
165
166 # General config files
167 insinto /etc/samba
168 doins "${CONFDIR}"/{smbusers,lmhosts}
169 newins "${CONFDIR}/smb.conf.example-samba3" smb.conf.example
170
171 newpamd "${CONFDIR}/samba.pam" samba
172 use winbind && dopamd "${CONFDIR}/system-auth-winbind"
173 if use swat ; then
174 insinto /etc/xinetd.d
175 newins "${CONFDIR}/swat.xinetd" swat
176 else
177 rm -f "${D}/usr/sbin/swat"
178 rm -f "${D}/usr/share/man/man8/swat.8"
179 fi
180
181 newinitd "${FILESDIR}/samba-init" samba
182 newconfd "${FILESDIR}/samba-conf" samba
183
184 if use ldap ; then
185 insinto /etc/openldap/schema
186 doins "${S}/examples/LDAP/samba.schema"
187 fi
188
189 if use ipv6 ; then
190 insinto /etc/xinetd.d
191 newins "${FILESDIR}/samba-xinetd" smb
192 fi
193
194 # dirs
195 diropts -m0700 ; keepdir "${PRIVATE_DST}"
196 diropts -m1777 ; keepdir /var/spool/samba
197
198 diropts -m0755
199 keepdir /var/{log,run,cache}/samba
200 keepdir /var/lib/samba/{netlogon,profiles}
201 keepdir /var/lib/samba/printers/{W32X86,WIN40,W32ALPHA,W32MIPS,W32PPC,X64,IA64,COLOR}
202 keepdir /usr/$(get_libdir)/samba/{rpc,idmap,auth}
203
204 # docs
205 dodoc "${FILESDIR}/README.gentoo"
206 dodoc "${S}"/{MAINTAINERS,README,Roadmap,WHATSNEW.txt}
207 dodoc "${CONFDIR}/nsswitch.conf-wins"
208 use winbind && dodoc "${CONFDIR}/nsswitch.conf-winbind"
209
210 if use examples ; then
211 insinto /usr/share/doc/${PF}
212 doins -r "${S}/examples/"
213 find "${D}/usr/share/doc/${PF}" -type d -print0 | xargs -0 chmod 755
214 find "${D}/usr/share/doc/${PF}/examples" ! -type d -print0 | xargs -0 chmod 644
215 fi
216
217 if ! use doc ; then
218 if ! use swat ; then
219 rm -rf "${D}/usr/share/doc/${PF}/swat"
220 else
221 rm -rf "${D}/usr/share/doc/${PF}/swat/help"/{guide,howto,devel}
222 rm -rf "${D}/usr/share/doc/${PF}/swat/using_samba"
223 fi
224 fi
225
226 }
227
228 pkg_preinst() {
229 local PRIVATE_SRC=/etc/samba/private
230 if [[ ! -r "${ROOT}/${PRIVATE_DST}/secrets.tdb" \
231 && -r "${ROOT}/${PRIVATE_SRC}/secrets.tdb" ]] ; then
232 ebegin "Copying ${ROOT}/${PRIVATE_SRC}/* to ${ROOT}/${PRIVATE_DST}/"
233 mkdir -p "${D}/${PRIVATE_DST}"
234 cp -pPRf "${ROOT}/${PRIVATE_SRC}"/* "${D}/${PRIVATE_DST}/"
235 eend $?
236 fi
237
238 if [[ ! -f "${ROOT}/etc/samba/smb.conf" ]] ; then
239 touch "${D}/etc/samba/smb.conf"
240 fi
241 }
242
243 pkg_postinst() {
244 if use swat ; then
245 einfo "swat must be enabled by xinetd:"
246 einfo " change the /etc/xinetd.d/swat configuration"
247 fi
248
249 if use ipv6 ; then
250 einfo "ipv6 support must be enabled by xinetd:"
251 einfo " change the /etc/xinetd.d/smb configuration"
252 fi
253
254 elog "It is possible to start/stop daemons separately:"
255 elog " Create a symlink from /etc/init.d/samba.{smbd,nmbd,winbind} to"
256 elog " /etc/init.d/samba. Calling /etc/init.d/samba directly will start"
257 elog " the daemons configured in /etc/conf.d/samba"
258
259 elog "The mount/umount.cifs helper applications are not included anymore."
260 elog "Please install net-fs/mount-cifs instead."
261
262 ewarn "If you're upgrading from 3.0.24 or earlier, please make sure to"
263 ewarn "restart your clients to clear any cached information about the server."
264 ewarn "Otherwise they might not be able to connect to the volumes."
265 }