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