This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[kai/samba-autobuild/.git] / packaging / RedHat / samba2.spec.tmpl
1 Summary: Samba SMB client and server
2 Name: samba
3 Version: PVERSION
4 Release: PRELEASE
5 Copyright: GNU GPL version 2
6 Group: Networking
7 Source: ftp://samba.org/pub/samba/samba-%{version}.tar.gz
8 Packager: John H Terpstra [Samba-Team] <jht@samba.org>
9 Requires: pam >= 0.72 kernel >= 2.2.1 glibc >= 2.1.2
10 Prereq: chkconfig fileutils
11 BuildRoot: /var/tmp/samba
12 Prefix: /usr
13
14 %description
15 Samba provides an SMB server which can be used to provide
16 network services to SMB (sometimes called "Lan Manager")
17 clients, including various versions of MS Windows, OS/2,
18 and other Linux machines. Samba also provides some SMB
19 clients, which complement the built-in SMB filesystem
20 in Linux. Samba uses NetBIOS over TCP/IP (NetBT) protocols
21 and does NOT need NetBEUI (Microsoft Raw NetBIOS frame)
22 protocol.
23
24 Samba-2.2 features working NT Domain Control capability and 
25 includes the SWAT (Samba Web Administration Tool) that 
26 allows samba's smb.conf file to be remotely managed using your 
27 favourite web browser. For the time being this is being
28 enabled on TCP port 901 via inetd.
29
30 Users are advised to use Samba-2.2 as a Windows NT4
31 Domain Controller only on networks that do NOT have a Windows
32 NT Domain Controller. This release does NOT as yet have
33 Backup Domain control ability.
34
35 Please refer to the WHATSNEW.txt document for fixup information.
36 This binary release includes encrypted password support.
37
38 Please read the smb.conf file and ENCRYPTION.txt in the
39 docs directory for implementation details.
40
41 NOTE: Red Hat Linux uses PAM which has integrated support
42 for Shadow passwords and quotas. Do NOT recompile with the
43 SHADOW_PWD option enabled
44
45 %changelog
46 * Mon Aug 1 2001 Tim Potter <tpot@samba.org>
47  - Install winbind daemon, client programs, nss and pam libraries
48  - Removed codepage stuff so spec file works with current HEAD branch
49
50 * Sat Mar 31 2001 Andrew Bartlett <abartlet@pcug.org.au>
51  - Changed prefix/share/man for _mandir/share/man
52   - Changed this for a sed macro MANDIR_MACRO
53   - This allows us to build both RH7 (RPM4)
54      and older versions from same specfile.
55  - Made makerpms.sh use the rpm -ta command rather 
56     than attempting to devine the correct location to 
57     put the file.  Also removes some /tmp symlink games.
58   - Allows build on RPM4
59  - Increased PAM requirements to allow us to use 
60    system-auth (this pam is in 6.x errata at least)
61
62 * Tue Mar 27 2001 John H Terpstra <jht@samba.org>
63  - Fixed typos introduced by Sum Wun.
64  - Build for Red Hat 7.x
65
66 * Sun Nov 12 2000 John H Terpstra <jht@samba.org>
67  - Updated for Samba-2.2 releases
68  - Added libnss_wins.so stuff
69  - Added compile-time options
70
71 * Sat Nov 29 1999 Matthew Vanecek <mev0003@unt.edu>
72  - Added a Prefix and changed "/usr" to "%{prefix}"
73
74 * Sat Nov 11 1999 Tridge <tridge@linuxcare.com>
75  - changed from mount.smb to mount.smbfs
76
77 * Sat Oct 9 1999 Tridge <tridge@linuxcare.com>
78  - removed smbwrapper
79  - added smbmnt and smbmount
80
81 * Sun Apr 25 1999 John H Terpstra <jht@samba.org>
82  - added smbsh.1 man page
83
84 * Fri Mar 26 1999 Andrew Tridgell <tridge@samba.org>
85  - added --with-pam as pam is no longer used by default
86
87 * Sat Jan 27 1999 Jeremy Allison <jra@samba.org>
88  - Removed smbrun binary and tidied up some loose ends
89
90 * Sun Oct 25 1998 John H Terpstra <jht@samba.org>
91  - Added parameters to /config to ensure smb.conf, lmhosts, 
92         and smbusers never gets over-written.
93
94 * Sat Oct 24 1998 John H Terpstra <jht@samba.org>
95  - removed README.smbsh file from docs area
96
97 * Mon Oct 05 1998 John H Terpstra <jht@samba.org>
98  - Added rpcclient to binaries list
99  - Added smbwrapper stuff
100
101 * Fri Aug 21 1998 John H Terpstra <jht@samba.org>
102  - Updated for Samba version 2.0 building
103
104 * Tue Jul 07 1998 Erik Troan <ewt@redhat.com>
105   - updated postun triggerscript to check $0
106   - clear /etc/codepages from %preun instead of %postun
107
108 * Sat Jul 04 1998 John H Terpstra <jht@samba.org>
109  - fixed codepage preservation during update via -Uvh
110
111 * Mon Jun 08 1998 Erik Troan <ewt@redhat.com>
112   - made the %postun script a tad less agressive; no reason to remove
113     the logs or lock file 
114   - the %postun and %preun should only exectute if this is the final
115     removal
116   - migrated %triggerpostun from Red Hat's samba package to work around
117     packaging problems in some Red Hat samba releases
118
119 * Sun Apr 26 1998 John H Terpstra <jht@samba.org>
120  - Tidy up for early alpha releases
121  - added findsmb from SGI packaging
122
123 * Thu Apr 09 1998 John H Terpstra <jht@samba.org>
124  - Updated spec file
125  - Included new codepage.936
126
127 * Sat Mar 20 1998 John H Terpstra <jht@samba.org>
128  - Added swat facility
129
130 * Sat Jan 24 1998 John H Terpstra <jht@samba.org>
131  - Many optimisations (some suggested by Manoj Kasichainula <manojk@io.com>
132   - Use of chkconfig in place of individual symlinks to /etc/rc.d/init/smb
133   - Compounded make line
134   - Updated smb.init restart mechanism
135   - Use compound mkdir -p line instead of individual calls to mkdir
136   - Fixed smb.conf file path for log files
137   - Fixed smb.conf file path for incoming smb print spool directory
138   - Added a number of options to smb.conf file
139   - Added smbuser file and smb.conf file updates for username map
140
141 %prep
142 %setup
143
144 %build
145 cd source
146
147 %ifarch ia64
148 libtoolize --copy --force     # get it to recognize IA-64
149 autoheader
150 autoconf
151 EXTRA="-D_LARGEFILE64_SOURCE"
152 %endif
153 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
154 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
155         --prefix=%{prefix} \
156         --localstatedir=/var \
157         --with-configdir=/etc/samba \
158         --with-privatedir=/etc/samba \
159         --with-fhs \
160         --with-quotas \
161         --with-smbmount \
162         --with-pam \
163         --with-syslog \
164         --with-utmp \
165         --with-netatalk \
166         --with-sambabook=%{prefix}/share/swat/using_samba \
167         --with-swatdir=%{prefix}/share/swat
168 make -j${NUMCPU} proto
169 make -j${NUMCPU} all nsswitch/libnss_wins.so
170 make -j${NUMCPU} debug2html
171 make -j${NUMCPU} bin/smbspool
172
173
174 %install
175 rm -rf $RPM_BUILD_ROOT
176 mkdir -p $RPM_BUILD_ROOT
177 mkdir -p $RPM_BUILD_ROOT/sbin
178 mkdir -p $RPM_BUILD_ROOT/etc/samba
179 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
180 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
181 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
182 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
183 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
184 mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
185 mkdir -p $RPM_BUILD_ROOT/var/lock/samba
186 mkdir -p $RPM_BUILD_ROOT/var/log/samba
187 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
188 mkdir -p $RPM_BUILD_ROOT/lib/security
189
190 # Install standard binary files
191 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
192       make_printerdef rpcclient smbspool smbcacls smbcontrol wbinfo
193 do
194 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
195 done
196 for i in mksmbpasswd.sh smbtar 
197 do
198 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
199 done
200
201 # Install secure binary files
202 for i in smbd nmbd swat smbmount smbumount smbmnt debug2html winbindd
203 do
204 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
205 done
206
207 # we need a symlink for mount to recognise the smb and smbfs filesystem types
208 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
209 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
210
211 # This allows us to get away without duplicating code that 
212 #  sombody else can maintain for us.  
213 cd source
214 make LIBDIR=$RPM_BUILD_ROOT/etc/samba \
215         BINDIR=$RPM_BUILD_ROOT%{prefix}/bin \
216         MANDIR=$RPM_BUILD_ROOTMANDIR_MACRO \
217         SWATDIR=$RPM_BUILD_ROOT/usr/share/swat \
218         SAMBABOOK=$RPM_BUILD_ROOT/usr/share/swat/using_samba \
219         installman installswat
220 cd ..
221
222 # Install the nsswitch library extension file
223 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
224
225 # Make link for wins resolver
226 ( cd $RPM_BUILD_ROOT/lib; ln -s libnss_wins.so libnss_wins.so.2; )
227
228 # Install winbind shared libraries
229 install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
230 install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
231
232 # Install SWAT helper files
233 for i in swat/help/*.html docs/htmldocs/*.html
234 do
235 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
236 done
237 for i in swat/images/*.gif
238 do
239 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
240 done
241 for i in swat/include/*.html
242 do
243 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
244 done
245
246 # Install the miscellany
247 install -m644 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat
248 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
249 install -m755 packaging/RedHat/findsmb $RPM_BUILD_ROOT%{prefix}/bin
250 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
251 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
252 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
253 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
254 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
255 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
256 install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
257 install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
258 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
259
260 %clean
261 rm -rf $RPM_BUILD_ROOT
262
263 %post
264 /sbin/chkconfig --add smb
265 /sbin/chkconfig smb off
266
267 echo "Looking for old /etc/smb.conf..."
268 if [ -f /etc/smb.conf ]; then
269         echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
270         mv /etc/smb.conf /etc/samba/smb.conf
271 fi
272
273 echo "Looking for old /etc/smbusers..."
274 if [ -f /etc/smbusers ]; then
275         echo "Moving old /etc/smbusers to /etc/samba/smbusers"
276         mv /etc/smbusers /etc/samba/smbusers
277 fi
278
279 echo "Looking for old /etc/lmhosts..."
280 if [ -f /etc/lmhosts ]; then
281         echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
282         mv /etc/lmhosts /etc/samba/lmhosts
283 fi
284
285 echo "Looking for old /etc/MACHINE.SID..."
286 if [ -f /etc/MACHINE.SID ]; then
287         echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
288         mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
289 fi
290
291 echo "Looking for old /etc/smbpasswd..."
292 if [ -f /etc/smbpasswd ]; then
293         echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
294         mv /etc/smbpasswd /etc/samba/smbpasswd
295 fi
296
297 # Add swat entry to /etc/services if not already there.
298 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
299         echo 'swat              901/tcp                         # Add swat service used via inetd' >> /etc/services
300 fi
301
302 # Add swat entry to /etc/inetd.conf if needed.
303 if [ -f /etc/inetd.conf ]; then
304         if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
305                 echo 'swat      stream  tcp     nowait.400      root    %{prefix}/sbin/swat swat' >> /etc/inetd.conf
306         killall -1 inetd || :
307         fi
308 fi
309
310 # Add swat entry to xinetd.d if needed.
311 if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
312         mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
313 else
314         rm -f /etc/samba/samba.xinetd
315 fi
316
317 # Install the correct version of the samba pam file, depending on pam version.
318 if [ -f /lib/security/pam_stack.so ]; then
319         echo "Installing stack version of /etc/pam.d/samba..."
320         mv /etc/samba/samba.stack /etc/pam.d/samba
321 else
322         echo "Installing non-stack version of /etc/pam.d/samba..."
323         rm -f /etc/samba/samba.stack
324 fi
325
326 # Create winbind nss client symlink
327
328 ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2
329
330 %preun
331 if [ $1 = 0 ] ; then
332     /sbin/chkconfig --del smb
333
334     # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
335     if [ -e /var/lock/samba/browse.dat ]; then
336             rm -f /var/lock/samba/browse.dat
337     fi
338     if [ -e /var/lock/samba/wins.dat ]; then
339             rm -f /var/lock/samba/wins.dat
340     fi
341
342         # Remove the transient tdb files.
343         if [ -e /var/lock/samba/brlock.tdb ]; then
344                 rm -f /var/lock/samba/brlock.tdb
345         fi
346
347         if [ -e /var/lock/samba/unexpected.tdb ]; then
348                 rm -f /var/lock/samba/unexpected.tdb
349         fi
350
351         if [ -e /var/lock/samba/connections.tdb ]; then
352                 rm -f /var/lock/samba/connections.tdb
353         fi
354
355         if [ -e /var/lock/samba/locking.tdb ]; then
356                 rm -f /var/lock/samba/locking.tdb
357         fi
358
359         if [ -e /var/lock/samba/messages.tdb ]; then
360                 rm -f /var/lock/samba/messages.tdb
361         fi
362
363         # Remove winbind nss client symlink
364
365         if [ -L /lib/libnss_winbind.so.2 ]; then
366                 rm -f /lib/libnss_winbind.so.2
367         fi
368 fi
369
370 %postun
371 # Only delete remnants of samba if this is the final deletion.
372 if [ $1 = 0 ] ; then
373     if [ -x /etc/pam.d/samba ]; then
374       rm -f /etc/pam.d/samba
375     fi
376     if [ -e /var/log/samba ]; then
377       rm -rf /var/log/samba
378     fi
379
380     # Remove swat entries from /etc/inetd.conf and /etc/services
381     cd /etc
382     tmpfile=/etc/tmp.$$
383         if [ -f /etc/inetd.conf ]; then
384       # preserve inetd.conf permissions.
385       cp -p /etc/inetd.conf $tmpfile
386       sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
387       mv $tmpfile inetd.conf
388         fi
389     # preserve services permissions.
390     cp -p /etc/services $tmpfile
391     sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
392     mv $tmpfile /etc/services
393
394         # Remove swat entry from /etc/xinetd.d
395         if [ -f /etc/xinetd.d/swat ]; then
396                 rm -r /etc/xinetd.d/swat
397         fi
398 fi
399
400 %triggerpostun -- samba < samba-2.0.0
401 if [ $0 != 0 ]; then
402     /sbin/chkconfig --add smb
403 fi
404
405 %files
406 %doc README COPYING Manifest Read-Manifest-Now
407 %doc WHATSNEW.txt Roadmap
408 %doc docs
409 %doc swat/README
410 %doc examples
411 %attr(-,root,root) %{prefix}/sbin/smbd
412 %attr(-,root,root) %{prefix}/sbin/nmbd
413 %attr(-,root,root) %{prefix}/sbin/swat
414 %attr(-,root,root) %{prefix}/sbin/smbmnt
415 %attr(-,root,root) %{prefix}/sbin/smbmount
416 %attr(-,root,root) %{prefix}/sbin/smbumount
417 %attr(-,root,root) %{prefix}/sbin/winbindd
418 %attr(-,root,root) /sbin/mount.smbfs
419 %attr(-,root,root) /sbin/mount.smb
420 %attr(-,root,root) %{prefix}/bin/mksmbpasswd.sh
421 %attr(-,root,root) %{prefix}/bin/smbclient
422 %attr(-,root,root) %{prefix}/bin/smbspool
423 %attr(-,root,root) %{prefix}/bin/rpcclient
424 %attr(-,root,root) %{prefix}/bin/testparm
425 %attr(-,root,root) %{prefix}/bin/testprns
426 %attr(-,root,root) %{prefix}/bin/findsmb
427 %attr(-,root,root) %{prefix}/bin/smbstatus
428 %attr(-,root,root) %{prefix}/bin/nmblookup
429 %attr(-,root,root) %{prefix}/bin/make_printerdef
430 %attr(-,root,root) %{prefix}/bin/smbpasswd
431 %attr(-,root,root) %{prefix}/bin/smbtar
432 %attr(-,root,root) %{prefix}/bin/smbprint
433 %attr(-,root,root) %{prefix}/bin/smbcontrol
434 %attr(-,root,root) %{prefix}/bin/smbcacls
435 %attr(-,root,root) %{prefix}/bin/wbinfo
436 %attr(755,root,root) /lib/libnss_wins.s*
437 %attr(-,root,root) %{prefix}/share/swat/help/*
438 %attr(-,root,root) %{prefix}/share/swat/images/*
439 %attr(-,root,root) %{prefix}/share/swat/include/header.html
440 %attr(-,root,root) %{prefix}/share/swat/include/footer.html
441 %attr(-,root,root) %{prefix}/share/swat/using_samba/*
442 %attr(-,root,root) %config(noreplace) /etc/samba/lmhosts
443 %attr(-,root,root) %config(noreplace) /etc/samba/smb.conf
444 %attr(-,root,root) %config(noreplace) /etc/samba/smbusers
445 %attr(-,root,root) /etc/samba/samba.stack
446 %attr(-,root,root) /etc/samba/samba.xinetd
447 %attr(-,root,root) /etc/rc.d/init.d/smb
448 %attr(-,root,root) /etc/logrotate.d/samba
449 %attr(-,root,root) %config(noreplace) /etc/pam.d/samba
450 %attr(-,root,root) MANDIR_MACRO/man1/*
451 %attr(-,root,root) MANDIR_MACRO/man5/*
452 %attr(-,root,root) MANDIR_MACRO/man7/*
453 %attr(-,root,root) MANDIR_MACRO/man8/*
454 %attr(755,root,root) %dir /var/lock/samba
455 %attr(-,root,root) %dir /var/log/samba
456 %attr(1777,root,root) %dir /var/spool/samba
457 %attr(-,root,root) /lib/libnss_winbind.so
458 %attr(-,root,root) /lib/security/pam_winbind.so