~ubuntu-branches/ubuntu/maverick/samba/maverick-proposed

« back to all changes in this revision

Viewing changes to packaging/RedHat/samba.spec

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-10-15 12:31:58 UTC
  • Revision ID: james.westby@ubuntu.com-20041015123158-aokykzdqkdgy6dfx
Tags: upstream-3.0.7
ImportĀ upstreamĀ versionĀ 3.0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## grab the major and minor version of rpm 
 
2
%define rpm_version `rpm --version | awk '{print $3}' | awk -F. '{print $1$2}'`
 
3
 
 
4
Summary: Samba SMB client and server
 
5
Vendor: Samba Team
 
6
Name: samba
 
7
Version: 3.0.7
 
8
Release: 1
 
9
License: GNU GPL version 2
 
10
Group: Networking
 
11
Source: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
 
12
 
 
13
# Don't depend on Net::LDAP
 
14
# one filter for RH 8 and one for 9
 
15
Source998: filter-requires-samba_rh8.sh
 
16
Source999: filter-requires-samba_rh9.sh
 
17
 
 
18
Packager: Gerald Carter [Samba-Team] <jerry@samba.org>
 
19
Requires: pam openldap krb5-libs 
 
20
BuildRequires: openldap-devel krb5-devel pam-devel
 
21
Prereq: chkconfig fileutils /sbin/ldconfig
 
22
Provides: samba = %{version}
 
23
Obsoletes: samba-common, samba-client, samba-swat
 
24
BuildRoot: %{_tmppath}/%{name}-%{version}-root
 
25
Prefix: /usr
 
26
 
 
27
%description
 
28
Samba provides an SMB/CIFS server which can be used to provide
 
29
network file and print services to SMB/CIFS clients, including 
 
30
various versions of MS Windows, OS/2, and other Linux machines. 
 
31
Samba also provides some SMB clients, which complement the 
 
32
built-in SMB filesystem in Linux. Samba uses NetBIOS over TCP/IP 
 
33
(NetBT) protocols and does NOT need NetBEUI (Microsoft Raw NetBIOS 
 
34
frame) protocol.
 
35
 
 
36
Samba 3.0 also introduces UNICODE support and kerberos/ldap
 
37
integration as a member server in a Windows 2000 domain.
 
38
 
 
39
Please refer to the WHATSNEW.txt document for fixup information.
 
40
docs directory for implementation details.
 
41
 
 
42
%changelog
 
43
* Mon Nov 18 2002 Gerald Carter <jerry@samba.org>
 
44
  - removed change log entries since history
 
45
    is being maintained in CVS
 
46
 
 
47
%prep
 
48
%setup
 
49
 
 
50
%build
 
51
 
 
52
# Working around perl dependency problem from docs
 
53
# Only > RH 8.0 seems to care here
 
54
 
 
55
echo "rpm_version == %{rpm_version}"
 
56
if [ "%{rpm_version}" == "42" ]; then
 
57
   %define __perl_requires %{SOURCE999}
 
58
   echo "%{__perl_requires}"
 
59
elif [ "%{rpm_version}" == "41" ]; then
 
60
   %define __find_requires %{SOURCE998}
 
61
   echo "%{__find_requires}"
 
62
fi
 
63
 
 
64
## Build main Samba source
 
65
cd source
 
66
 
 
67
%ifarch ia64
 
68
libtoolize --copy --force     # get it to recognize IA-64
 
69
autoheader
 
70
autoconf
 
71
EXTRA="-D_LARGEFILE64_SOURCE"
 
72
%endif
 
73
 
 
74
## Get number of cpu's, default for 1 cpu on error 
 
75
NUMCPU=`grep processor /proc/cpuinfo | wc -l`
 
76
if [ $NUMCPU -eq 0 ]; then
 
77
        NUMCPU=1;
 
78
fi 
 
79
 
 
80
## run autogen if missing the configure script
 
81
if [ ! -f "configure" ]; then
 
82
        ./autogen.sh
 
83
fi
 
84
 
 
85
CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
 
86
        --prefix=%{prefix} \
 
87
        --localstatedir=/var \
 
88
        --with-configdir=/etc/samba \
 
89
        --with-privatedir=/etc/samba \
 
90
        --with-fhs \
 
91
        --with-quotas \
 
92
        --with-smbmount \
 
93
        --with-pam \
 
94
        --with-pam_smbpass \
 
95
        --with-syslog \
 
96
        --with-utmp \
 
97
        --with-sambabook=%{prefix}/share/swat/using_samba \
 
98
        --with-swatdir=%{prefix}/share/swat \
 
99
        --with-libsmbclient 
 
100
make -j${NUMCPU} proto
 
101
make -j${NUMCPU} all nsswitch/libnss_wins.so 
 
102
make -j${NUMCPU} debug2html
 
103
 
 
104
# Remove some permission bits to avoid to many dependencies
 
105
find examples docs -type f | xargs -r chmod -x
 
106
 
 
107
%install
 
108
rm -rf $RPM_BUILD_ROOT
 
109
mkdir -p $RPM_BUILD_ROOT
 
110
mkdir -p $RPM_BUILD_ROOT/sbin
 
111
mkdir -p $RPM_BUILD_ROOT/etc/samba
 
112
mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
 
113
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
 
114
mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
 
115
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
 
116
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
 
117
mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
 
118
mkdir -p $RPM_BUILD_ROOT/var/lib/samba
 
119
mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
 
120
mkdir -p $RPM_BUILD_ROOT/var/spool/samba
 
121
mkdir -p $RPM_BUILD_ROOT/lib/security
 
122
mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
 
123
mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
 
124
 
 
125
# Install standard binary files
 
126
for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
 
127
        rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt net \
 
128
        smbcacls pdbedit tdbbackup smbtree ntlm_auth smbcquotas
 
129
do
 
130
        install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
 
131
done
 
132
 
 
133
for i in mksmbpasswd.sh smbtar findsmb
 
134
do
 
135
        install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
 
136
done
 
137
 
 
138
# Install secure binary files
 
139
for i in smbd nmbd swat smbmount smbumount debug2html winbindd 
 
140
do
 
141
        install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
 
142
done
 
143
 
 
144
# we need a symlink for mount to recognise the smb and smbfs filesystem types
 
145
ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
 
146
ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
 
147
 
 
148
# This allows us to get away without duplicating code that 
 
149
#  sombody else can maintain for us.  
 
150
cd source
 
151
make DESTDIR=$RPM_BUILD_ROOT \
 
152
        BASEDIR=/usr \
 
153
        CONFIGDIR=/etc/samba \
 
154
        LIBDIR=%{prefix}/lib/samba \
 
155
        VARDIR=/var \
 
156
        SBINDIR=%{prefix}/sbin \
 
157
        BINDIR=%{prefix}/bin \
 
158
        MANDIR=MANDIR_MACRO \
 
159
        SWATDIR=%{prefix}/share/swat \
 
160
        SAMBABOOK=%{prefix}/share/swat/using_samba \
 
161
        installman installswat installdat installmodules
 
162
cd ..
 
163
 
 
164
## don't duplicate the docs.  These are installed with SWAT
 
165
rm -rf docs/htmldocs
 
166
rm -rf docs/manpages
 
167
( cd docs; ln -s %{prefix}/share/swat/help htmldocs )
 
168
 
 
169
 
 
170
 
 
171
# Install the nsswitch wins library
 
172
install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
 
173
( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2 )
 
174
 
 
175
# Install winbind shared libraries
 
176
install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
 
177
( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2 )
 
178
install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
 
179
 
 
180
# Install pam_smbpass.so
 
181
install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
 
182
 
 
183
# libsmbclient
 
184
install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
 
185
install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
 
186
install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
 
187
 
 
188
# Install the miscellany
 
189
install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
 
190
install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
 
191
install -m755 packaging/RedHat/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
 
192
install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
 
193
install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
 
194
install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
 
195
install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
 
196
install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
 
197
install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
 
198
install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
 
199
echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
 
200
 
 
201
# Remove "*.old" files
 
202
find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
 
203
 
 
204
##
 
205
## Clean out man pages for tools not installed here
 
206
##
 
207
rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/editreg.1*
 
208
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/log2pcap.1*
 
209
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbsh.1*
 
210
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smbget.1*
 
211
rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/mount.cifs.8*
 
212
 
 
213
 
 
214
%clean
 
215
rm -rf $RPM_BUILD_ROOT
 
216
 
 
217
%post
 
218
## 
 
219
## only needed if this is a new install (not an upgrade)
 
220
##
 
221
if [ "$1" -eq "1" ]; then
 
222
        /sbin/chkconfig --add smb
 
223
        /sbin/chkconfig --add winbind
 
224
        /sbin/chkconfig smb off
 
225
        /sbin/chkconfig winbind off
 
226
fi
 
227
 
 
228
##
 
229
## we only have to wory about this if we are upgrading
 
230
##
 
231
if [ "$1" -eq "2" ]; then
 
232
        if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
 
233
                echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
 
234
                mv /etc/smb.conf /etc/samba/smb.conf
 
235
        fi
 
236
 
 
237
        if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
 
238
                echo "Moving old /etc/smbusers to /etc/samba/smbusers"
 
239
                mv /etc/smbusers /etc/samba/smbusers
 
240
        fi
 
241
 
 
242
        if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
 
243
                echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
 
244
                mv /etc/lmhosts /etc/samba/lmhosts
 
245
        fi
 
246
 
 
247
        if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
 
248
                echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
 
249
                mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
 
250
        fi
 
251
 
 
252
        if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
 
253
                echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
 
254
                mv /etc/smbpasswd /etc/samba/smbpasswd
 
255
        fi
 
256
 
 
257
        #
 
258
        # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
 
259
        # to preserve across reboots.
 
260
        #
 
261
        for i in /var/lock/samba/*.tdb; do
 
262
                if [ -f $i ]; then
 
263
                        newname="/var/lib/samba/`basename $i`"
 
264
                        echo "Moving $i to $newname"
 
265
                        mv $i $newname
 
266
                fi
 
267
        done
 
268
 
 
269
        #
 
270
        # For 3.0.1 we move the tdb files from /var/cache/samba to /var/lib/samba
 
271
        #
 
272
        echo "Moving tdb files in /var/cache/samba/*.tdb to /var/lib/samba/*.tdb"
 
273
        for i in /var/cache/samba/*.tdb; do
 
274
                if [ -f $i ]; then
 
275
                        newname="/var/lib/samba/`basename $i`"
 
276
                        echo "Moving $i to $newname"
 
277
                        mv $i $newname
 
278
                fi
 
279
        done
 
280
fi
 
281
 
 
282
##
 
283
## New things
 
284
##
 
285
 
 
286
# Add swat entry to /etc/services if not already there.
 
287
if [ ! "`grep ^\s**swat /etc/services`" ]; then
 
288
        echo 'swat              901/tcp                         # Add swat service used via inetd' >> /etc/services
 
289
fi
 
290
 
 
291
# Add swat entry to /etc/inetd.conf if needed.
 
292
if [ -f /etc/inetd.conf ]; then
 
293
        if [ ! "`grep ^\s*swat /etc/inetd.conf`" ]; then
 
294
                echo 'swat      stream  tcp     nowait.400      root    %{prefix}/sbin/swat swat' >> /etc/inetd.conf
 
295
        killall -HUP inetd || :
 
296
        fi
 
297
fi
 
298
 
 
299
# Add swat entry to xinetd.d if needed.
 
300
if [ -d /etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
 
301
        mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
 
302
else
 
303
        rm -f /etc/samba/samba.xinetd
 
304
fi
 
305
 
 
306
# Install the correct version of the samba pam file
 
307
if [ -f /lib/security/pam_stack.so ]; then
 
308
        echo "Installing stack version of /etc/pam.d/samba..."
 
309
        mv /etc/samba/samba.stack /etc/pam.d/samba
 
310
else
 
311
        echo "Installing non-stack version of /etc/pam.d/samba..."
 
312
        rm -f /etc/samba/samba.stack
 
313
fi
 
314
 
 
315
## call ldconfig to create the version symlink for libsmbclient.so
 
316
/sbin/ldconfig
 
317
 
 
318
%preun
 
319
if [ "$1" -eq "0" ] ; then
 
320
        /sbin/chkconfig --del smb
 
321
        /sbin/chkconfig --del winbind
 
322
 
 
323
        # We want to remove the browse.dat and wins.dat files 
 
324
        # so they can not interfer with a new version of samba!
 
325
        if [ -e /var/lib/samba/browse.dat ]; then
 
326
                rm -f /var/lib/samba/browse.dat
 
327
        fi
 
328
        if [ -e /var/lib/samba/wins.dat ]; then
 
329
                rm -f /var/lib/samba/wins.dat
 
330
        fi
 
331
 
 
332
        # Remove the transient tdb files.
 
333
        if [ -e /var/lib/samba/brlock.tdb ]; then
 
334
                rm -f /var/lib/samba/brlock.tdb
 
335
        fi
 
336
 
 
337
        if [ -e /var/lib/samba/unexpected.tdb ]; then
 
338
                rm -f /var/lib/samba/unexpected.tdb
 
339
        fi
 
340
 
 
341
        if [ -e /var/lib/samba/connections.tdb ]; then
 
342
                rm -f /var/lib/samba/connections.tdb
 
343
        fi
 
344
 
 
345
        if [ -e /var/lib/samba/locking.tdb ]; then
 
346
                rm -f /var/lib/samba/locking.tdb
 
347
        fi
 
348
 
 
349
        if [ -e /var/lib/samba/messages.tdb ]; then
 
350
                rm -f /var/lib/samba/messages.tdb
 
351
        fi
 
352
fi
 
353
 
 
354
%postun
 
355
# Only delete remnants of samba if this is the final deletion.
 
356
if [ "$1" -eq  "0" ] ; then
 
357
    if [ -x /etc/pam.d/samba ]; then
 
358
      rm -f /etc/pam.d/samba
 
359
    fi
 
360
 
 
361
    if [ -e /var/log/samba ]; then
 
362
      rm -rf /var/log/samba
 
363
    fi
 
364
 
 
365
    if [ -e /var/lib/samba ]; then
 
366
      rm -rf /var/lib/samba
 
367
    fi
 
368
 
 
369
    # Remove swat entries from /etc/inetd.conf and /etc/services
 
370
    cd /etc
 
371
    tmpfile=/etc/tmp.$$
 
372
    if [ -f /etc/inetd.conf ]; then
 
373
      # preserve inetd.conf permissions.
 
374
      cp -p /etc/inetd.conf $tmpfile
 
375
      sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
 
376
      mv $tmpfile inetd.conf
 
377
    fi
 
378
 
 
379
    # preserve services permissions.
 
380
    cp -p /etc/services $tmpfile
 
381
    sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
 
382
    mv $tmpfile /etc/services
 
383
 
 
384
    # Remove swat entry from /etc/xinetd.d
 
385
    if [ -f /etc/xinetd.d/swat ]; then
 
386
      rm -r /etc/xinetd.d/swat
 
387
    fi
 
388
fi
 
389
 
 
390
/sbin/ldconfig
 
391
 
 
392
%files
 
393
%defattr(-,root,root)
 
394
%doc README COPYING Manifest Read-Manifest-Now
 
395
%doc WHATSNEW.txt Roadmap
 
396
%doc docs
 
397
%doc examples
 
398
%{prefix}/sbin/smbd
 
399
%{prefix}/sbin/nmbd
 
400
%{prefix}/sbin/swat
 
401
%{prefix}/bin/smbmnt
 
402
%{prefix}/sbin/smbmount
 
403
%{prefix}/sbin/smbumount
 
404
%{prefix}/sbin/winbindd
 
405
%{prefix}/sbin/samba
 
406
%{prefix}/sbin/debug2html
 
407
/sbin/mount.smbfs
 
408
/sbin/mount.smb
 
409
%{prefix}/bin/mksmbpasswd.sh
 
410
%{prefix}/bin/smbclient
 
411
%{prefix}/bin/smbspool
 
412
%{prefix}/bin/rpcclient
 
413
%{prefix}/bin/testparm
 
414
%{prefix}/bin/testprns
 
415
%{prefix}/bin/findsmb
 
416
%{prefix}/bin/smbstatus
 
417
%{prefix}/bin/nmblookup
 
418
%{prefix}/bin/smbpasswd
 
419
%{prefix}/bin/smbtar
 
420
%{prefix}/bin/smbprint
 
421
%{prefix}/bin/smbcontrol
 
422
%{prefix}/bin/wbinfo
 
423
%{prefix}/bin/net
 
424
%{prefix}/bin/ntlm_auth
 
425
%{prefix}/bin/smbcquotas
 
426
%{prefix}/bin/smbcacls
 
427
%{prefix}/bin/pdbedit
 
428
%{prefix}/bin/tdbbackup
 
429
%{prefix}/bin/smbtree
 
430
%attr(755,root,root) /lib/libnss_wins.s*
 
431
%attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
 
432
%attr(755,root,root) %{prefix}/lib/samba/charset/*.so
 
433
#%attr(755,root,root) %{prefix}/lib/samba/pdb/*.so
 
434
%attr(755,root,root) %{prefix}/lib/samba/*.dat
 
435
%attr(755,root,root) %{prefix}/lib/samba/*.msg
 
436
%{prefix}/include/libsmbclient.h
 
437
%{prefix}/lib/libsmbclient.a
 
438
%{prefix}/lib/libsmbclient.so
 
439
%{prefix}/share/swat/help/*
 
440
%{prefix}/share/swat/images/*
 
441
%{prefix}/share/swat/include/*.html
 
442
%{prefix}/share/swat/lang/*/help/*
 
443
%{prefix}/share/swat/lang/*/images/*
 
444
%{prefix}/share/swat/lang/*/include/*.html
 
445
%{prefix}/share/swat/using_samba/*
 
446
%config(noreplace) /etc/samba/lmhosts
 
447
%config(noreplace) /etc/samba/smb.conf
 
448
%config(noreplace) /etc/samba/smbusers
 
449
/etc/samba/samba.stack
 
450
/etc/samba/samba.xinetd
 
451
/etc/rc.d/init.d/smb
 
452
/etc/rc.d/init.d/winbind
 
453
/etc/logrotate.d/samba
 
454
%config(noreplace) /etc/pam.d/samba
 
455
MANDIR_MACRO/man1/*
 
456
MANDIR_MACRO/man5/*
 
457
MANDIR_MACRO/man7/*
 
458
MANDIR_MACRO/man8/*
 
459
%attr(755,root,root) %dir /var/lib/samba
 
460
%dir /var/log/samba
 
461
%dir /var/run/samba
 
462
%attr(1777,root,root) %dir /var/spool/samba
 
463
%attr(-,root,root) /lib/libnss_winbind.so*
 
464
%attr(-,root,root) /lib/security/pam_winbind.so
 
465
%attr(-,root,root) /lib/security/pam_smbpass.so