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