750b88e3925eb1cb8536adad685a7d3b84ae6e17
[sfrench/samba-autobuild/.git] / packaging / Mandrake / 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 %changelog
42 * Mon Apr 23 2001 Gerald (Jerry) Carter <jerry@samba.org>
43   - Added a few bug fixes to release the first Mandrake RPMS
44
45 * Sat Apr 14 2001 John H Terpstra <jht@samba.org>
46   - Added official samba-team support for Mandrakesoft
47         - We get a lot of requests for this!
48
49 %prep
50 %setup
51
52 %build
53 cd source
54
55 %ifarch ia64
56 libtoolize --copy --force     # get it to recognize IA-64
57 autoconf
58 autoheader
59 EXTRA="-D_LARGEFILE64_SOURCE"
60 %endif
61
62 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
63
64 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
65         --prefix=%{prefix} \
66         --with-fhs \
67         --libdir=/etc \
68         --localstatedir=/var \
69         --with-configdir=/etc \
70         --with-lockdir=/var/lock/samba \
71         --with-swatdir=%{prefix}/share/swat \
72         --with-quotas \
73         --with-smbmount \
74         --with-pam \
75         --with-syslog \
76         --with-utmp \
77         --with-netatalk \
78         --with-sambabook=%{prefix}/share/swat/using_samba
79
80 make -j${NUMCPU} proto
81 make -j${NUMCPU} all smbfilter nsswitch/libnss_wins.so debug2html
82
83 %install
84 rm -rf $RPM_BUILD_ROOT
85 mkdir -p $RPM_BUILD_ROOT
86 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba,xinetd.d,codepages/src}
87 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
88 mkdir -p $RPM_BUILD_ROOT/lib
89 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
90 mkdir -p $RPM_BUILD_ROOT/home/samba
91 mkdir -p $RPM_BUILD_ROOT/sbin
92 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include}
93 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
94 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/man/{man1,man5,man7,man8}
95 mkdir -p $RPM_BUILD_ROOT/var/lock/samba
96 mkdir -p $RPM_BUILD_ROOT/var/log/samba
97 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
98
99 # Install standard binary files
100 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
101       make_smbcodepage make_unicodemap make_printerdef rpcclient smbspool
102 do
103 install -m755 -s source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
104 done
105 for i in smbtar 
106 do
107 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
108 done
109
110 # Install secure binary files
111 for i in smbd nmbd swat smbmount smbumount smbmnt debug2html \
112       smbfilter
113 do
114 install -m755 -s source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
115 done
116
117 # we need a symlink for mount to recognise the smb and smbfs filesystem types
118 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
119 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
120
121 # Install level 1 man pages
122 for i in *.1
123 do
124 install -m644 docs/manpages/$i $RPM_BUILD_ROOT%{prefix}/share/man/man1
125 done
126  
127 # Install codepage source files
128 for i in 437 737 775 850 852 861 866 932 936 949 950 1251
129 do
130 install -m644 source/codepages/codepage_def.$i $RPM_BUILD_ROOT/etc/codepages/src
131 done
132 for i in 437 737 850 852 861 866 932 936 949 950 ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
133 do
134 install -m644 source/codepages/CP$i.TXT $RPM_BUILD_ROOT/etc/codepages/src
135 done
136
137 # Install the nsswitch library extenstion file
138 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
139 # Make link for wins resolver
140 ( cd $RPM_BUILD_ROOT/lib; ln -s libnss_wins.so libnss_wins.so.2; )
141
142 # Install SWAT helper files
143 for i in swat/help/*.html docs/htmldocs/*.html
144 do
145 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
146 done
147 for i in swat/images/*.gif
148 do
149 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
150 done
151 for i in swat/include/*.html
152 do
153 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
154 done
155
156 # This is the O'Reily Samba Book - on-line
157 for i in docs/htmldocs/using_samba/*.html
158 do
159 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba
160 done
161 for i in docs/htmldocs/using_samba/figs/*.gif
162 do
163 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/figs
164 done
165 for i in docs/htmldocs/using_samba/gifs/*.gif
166 do
167 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/gifs
168 done
169
170 # Install the miscellany
171 install -m644 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat
172 install -m644 docs/manpages/smb.conf.5 $RPM_BUILD_ROOT%{prefix}/share/man/man5
173 install -m644 docs/manpages/lmhosts.5 $RPM_BUILD_ROOT%{prefix}/share/man/man5
174 install -m644 docs/manpages/smbpasswd.5 $RPM_BUILD_ROOT%{prefix}/share/man/man5
175 install -m644 docs/manpages/samba.7 $RPM_BUILD_ROOT%{prefix}/share/man/man7
176 install -m644 docs/manpages/smbd.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
177 install -m644 docs/manpages/nmbd.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
178 install -m644 docs/manpages/smbpasswd.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
179 install -m644 docs/manpages/swat.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
180 install -m644 docs/manpages/smbmount.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
181 install -m644 docs/manpages/smbmnt.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
182 install -m644 docs/manpages/smbumount.8 $RPM_BUILD_ROOT%{prefix}/share/man/man8
183 install -m644 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat
184 install -m644 packaging/Mandrake/smb.con* $RPM_BUILD_ROOT/etc/
185 install -m644 packaging/Mandrake/smbusers $RPM_BUILD_ROOT/etc/smbusers
186 install -m755 packaging/Mandrake/smbprint $RPM_BUILD_ROOT%{prefix}/bin
187 install -m755 packaging/Mandrake/findsmb $RPM_BUILD_ROOT%{prefix}/bin
188 install -m755 packaging/Mandrake/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
189 install -m755 packaging/Mandrake/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
190 install -m644 packaging/Mandrake/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
191 install -m644 packaging/Mandrake/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
192 install -m644 packaging/Mandrake/samba.xinetd $RPM_BUILD_ROOT/etc/xinetd.d/swat
193 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/lmhosts
194
195 # Link smbmount to /sbin/mount.smb and /sbin/mount.smbfs
196 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
197 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
198
199 %clean
200 rm -rf $RPM_BUILD_ROOT
201
202 %post
203 /sbin/chkconfig --add smb
204 /sbin/chkconfig smb off
205
206 # Build codepage load files
207 cd /etc
208 for i in 437 737 775 850 852 861 866 932 936 949 950 1251
209 do
210 %{prefix}/bin/make_smbcodepage c $i /etc/codepages/src/codepage_def.$i /etc/codepages/codepage.$i
211 done
212 for i in 437 737 850 852 861 866 932 936 949 950 ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
213 do
214 %{prefix}/bin/make_unicodemap $i /etc/codepages/src/CP$i.TXT /etc/codepages/unicode_map.$i
215 done
216
217 # Add swat entry to /etc/services if not already there
218 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
219         echo 'swat              901/tcp                         # Add swat service used via inetd' >> /etc/services
220 fi
221
222 # Add swat entry to /etc/inetd.conf if needed
223 if [ -f /etc/inetd.conf ]; then
224         if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
225                 echo '#swat     stream  tcp     nowait.400      root    %{prefix}/sbin/swat swat' >> /etc/inetd.conf
226         killall -1 inetd || :
227         fi
228 fi
229
230 %preun
231 if [ $1 = 0 ] ; then
232     /sbin/chkconfig --del smb
233
234     # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
235     if [ -e /var/lock/samba/browse.dat ]; then
236             rm -f /var/lock/samba/browse.dat
237     fi
238     if [ -e /var/lock/samba/wins.dat ]; then
239             rm -f /var/lock/samba/wins.dat
240     fi
241 fi
242
243 %postun
244 # Only delete remnants of samba if this is the final deletion.
245 if [ $1 = 0 ] ; then
246     if [ -x /etc/pam.d/samba ]; then
247       rm -f /etc/pam.d/samba
248     fi
249     if [ -e /var/log/samba ]; then
250       rm -rf /var/log/samba
251     fi
252     if [ -e /var/lock/samba ]; then
253       rm -rf /var/lock/samba
254     fi
255
256     # Remove swat entries from /etc/inetd.conf and /etc/services
257     cd /etc
258     tmpfile=/etc/tmp.$$
259         if [ -f /etc/inetd.conf ]; then
260       sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
261       mv $tmpfile inetd.conf
262         fi
263     sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
264     mv $tmpfile services
265 fi
266
267 %triggerpostun -- samba < samba-2.0.0
268 if [ $0 != 0 ]; then
269     /sbin/chkconfig --add smb
270 fi
271
272 %files
273 %doc README COPYING Manifest Read-Manifest-Now
274 %doc WHATSNEW.txt Roadmap
275 %doc docs
276 %doc swat/README
277 %doc examples
278 %attr(-,root,root) %{prefix}/sbin/*
279 %attr(-,root,root) /sbin/*
280 %attr(-,root,root) %{prefix}/bin/*
281 %attr(755,root,root) /lib/*
282 %attr(-,root,root) %{prefix}/share/swat/help/*
283 %attr(-,root,root) %{prefix}/share/swat/images/*
284 %attr(-,root,root) %{prefix}/share/swat/include/*
285 %attr(-,root,root) %{prefix}/share/swat/using_samba/*
286 %attr(-,root,root) %config(noreplace) /etc/lmhosts
287 %attr(-,root,root) %config(noreplace) /etc/smb.conf
288 %attr(-,root,root) %config(noreplace) /etc/smbusers
289 %attr(-,root,root) /etc/rc.d/init.d/smb
290 %attr(-,root,root) /etc/logrotate.d/samba
291 %attr(-,root,root) %config(noreplace) /etc/pam.d/samba
292 %attr(-,root,root) %{prefix}/share/man/man1/*
293 %attr(-,root,root) %{prefix}/share/man/man5/*
294 %attr(-,root,root) %{prefix}/share/man/man7/*
295 %attr(-,root,root) %{prefix}/share/man/man8/*
296 %attr(-,root,root) %dir /etc/codepages/*
297 %attr(-,root,root) %dir /etc/codepages/src/*
298 %attr(-,root,root) %dir /var/lock/samba
299 %attr(-,root,root) %dir /var/log/samba
300 %attr(1777,root,root) %dir /var/spool/samba
301
302
303