source: branches/samba-3.0/packaging/RedHat-9/samba.spec@ 1036

Last change on this file since 1036 was 22, checked in by Yuri Dario, 19 years ago

Source code upgrade to 3.0.25pre2.

File size: 14.2 KB
Line 
1## grab the major and minor version of rpm
2%define rpm_version `rpm --version | awk '{print $3}' | awk -F. '{print $1$2}'`
3
4Summary: Samba SMB client and server
5Vendor: Samba Team
6Name: samba
7Version: 3.0.25
8Release: 2.pre2
9License: GNU GPL version 2
10Group: Networking
11Source: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
12
13# Don't depend on Net::LDAP
14# one filter for RH 8 and one for 9
15Source998: filter-requires-samba_rh8.sh
16Source999: filter-requires-samba_rh9.sh
17
18Packager: Gerald Carter [Samba-Team] <jerry@samba.org>
19Requires: pam openldap krb5-libs cups
20BuildRequires: openldap-devel krb5-devel pam-devel cups-devel
21Prereq: chkconfig fileutils /sbin/ldconfig
22Provides: samba = %{version}
23Obsoletes: samba-common, samba-client, samba-swat
24BuildRoot: %{_tmppath}/%{name}-%{version}-root
25Prefix: /usr
26
27%description
28Samba provides an SMB/CIFS server which can be used to provide
29network file and print services to SMB/CIFS clients, including
30various versions of MS Windows, OS/2, and other Linux machines.
31Samba also provides some SMB clients, which complement the
32built-in SMB filesystem in Linux. Samba uses NetBIOS over TCP/IP
33(NetBT) protocols and does NOT need NetBEUI (Microsoft Raw NetBIOS
34frame) protocol.
35
36Samba 3.0 also introduces UNICODE support and kerberos/ldap
37integration as a member server in a Windows 2000 domain.
38
39Please refer to the WHATSNEW.txt document for fixup information.
40docs directory for implementation details.
41
42%changelog
43* Mon Nov 18 2002 Gerald Carter <jerry@samba.org>
44 - removed change log entries since history
45 is being maintained in CVS
46
47%prep
48%setup
49
50%build
51
52# Working around perl dependency problem from docs
53# Only > RH 8.0 seems to care here
54
55echo "rpm_version == %{rpm_version}"
56if [ "%{rpm_version}" == "42" ]; then
57 %define __perl_requires %{SOURCE999}
58 echo "%{__perl_requires}"
59elif [ "%{rpm_version}" == "41" ]; then
60 %define __find_requires %{SOURCE998}
61 echo "%{__find_requires}"
62fi
63
64## Build main Samba source
65cd source
66
67%ifarch ia64
68libtoolize --copy --force # get it to recognize IA-64
69autoheader
70autoconf
71EXTRA="-D_LARGEFILE64_SOURCE"
72%endif
73
74## Get number of cpu's, default for 1 cpu on error
75NUMCPU=`grep processor /proc/cpuinfo | wc -l`
76if [ $NUMCPU -eq 0 ]; then
77 NUMCPU=1;
78fi
79
80## run autogen if missing the configure script
81if [ ! -f "configure" ]; then
82 ./autogen.sh
83fi
84
85CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
86 --prefix=%{prefix} \
87 --localstatedir=/var \
88 --with-configdir=/etc/samba \
89 --with-privatedir=/etc/samba \
90 --with-fhs \
91 --with-quotas \
92 --with-smbmount \
93 --enable-cups \
94 --with-pam \
95 --with-pam_smbpass \
96 --with-syslog \
97 --with-utmp \
98 --with-swatdir=%{prefix}/share/swat \
99 --with-shared-modules=idmap_rid \
100 --with-libsmbclient
101make -j${NUMCPU} proto
102make -j${NUMCPU} all modules nsswitch/libnss_wins.so
103make -j${NUMCPU} debug2html
104
105# Remove some permission bits to avoid to many dependencies
106cd ..
107find examples docs -type f | xargs -r chmod -x
108
109%install
110rm -rf $RPM_BUILD_ROOT
111mkdir -p $RPM_BUILD_ROOT
112mkdir -p $RPM_BUILD_ROOT/sbin
113mkdir -p $RPM_BUILD_ROOT/etc/samba
114mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
115mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
116mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
117mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{help,include,using_samba}
118mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/help/using_samba/{figs,gifs}
119mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
120mkdir -p $RPM_BUILD_ROOT/var/lib/samba
121mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
122mkdir -p $RPM_BUILD_ROOT/var/spool/samba
123mkdir -p $RPM_BUILD_ROOT/lib/security
124mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
125mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
126
127# Install standard binary files
128for i in nmblookup smbget smbclient smbpasswd smbstatus testparm \
129 rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt net \
130 smbcacls pdbedit eventlogadm tdbbackup smbtree ntlm_auth smbcquotas
131do
132 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
133done
134
135for i in mksmbpasswd.sh smbtar findsmb
136do
137 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
138done
139
140# Install secure binary files
141for i in smbd nmbd swat smbmount smbumount debug2html winbindd
142do
143 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
144done
145
146# we need a symlink for mount to recognise the smb and smbfs filesystem types
147ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
148ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
149
150# This allows us to get away without duplicating code that
151# sombody else can maintain for us.
152cd source
153make DESTDIR=$RPM_BUILD_ROOT \
154 BASEDIR=/usr \
155 CONFIGDIR=/etc/samba \
156 LIBDIR=%{prefix}/lib/samba \
157 VARDIR=/var \
158 SBINDIR=%{prefix}/sbin \
159 BINDIR=%{prefix}/bin \
160 MANDIR=MANDIR_MACRO \
161 SWATDIR=%{prefix}/share/swat \
162 SAMBABOOK=%{prefix}/share/swat/using_samba \
163 installman installswat installdat installmodules
164cd ..
165
166## don't duplicate the docs. These are installed with SWAT
167rm -rf docs/htmldocs
168rm -rf docs/manpages
169( cd docs; ln -s %{prefix}/share/swat/help htmldocs )
170
171
172
173# Install the nsswitch wins library
174install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
175( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2 )
176
177# Install winbind shared libraries
178install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
179( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2 )
180install -m755 source/bin/pam_winbind.so $RPM_BUILD_ROOT/lib/security
181
182# Install pam_smbpass.so
183install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
184
185# libsmbclient
186install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
187install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
188install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
189
190# libmsrpc
191install -m 755 source/bin/libmsrpc.so $RPM_BUILD_ROOT%{prefix}/lib/
192install -m 755 source/bin/libmsrpc.a $RPM_BUILD_ROOT%{prefix}/lib/
193install -m 644 source/include/libmsrpc.h $RPM_BUILD_ROOT%{prefix}/include/
194
195# Install the miscellany
196install -m755 packaging/RedHat-9/smbprint $RPM_BUILD_ROOT%{prefix}/bin
197install -m755 packaging/RedHat-9/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
198install -m755 packaging/RedHat-9/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
199install -m755 packaging/RedHat-9/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
200install -m644 packaging/RedHat-9/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
201install -m644 packaging/RedHat-9/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
202install -m644 packaging/RedHat-9/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
203install -m644 packaging/RedHat-9/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
204install -m644 packaging/RedHat-9/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
205install -m644 packaging/RedHat-9/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
206echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
207
208# Remove "*.old" files
209find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
210
211##
212## Clean out man pages for tools not installed here
213##
214rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
215rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
216rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
217rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/mount.cifs.8*
218
219
220%clean
221rm -rf $RPM_BUILD_ROOT
222
223%post
224##
225## only needed if this is a new install (not an upgrade)
226##
227if [ "$1" -eq "1" ]; then
228 /sbin/chkconfig --add smb
229 /sbin/chkconfig --add winbind
230 /sbin/chkconfig smb off
231 /sbin/chkconfig winbind off
232fi
233
234##
235## we only have to wory about this if we are upgrading
236##
237if [ "$1" -eq "2" ]; then
238 if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
239 echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
240 mv /etc/smb.conf /etc/samba/smb.conf
241 fi
242
243 if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
244 echo "Moving old /etc/smbusers to /etc/samba/smbusers"
245 mv /etc/smbusers /etc/samba/smbusers
246 fi
247
248 if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
249 echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
250 mv /etc/lmhosts /etc/samba/lmhosts
251 fi
252
253 if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
254 echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
255 mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
256 fi
257
258 if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
259 echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
260 mv /etc/smbpasswd /etc/samba/smbpasswd
261 fi
262
263 #
264 # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
265 # to preserve across reboots.
266 #
267 for i in /var/lock/samba/*.tdb; do
268 if [ -f $i ]; then
269 newname="/var/lib/samba/`basename $i`"
270 echo "Moving $i to $newname"
271 mv $i $newname
272 fi
273 done
274
275 #
276 # For 3.0.1 we move the tdb files from /var/cache/samba to /var/lib/samba
277 #
278 echo "Moving tdb files in /var/cache/samba/*.tdb to /var/lib/samba/*.tdb"
279 for i in /var/cache/samba/*.tdb; do
280 if [ -f $i ]; then
281 newname="/var/lib/samba/`basename $i`"
282 echo "Moving $i to $newname"
283 mv $i $newname
284 fi
285 done
286fi
287
288##
289## New things
290##
291
292# Add swat entry to /etc/services if not already there.
293if [ ! "`grep ^\s**swat /etc/services`" ]; then
294 echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
295fi
296
297# Add swat entry to /etc/inetd.conf if needed.
298if [ -f /etc/inetd.conf ]; then
299 if [ ! "`grep ^\s*swat /etc/inetd.conf`" ]; then
300 echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
301 killall -HUP inetd || :
302 fi
303fi
304
305# Add swat entry to xinetd.d if needed.
306if [ -d /etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
307 mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
308else
309 rm -f /etc/samba/samba.xinetd
310fi
311
312# Install the correct version of the samba pam file
313if [ -f /lib/security/pam_stack.so ]; then
314 echo "Installing stack version of /etc/pam.d/samba..."
315 mv /etc/samba/samba.stack /etc/pam.d/samba
316else
317 echo "Installing non-stack version of /etc/pam.d/samba..."
318 rm -f /etc/samba/samba.stack
319fi
320
321## call ldconfig to create the version symlink for libsmbclient.so
322/sbin/ldconfig
323
324%preun
325if [ "$1" -eq "0" ] ; then
326 /sbin/chkconfig --del smb
327 /sbin/chkconfig --del winbind
328
329 # We want to remove the browse.dat and wins.dat files
330 # so they can not interfer with a new version of samba!
331 if [ -e /var/lib/samba/browse.dat ]; then
332 rm -f /var/lib/samba/browse.dat
333 fi
334 if [ -e /var/lib/samba/wins.dat ]; then
335 rm -f /var/lib/samba/wins.dat
336 fi
337
338 # Remove the transient tdb files.
339 if [ -e /var/lib/samba/brlock.tdb ]; then
340 rm -f /var/lib/samba/brlock.tdb
341 fi
342
343 if [ -e /var/lib/samba/unexpected.tdb ]; then
344 rm -f /var/lib/samba/unexpected.tdb
345 fi
346
347 if [ -e /var/lib/samba/connections.tdb ]; then
348 rm -f /var/lib/samba/connections.tdb
349 fi
350
351 if [ -e /var/lib/samba/locking.tdb ]; then
352 rm -f /var/lib/samba/locking.tdb
353 fi
354
355 if [ -e /var/lib/samba/messages.tdb ]; then
356 rm -f /var/lib/samba/messages.tdb
357 fi
358fi
359
360%postun
361# Only delete remnants of samba if this is the final deletion.
362if [ "$1" -eq "0" ] ; then
363 if [ -x /etc/pam.d/samba ]; then
364 rm -f /etc/pam.d/samba
365 fi
366
367 if [ -e /var/log/samba ]; then
368 rm -rf /var/log/samba
369 fi
370
371 if [ -e /var/lib/samba ]; then
372 rm -rf /var/lib/samba
373 fi
374
375 # Remove swat entries from /etc/inetd.conf and /etc/services
376 cd /etc
377 tmpfile=/etc/tmp.$$
378 if [ -f /etc/inetd.conf ]; then
379 # preserve inetd.conf permissions.
380 cp -p /etc/inetd.conf $tmpfile
381 sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
382 mv $tmpfile inetd.conf
383 fi
384
385 # preserve services permissions.
386 cp -p /etc/services $tmpfile
387 sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
388 mv $tmpfile /etc/services
389
390 # Remove swat entry from /etc/xinetd.d
391 if [ -f /etc/xinetd.d/swat ]; then
392 rm -r /etc/xinetd.d/swat
393 fi
394fi
395
396/sbin/ldconfig
397
398%files
399%defattr(-,root,root)
400%doc README COPYING Manifest Read-Manifest-Now
401%doc WHATSNEW.txt Roadmap
402%doc docs
403%doc examples
404%{prefix}/sbin/smbd
405%{prefix}/sbin/nmbd
406%{prefix}/sbin/swat
407%{prefix}/bin/smbmnt
408%{prefix}/sbin/smbmount
409%{prefix}/sbin/smbumount
410%{prefix}/sbin/winbindd
411%{prefix}/sbin/samba
412%{prefix}/sbin/debug2html
413/sbin/mount.smbfs
414/sbin/mount.smb
415%{prefix}/bin/mksmbpasswd.sh
416%{prefix}/bin/smbclient
417%{prefix}/bin/smbget
418%{prefix}/bin/smbspool
419%{prefix}/bin/rpcclient
420%{prefix}/bin/testparm
421%{prefix}/bin/findsmb
422%{prefix}/bin/smbstatus
423%{prefix}/bin/nmblookup
424%{prefix}/bin/smbpasswd
425%{prefix}/bin/smbtar
426%{prefix}/bin/smbprint
427%{prefix}/bin/smbcontrol
428%{prefix}/bin/wbinfo
429%{prefix}/bin/net
430%{prefix}/bin/ntlm_auth
431%{prefix}/bin/smbcquotas
432%{prefix}/bin/smbcacls
433%{prefix}/bin/pdbedit
434%{prefix}/bin/eventlogadm
435%{prefix}/bin/tdbbackup
436%{prefix}/bin/smbtree
437%attr(755,root,root) /lib/libnss_wins.s*
438%attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
439%attr(755,root,root) %{prefix}/lib/samba/auth/*.so
440%attr(755,root,root) %{prefix}/lib/samba/charset/*.so
441%attr(755,root,root) %{prefix}/lib/samba/idmap/*.so
442#%attr(755,root,root) %{prefix}/lib/samba/pdb/*.so
443%attr(755,root,root) %{prefix}/lib/samba/*.dat
444%attr(755,root,root) %{prefix}/lib/samba/*.msg
445%{prefix}/include/libsmbclient.h
446%{prefix}/lib/libsmbclient.a
447%{prefix}/lib/libsmbclient.so
448%{prefix}/include/libmsrpc.h
449%{prefix}/lib/libmsrpc.a
450%{prefix}/lib/libmsrpc.so
451%{prefix}/share/swat/help/*
452%{prefix}/share/swat/using_samba/*
453%{prefix}/share/swat/include/*.html
454%{prefix}/share/swat/images/*
455%{prefix}/share/swat/lang/*/help/*
456%{prefix}/share/swat/lang/*/images/*
457%config(noreplace) /etc/samba/lmhosts
458%config(noreplace) /etc/samba/smb.conf
459%config(noreplace) /etc/samba/smbusers
460/etc/samba/samba.stack
461/etc/samba/samba.xinetd
462/etc/rc.d/init.d/smb
463/etc/rc.d/init.d/winbind
464/etc/logrotate.d/samba
465%config(noreplace) /etc/pam.d/samba
466MANDIR_MACRO/man1/*
467MANDIR_MACRO/man5/*
468MANDIR_MACRO/man7/*
469MANDIR_MACRO/man8/*
470%attr(755,root,root) %dir /var/lib/samba
471%dir /var/log/samba
472%dir /var/run/samba
473%attr(1777,root,root) %dir /var/spool/samba
474%attr(-,root,root) /lib/libnss_winbind.so*
475%attr(-,root,root) /lib/security/pam_winbind.so
476%attr(-,root,root) /lib/security/pam_smbpass.so
Note: See TracBrowser for help on using the repository browser.