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