first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
[kai/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-PVERSION.tar.gz
8 Patch: makefile-path.patch
9 Patch1: smbw.patch
10 Packager: John H Terpstra [Samba-Team] <jht@samba.org>
11 Requires: pam >= 0.64
12 Prereq: chkconfig fileutils
13 BuildRoot: /var/tmp/samba
14 Prefix: /usr
15
16 %description
17 Samba provides an SMB server which can be used to provide
18 network services to SMB (sometimes called "Lan Manager")
19 clients, including various versions of MS Windows, OS/2,
20 and other Linux machines. Samba also provides some SMB
21 clients, which complement the built-in SMB filesystem
22 in Linux. Samba uses NetBIOS over TCP/IP (NetBT) protocols
23 and does NOT need NetBEUI (Microsoft Raw NetBIOS frame)
24 protocol.
25
26 Samba-2 features an almost working NT Domain Control
27 capability and includes the new SWAT (Samba Web Administration
28 Tool) that allows samba's smb.conf file to be remotely managed
29 using your favourite web browser. For the time being this is
30 being enabled on TCP port 901 via inetd.
31
32 Please refer to the WHATSNEW.txt document for fixup information.
33 This binary release includes encrypted password support.
34 Please read the smb.conf file and ENCRYPTION.txt in the
35 docs directory for implementation details.
36
37 NOTE: Red Hat Linux 5.X Uses PAM which has integrated support
38 for Shadow passwords. Do NOT recompile with the SHADOW_PWD option
39 enabled. Red Hat Linux has built in support for quotas in PAM.
40
41 %changelog
42 * Sat Nov 29 1999 Matthew Vanecek <mev0003@unt.edu>
43  - Added a Prefix and changed "/usr" to "%{prefix}"
44
45 * Sat Nov 11 1999 Tridge <tridge@linuxcare.com>
46  - changed from mount.smb to mount.smbfs
47
48 * Sat Oct 9 1999 Tridge <tridge@linuxcare.com>
49  - removed smbwrapper
50  - added smbmnt and smbmount
51
52 * Sun Apr 25 1999 John H Terpstra <jht@samba.org>
53  - added smbsh.1 man page
54
55 * Fri Mar 26 1999 Andrew Tridgell <tridge@samba.org>
56  - added --with-pam as pam is no longer used by default
57
58 * Sat Jan 27 1999 Jeremy Allison <jra@samba.org>
59  - Removed smbrun binary and tidied up some loose ends
60
61 * Sun Oct 25 1998 John H Terpstra <jht@samba.org>
62  - Added parameters to /config to ensure smb.conf, lmhosts, 
63         and smbusers never gets over-written.
64
65 * Sat Oct 24 1998 John H Terpstra <jht@samba.org>
66  - removed README.smbsh file from docs area
67
68 * Mon Oct 05 1998 John H Terpstra <jht@samba.org>
69  - Added rpcclient to binaries list
70  - Added smbwrapper stuff
71
72 * Fri Aug 21 1998 John H Terpstra <jht@samba.org>
73  - Updated for Samba version 2.0 building
74
75 * Tue Jul 07 1998 Erik Troan <ewt@redhat.com>
76   - updated postun triggerscript to check $0
77   - clear /etc/codepages from %preun instead of %postun
78
79 * Sat Jul 04 1998 John H Terpstra <jht@samba.org>
80  - fixed codepage preservation during update via -Uvh
81
82 * Mon Jun 08 1998 Erik Troan <ewt@redhat.com>
83   - made the %postun script a tad less agressive; no reason to remove
84     the logs or lock file 
85   - the %postun and %preun should only exectute if this is the final
86     removal
87   - migrated %triggerpostun from Red Hat's samba package to work around
88     packaging problems in some Red Hat samba releases
89
90 * Sun Apr 26 1998 John H Terpstra <jht@samba.org>
91  - Tidy up for early alpha releases
92  - added findsmb from SGI packaging
93
94 * Thu Apr 09 1998 John H Terpstra <jht@samba.org>
95  - Updated spec file
96  - Included new codepage.936
97
98 * Sat Mar 20 1998 John H Terpstra <jht@samba.org>
99  - Added swat facility
100
101 * Sat Jan 24 1998 John H Terpstra <jht@samba.org>
102  - Many optimisations (some suggested by Manoj Kasichainula <manojk@io.com>
103   - Use of chkconfig in place of individual symlinks to /etc/rc.d/init/smb
104   - Compounded make line
105   - Updated smb.init restart mechanism
106   - Use compound mkdir -p line instead of individual calls to mkdir
107   - Fixed smb.conf file path for log files
108   - Fixed smb.conf file path for incoming smb print spool directory
109   - Added a number of options to smb.conf file
110   - Added smbadduser command (missed from all previous RPMs) - Doooh!
111   - Added smbuser file and smb.conf file updates for username map
112
113 %prep
114 %setup
115 %patch -p1
116 %patch1 -p1
117
118 %build
119 cd source
120 ./configure --prefix=%{prefix} --libdir=/etc --with-lockdir=/var/lock/samba --with-privatedir=/etc --with-swatdir=%{prefix}/share/swat --with-smbmount --with-automount --with-quotas --with-pam
121 make all
122
123 %install
124 rm -rf $RPM_BUILD_ROOT
125 mkdir -p $RPM_BUILD_ROOT
126 mkdir -p $RPM_BUILD_ROOT/etc/codepages/src
127 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d}
128 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/{init.d,rc0.d,rc1.d,rc2.d,rc3.d,rc5.d,rc6.d}
129 mkdir -p $RPM_BUILD_ROOT/home/samba
130 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
131 mkdir -p $RPM_BUILD_ROOT/sbin
132 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include}
133 mkdir -p $RPM_BUILD_ROOT%{prefix}/man/{man1,man5,man7,man8}
134 mkdir -p $RPM_BUILD_ROOT/var/lock/samba
135 mkdir -p $RPM_BUILD_ROOT/var/log/samba
136 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
137
138 # Install standard binary files
139 for i in nmblookup smbclient smbspool smbpasswd smbstatus testparm testprns \
140       make_smbcodepage make_printerdef rpcclient
141 do
142 install -m755 -s source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
143 done
144 for i in addtosmbpass mksmbpasswd.sh smbtar 
145 do
146 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
147 done
148
149 # Install secure binary files
150 for i in smbd nmbd swat smbmount smbmnt smbumount
151 do
152 install -m755 -s source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
153 done
154
155 # we need a symlink for mount to recognise the smb filesystem type
156 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
157
158 # Install level 1 man pages
159 for i in smbclient.1 smbrun.1 smbstatus.1 smbtar.1 testparm.1 testprns.1 make_smbcodepage.1 nmblookup.1
160 do
161 install -m644 docs/manpages/$i $RPM_BUILD_ROOT%{prefix}/man/man1
162 done
163
164 # Install codepage source files
165 for i in 437 737 850 852 861 866 932 936 949 950
166 do
167 install -m644 source/codepages/codepage_def.$i $RPM_BUILD_ROOT/etc/codepages/src
168 done
169
170 # Install SWAT helper files
171 for i in swat/help/*.html docs/htmldocs/*.html
172 do
173 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
174 done
175 for i in swat/images/*.gif
176 do
177 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
178 done
179 for i in swat/include/*.html
180 do
181 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
182 done
183
184 # Install the miscellany
185 install -m644 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat
186 install -m644 docs/manpages/smb.conf.5 $RPM_BUILD_ROOT%{prefix}/man/man5
187 install -m644 docs/manpages/lmhosts.5 $RPM_BUILD_ROOT%{prefix}/man/man5
188 install -m644 docs/manpages/smbpasswd.5 $RPM_BUILD_ROOT%{prefix}/man/man5
189 install -m644 docs/manpages/samba.7 $RPM_BUILD_ROOT%{prefix}/man/man7
190 install -m644 docs/manpages/smbd.8 $RPM_BUILD_ROOT%{prefix}/man/man8
191 install -m644 docs/manpages/nmbd.8 $RPM_BUILD_ROOT%{prefix}/man/man8
192 install -m644 docs/manpages/swat.8 $RPM_BUILD_ROOT%{prefix}/man/man8
193 install -m644 docs/manpages/smbmnt.8 $RPM_BUILD_ROOT%{prefix}/man/man8
194 install -m644 docs/manpages/smbmount.8 $RPM_BUILD_ROOT%{prefix}/man/man8
195 install -m644 docs/manpages/smbpasswd.8 $RPM_BUILD_ROOT%{prefix}/man/man8
196 install -m644 docs/manpages/smbspool.8 $RPM_BUILD_ROOT%{prefix}/man/man8
197 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/smb.conf
198 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/smbusers
199 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
200 install -m755 packaging/RedHat/findsmb $RPM_BUILD_ROOT%{prefix}/bin
201 install -m755 packaging/RedHat/smbadduser $RPM_BUILD_ROOT%{prefix}/bin
202 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
203 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
204 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
205 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
206 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/lmhosts
207
208 %clean
209 rm -rf $RPM_BUILD_ROOT
210
211 %post
212 /sbin/chkconfig --add smb
213
214 # Build codepage load files
215 for i in 437 737 850 852 861 866 932 936 949 950
216 do
217 %{prefix}/bin/make_smbcodepage c $i /etc/codepages/src/codepage_def.$i /etc/codepages/codepage.$i
218 done
219
220 # Add swat entry to /etc/services if not already there
221 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
222         echo 'swat              901/tcp                         # Add swat service used via inetd' >> /etc/services
223 fi
224
225 # Add swat entry to /etc/inetd.conf if needed
226 if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
227         echo 'swat      stream  tcp     nowait.400      root    %{prefix}/sbin/swat swat' >> /etc/inetd.conf
228 killall -1 inetd || :
229 fi
230
231 %preun
232 if [ $1 = 0 ] ; then
233     /sbin/chkconfig --del smb
234
235     for n in /etc/codepages/*; do
236         if [ $n != /etc/codepages/src ]; then
237             rm -rf $n
238         fi
239     done
240     # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
241     if [ -e /var/lock/samba/browse.dat ]; then
242             rm -f /var/lock/samba/browse.dat
243     fi
244     if [ -e /var/lock/samba/wins.dat ]; then
245             rm -f /var/lock/samba/wins.dat
246     fi
247 fi
248
249 %postun
250 # Only delete remnants of samba if this is the final deletion.
251 if [ $1 = 0 ] ; then
252     if [ -x /etc/pam.d/samba ]; then
253       rm -f /etc/pam.d/samba
254     fi
255     if [ -e /var/log/samba ]; then
256       rm -rf /var/log/samba
257     fi
258     if [ -e /var/lock/samba ]; then
259       rm -rf /var/lock/samba
260     fi
261
262     # Remove swat entries from /etc/inetd.conf and /etc/services
263     cd /etc
264     tmpfile=/etc/tmp.$$
265     sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
266     mv $tmpfile inetd.conf
267     sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
268     mv $tmpfile services
269 fi
270
271 %triggerpostun -- samba < samba-2.0.0
272 if [ $0 != 0 ]; then
273     /sbin/chkconfig --add smb
274 fi
275
276
277 %files
278 %doc README COPYING Manifest Read-Manifest-Now
279 %doc WHATSNEW.txt Roadmap
280 %doc docs
281 %doc swat/README
282 %doc examples
283 %attr(-,root,root) %{prefix}/sbin/smbd
284 %attr(-,root,root) %{prefix}/sbin/nmbd
285 %attr(-,root,root) %{prefix}/sbin/swat
286 %attr(-,root,root) %{prefix}/sbin/smbmnt
287 %attr(-,root,root) %{prefix}/sbin/smbmount
288 %attr(-,root,root) %{prefix}/sbin/smbumount
289 %attr(-,root,root) /sbin/mount.smbfs
290 %attr(0750,root,root) %{prefix}/sbin/samba
291 %attr(-,root,root) %{prefix}/bin/addtosmbpass
292 %attr(-,root,root) %{prefix}/bin/mksmbpasswd.sh
293 %attr(-,root,root) %{prefix}/bin/smbclient
294 %attr(-,root,root) %{prefix}/bin/smbspool
295 %attr(-,root,root) %{prefix}/bin/rpcclient
296 %attr(-,root,root) %{prefix}/bin/testparm
297 %attr(-,root,root) %{prefix}/bin/testprns
298 %attr(-,root,root) %{prefix}/bin/findsmb
299 %attr(-,root,root) %{prefix}/bin/smbstatus
300 %attr(-,root,root) %{prefix}/bin/nmblookup
301 %attr(-,root,root) %{prefix}/bin/make_smbcodepage
302 %attr(-,root,root) %{prefix}/bin/make_printerdef
303 %attr(-,root,root) %{prefix}/bin/smbpasswd
304 %attr(-,root,root) %{prefix}/bin/smbtar
305 %attr(-,root,root) %{prefix}/bin/smbprint
306 %attr(-,root,root) %{prefix}/bin/smbadduser
307 %attr(-,root,root) %{prefix}/share/swat/help/welcome.html
308 %attr(-,root,root) %{prefix}/share/swat/help/DOMAIN_MEMBER.html
309 %attr(-,root,root) %{prefix}/share/swat/help/NT_Security.html
310 %attr(-,root,root) %{prefix}/share/swat/help/lmhosts.5.html
311 %attr(-,root,root) %{prefix}/share/swat/help/make_smbcodepage.1.html
312 %attr(-,root,root) %{prefix}/share/swat/help/nmbd.8.html
313 %attr(-,root,root) %{prefix}/share/swat/help/nmblookup.1.html
314 %attr(-,root,root) %{prefix}/share/swat/help/samba.7.html
315 %attr(-,root,root) %{prefix}/share/swat/help/smb.conf.5.html
316 %attr(-,root,root) %{prefix}/share/swat/help/smbclient.1.html
317 %attr(-,root,root) %{prefix}/share/swat/help/smbspool.8.html
318 %attr(-,root,root) %{prefix}/share/swat/help/smbd.8.html
319 %attr(-,root,root) %{prefix}/share/swat/help/smbpasswd.5.html
320 %attr(-,root,root) %{prefix}/share/swat/help/smbpasswd.8.html
321 %attr(-,root,root) %{prefix}/share/swat/help/smbrun.1.html
322 %attr(-,root,root) %{prefix}/share/swat/help/smbstatus.1.html
323 %attr(-,root,root) %{prefix}/share/swat/help/smbtar.1.html
324 %attr(-,root,root) %{prefix}/share/swat/help/swat.8.html
325 %attr(-,root,root) %{prefix}/share/swat/help/testparm.1.html
326 %attr(-,root,root) %{prefix}/share/swat/help/testprns.1.html
327 %attr(-,root,root) %{prefix}/share/swat/images/globals.gif
328 %attr(-,root,root) %{prefix}/share/swat/images/home.gif
329 %attr(-,root,root) %{prefix}/share/swat/images/passwd.gif
330 %attr(-,root,root) %{prefix}/share/swat/images/printers.gif
331 %attr(-,root,root) %{prefix}/share/swat/images/shares.gif
332 %attr(-,root,root) %{prefix}/share/swat/images/samba.gif
333 %attr(-,root,root) %{prefix}/share/swat/images/status.gif
334 %attr(-,root,root) %{prefix}/share/swat/images/viewconfig.gif
335 %attr(-,root,root) %{prefix}/share/swat/include/header.html
336 %attr(-,root,root) %{prefix}/share/swat/include/footer.html
337 %attr(-,root,root) %config(noreplace) /etc/lmhosts
338 %attr(-,root,root) %config(noreplace) /etc/smb.conf
339 %attr(-,root,root) %config(noreplace) /etc/smbusers
340 %attr(-,root,root) /etc/rc.d/init.d/smb
341 %attr(-,root,root) /etc/logrotate.d/samba
342 %attr(-,root,root) /etc/pam.d/samba
343 %attr(-,root,root) /etc/codepages/src/codepage_def.437
344 %attr(-,root,root) /etc/codepages/src/codepage_def.737
345 %attr(-,root,root) /etc/codepages/src/codepage_def.850
346 %attr(-,root,root) /etc/codepages/src/codepage_def.852
347 %attr(-,root,root) /etc/codepages/src/codepage_def.861
348 %attr(-,root,root) /etc/codepages/src/codepage_def.866
349 %attr(-,root,root) /etc/codepages/src/codepage_def.932
350 %attr(-,root,root) /etc/codepages/src/codepage_def.936
351 %attr(-,root,root) /etc/codepages/src/codepage_def.949
352 %attr(-,root,root) /etc/codepages/src/codepage_def.950
353 %attr(-,root,root) %{prefix}/man/man1/smbstatus.1
354 %attr(-,root,root) %{prefix}/man/man1/smbclient.1
355 %attr(-,root,root) %{prefix}/man/man1/make_smbcodepage.1
356 %attr(-,root,root) %{prefix}/man/man1/smbrun.1
357 %attr(-,root,root) %{prefix}/man/man1/smbtar.1
358 %attr(-,root,root) %{prefix}/man/man1/testparm.1
359 %attr(-,root,root) %{prefix}/man/man1/testprns.1
360 %attr(-,root,root) %{prefix}/man/man1/nmblookup.1
361 %attr(-,root,root) %{prefix}/man/man5/smb.conf.5
362 %attr(-,root,root) %{prefix}/man/man5/lmhosts.5
363 %attr(-,root,root) %{prefix}/man/man5/smbpasswd.5
364 %attr(-,root,root) %{prefix}/man/man7/samba.7
365 %attr(-,root,root) %{prefix}/man/man8/smbd.8
366 %attr(-,root,root) %{prefix}/man/man8/nmbd.8
367 %attr(-,root,root) %{prefix}/man/man8/smbpasswd.8
368 %attr(-,root,root) %{prefix}/man/man8/swat.8
369 %attr(-,root,root) %{prefix}/man/man8/smbmnt.8
370 %attr(-,root,root) %{prefix}/man/man8/smbmount.8
371 %attr(-,root,root) %{prefix}/man/man8/smbspool.8
372 %attr(-,root,nobody) %dir /home/samba
373 %attr(-,root,root) %dir /etc/codepages
374 %attr(-,root,root) %dir /etc/codepages/src
375 %attr(-,root,root) %dir /var/lock/samba
376 %attr(-,root,root) %dir /var/log/samba
377 %attr(1777,root,root) %dir /var/spool/samba