1 ## grab the major and minor version of rpm
2 %define rpm_version `rpm --version | awk '{print $3}' | awk -F. '{print $1$2}'`
4 Summary: Samba SMB client and server
8 License: GNU GPL version 2
10 Source: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
12 # Don't depend on Net::LDAP
13 # one filter for RH 8 and one for 9
14 Source998: filter-requires-samba_rh8.sh
15 Source999: filter-requires-samba_rh9.sh
17 Packager: Gerald Carter [Samba-Team] <jerry@samba.org>
18 Requires: pam >= 0.72 kernel >= 2.2.1 glibc >= 2.1.2
19 Prereq: chkconfig fileutils /sbin/ldconfig
20 Provides: samba = %{version}
21 Obsoletes: samba-common, samba-client, samba-swat
22 BuildRoot: %{_tmppath}/%{name}-%{version}-root
26 Samba provides an SMB/CIFS server which can be used to provide
27 network file and print services to SMB/CIFS clients, including
28 various versions of MS Windows, OS/2, and other Linux machines.
29 Samba also provides some SMB clients, which complement the
30 built-in SMB filesystem in Linux. Samba uses NetBIOS over TCP/IP
31 (NetBT) protocols and does NOT need NetBEUI (Microsoft Raw NetBIOS
34 Samba 3.0 also introduces UNICODE support and kerberos/ldap
35 integration as a member server in a Windows 2000 domain.
37 Please refer to the WHATSNEW.txt document for fixup information.
38 docs directory for implementation details.
41 * Mon Nov 18 2002 Gerald Carter <jerry@samba.org>
42 - removed change log entries since history
43 is being maintained in CVS
50 # Working around perl dependency problem from docs
51 # Only > RH 8.0 seems to care here
53 echo "rpm_version == %{rpm_version}"
54 if [ "%{rpm_version}" == "42" ]; then
55 %define __perl_requires %{SOURCE999}
56 echo "%{__perl_requires}"
57 elif [ "%{rpm_version}" == "41" ]; then
58 %define __find_requires %{SOURCE998}
59 echo "%{__find_requires}"
62 ## Build main Samba source
66 libtoolize --copy --force # get it to recognize IA-64
69 EXTRA="-D_LARGEFILE64_SOURCE"
71 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
72 if [ ! -f "configure" ]; then
75 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
77 --localstatedir=/var \
78 --with-configdir=/etc/samba \
79 --with-privatedir=/etc/samba \
87 --with-sambabook=%{prefix}/share/swat/using_samba \
88 --with-swatdir=%{prefix}/share/swat \
90 make -j${NUMCPU} proto
91 make -j${NUMCPU} all nsswitch/libnss_wins.so modules
92 make -j${NUMCPU} debug2html
93 make -j${NUMCPU} bin/smbspool
95 # Remove some permission bits to avoid to many dependencies
96 find examples docs -type f | xargs -r chmod -x
99 rm -rf $RPM_BUILD_ROOT
100 mkdir -p $RPM_BUILD_ROOT
101 mkdir -p $RPM_BUILD_ROOT/sbin
102 mkdir -p $RPM_BUILD_ROOT/etc/samba
103 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
104 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
105 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
106 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
107 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
108 mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
109 mkdir -p $RPM_BUILD_ROOT/var/cache/samba
110 mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
111 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
112 mkdir -p $RPM_BUILD_ROOT/lib/security
113 mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
114 mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
116 # Install standard binary files
117 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
118 rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt net \
119 smbcacls pdbedit tdbbackup smbtree ntlm_auth smbcquotas
121 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
124 for i in mksmbpasswd.sh smbtar findsmb
126 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
129 # Install secure binary files
130 for i in smbd nmbd swat smbmount smbumount debug2html winbindd
132 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
135 # we need a symlink for mount to recognise the smb and smbfs filesystem types
136 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
137 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
139 # This allows us to get away without duplicating code that
140 # sombody else can maintain for us.
142 make DESTDIR=$RPM_BUILD_ROOT \
144 CONFIGDIR=/etc/samba \
145 LIBDIR=%{prefix}/lib/samba \
147 SBINDIR=%{prefix}/sbin \
148 BINDIR=%{prefix}/bin \
149 MANDIR=MANDIR_MACRO \
150 SWATDIR=%{prefix}/share/swat \
151 SAMBABOOK=%{prefix}/share/swat/using_samba \
152 installman installswat installdat installmodules
155 # Install the nsswitch wins library
156 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
157 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2; )
159 # Install winbind shared libraries
160 install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
161 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2; )
162 install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
164 # Install pam_smbpass.so
165 install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
168 install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
169 install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
170 install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
172 # Install the miscellany
173 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
174 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
175 install -m755 packaging/RedHat/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
176 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
177 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
178 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
179 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
180 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
181 install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
182 install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
183 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
185 # Remove "*.old" files
186 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
189 rm -rf $RPM_BUILD_ROOT
192 if [ "$1" -eq "1" ]; then
193 /sbin/chkconfig --add smb
194 /sbin/chkconfig --add winbind
195 /sbin/chkconfig smb off
196 /sbin/chkconfig winbind off
199 echo "Looking for old /etc/smb.conf..."
200 if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
201 echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
202 mv /etc/smb.conf /etc/samba/smb.conf
205 echo "Looking for old /etc/smbusers..."
206 if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
207 echo "Moving old /etc/smbusers to /etc/samba/smbusers"
208 mv /etc/smbusers /etc/samba/smbusers
211 echo "Looking for old /etc/lmhosts..."
212 if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
213 echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
214 mv /etc/lmhosts /etc/samba/lmhosts
217 echo "Looking for old /etc/MACHINE.SID..."
218 if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
219 echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
220 mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
223 echo "Looking for old /etc/smbpasswd..."
224 if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
225 echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
226 mv /etc/smbpasswd /etc/samba/smbpasswd
230 # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
231 # to preserve across reboots.
233 echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
234 for i in /var/lock/samba/*.tdb
237 newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
238 echo "Moving $i to $newname"
243 # Remove the transient tdb files.
244 if [ -e /var/cache/samba/brlock.tdb ]; then
245 rm -f /var/cache/samba/brlock.tdb
248 if [ -e /var/cache/samba/unexpected.tdb ]; then
249 rm -f /var/cache/samba/unexpected.tdb
252 if [ -e /var/cache/samba/connections.tdb ]; then
253 rm -f /var/cache/samba/connections.tdb
256 if [ -e /var/cache/samba/locking.tdb ]; then
257 rm -f /var/cache/samba/locking.tdb
260 if [ -e /var/cache/samba/messages.tdb ]; then
261 rm -f /var/cache/samba/messages.tdb
264 if [ -d /var/lock/samba ]; then
265 rm -rf /var/lock/samba
268 # Add swat entry to /etc/services if not already there.
269 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
270 echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
273 # Add swat entry to /etc/inetd.conf if needed.
274 if [ -f /etc/inetd.conf ]; then
275 if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
276 echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
277 killall -1 inetd || :
281 # Add swat entry to xinetd.d if needed.
282 if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
283 mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
285 rm -f /etc/samba/samba.xinetd
288 # Install the correct version of the samba pam file, depending on pam version.
289 if [ -f /lib/security/pam_stack.so ]; then
290 echo "Installing stack version of /etc/pam.d/samba..."
291 mv /etc/samba/samba.stack /etc/pam.d/samba
293 echo "Installing non-stack version of /etc/pam.d/samba..."
294 rm -f /etc/samba/samba.stack
297 ## call ldconfig to create the version symlink for libsmbclient.so
302 /sbin/chkconfig --del smb
303 /sbin/chkconfig --del winbind
305 # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
306 if [ -e /var/cache/samba/browse.dat ]; then
307 rm -f /var/cache/samba/browse.dat
309 if [ -e /var/cache/samba/wins.dat ]; then
310 rm -f /var/cache/samba/wins.dat
313 # Remove the transient tdb files.
314 if [ -e /var/cache/samba/brlock.tdb ]; then
315 rm -f /var/cache/samba/brlock.tdb
318 if [ -e /var/cache/samba/unexpected.tdb ]; then
319 rm -f /var/cache/samba/unexpected.tdb
322 if [ -e /var/cache/samba/connections.tdb ]; then
323 rm -f /var/cache/samba/connections.tdb
326 if [ -e /var/cache/samba/locking.tdb ]; then
327 rm -f /var/cache/samba/locking.tdb
330 if [ -e /var/cache/samba/messages.tdb ]; then
331 rm -f /var/cache/samba/messages.tdb
334 # Remove winbind nss client symlink
336 if [ -L /lib/libnss_winbind.so.2 ]; then
337 rm -f /lib/libnss_winbind.so.2
342 # Only delete remnants of samba if this is the final deletion.
344 if [ -x /etc/pam.d/samba ]; then
345 rm -f /etc/pam.d/samba
347 if [ -e /var/log/samba ]; then
348 rm -rf /var/log/samba
350 if [ -e /var/cache/samba ]; then
351 rm -rf /var/cache/samba
354 # Remove swat entries from /etc/inetd.conf and /etc/services
357 if [ -f /etc/inetd.conf ]; then
358 # preserve inetd.conf permissions.
359 cp -p /etc/inetd.conf $tmpfile
360 sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
361 mv $tmpfile inetd.conf
363 # preserve services permissions.
364 cp -p /etc/services $tmpfile
365 sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
366 mv $tmpfile /etc/services
368 # Remove swat entry from /etc/xinetd.d
369 if [ -f /etc/xinetd.d/swat ]; then
370 rm -r /etc/xinetd.d/swat
377 %defattr(-,root,root)
378 %doc README COPYING Manifest Read-Manifest-Now
379 %doc WHATSNEW.txt Roadmap
386 %{prefix}/sbin/smbmount
387 %{prefix}/sbin/smbumount
388 %{prefix}/sbin/winbindd
390 %{prefix}/sbin/debug2html
393 %{prefix}/bin/mksmbpasswd.sh
394 %{prefix}/bin/smbclient
395 %{prefix}/bin/smbspool
396 %{prefix}/bin/rpcclient
397 %{prefix}/bin/testparm
398 %{prefix}/bin/testprns
399 %{prefix}/bin/findsmb
400 %{prefix}/bin/smbstatus
401 %{prefix}/bin/nmblookup
402 %{prefix}/bin/smbpasswd
404 %{prefix}/bin/smbprint
405 %{prefix}/bin/smbcontrol
408 %{prefix}/bin/ntlm_auth
409 %{prefix}/bin/smbcquotas
410 %{prefix}/bin/smbcacls
411 %{prefix}/bin/pdbedit
412 %{prefix}/bin/tdbbackup
413 %{prefix}/bin/smbtree
414 %attr(755,root,root) /lib/libnss_wins.s*
415 %attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
416 %attr(755,root,root) %{prefix}/lib/samba/charset/*.so
417 #%attr(755,root,root) %{prefix}/lib/samba/pdb/*.so
418 %attr(755,root,root) %{prefix}/lib/samba/*.dat
419 %attr(755,root,root) %{prefix}/lib/samba/*.msg
420 %{prefix}/include/libsmbclient.h
421 %{prefix}/lib/libsmbclient.a
422 %{prefix}/lib/libsmbclient.so
423 %{prefix}/share/swat/help/*
424 %{prefix}/share/swat/images/*
425 %{prefix}/share/swat/include/*.html
426 %{prefix}/share/swat/lang/*/help/*
427 %{prefix}/share/swat/lang/*/images/*
428 %{prefix}/share/swat/lang/*/include/*.html
429 %{prefix}/share/swat/using_samba/*
430 %attr(755,root,root) %{prefix}/lib/samba/*.msg
431 %config(noreplace) /etc/samba/lmhosts
432 %config(noreplace) /etc/samba/smb.conf
433 %config(noreplace) /etc/samba/smbusers
434 /etc/samba/samba.stack
435 /etc/samba/samba.xinetd
437 /etc/rc.d/init.d/winbind
438 /etc/logrotate.d/samba
439 %config(noreplace) /etc/pam.d/samba
444 %attr(755,root,root) %dir /var/cache/samba
447 %attr(1777,root,root) %dir /var/spool/samba
448 %attr(-,root,root) /lib/libnss_winbind.so
449 %attr(-,root,root) /lib/security/pam_winbind.so
450 %attr(-,root,root) /lib/security/pam_smbpass.so