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