1 Summary: Samba SMB client and server
5 License: GNU GPL version 2
7 Source: http://download.samba.org/samba/ftp/samba-%{version}.tar.bz2
8 Packager: Gerald Carter [Samba-Team] <jerry@samba.org>
9 Requires: pam >= 0.72 kernel >= 2.2.1 glibc >= 2.1.2
10 Prereq: chkconfig fileutils
11 Provides: samba = %{version}
12 Obsoletes: samba-common, samba-client, samba-swat
13 BuildRoot: %{_tmppath}/%{name}-%{version}-root
17 Samba provides an SMB/CIFS server which can be used to provide
18 network file and print services to SMB/CIFS clients, including
19 various versions of MS Windows, OS/2, and other Linux machines.
20 Samba also provides some SMB clients, which complement the
21 built-in SMB filesystem in Linux. Samba uses NetBIOS over TCP/IP
22 (NetBT) protocols and does NOT need NetBEUI (Microsoft Raw NetBIOS
25 Samba 3.0 also introduces UNICODE support and kerberos/ldap
26 integration as a member server in a Windows 2000 domain.
28 Please refer to the WHATSNEW.txt document for fixup information.
29 docs directory for implementation details.
32 * Mon Nov 18 2002 Gerald Carter <jerry@samba.org>
33 - removed change log entries since history
34 is being maintained in CVS
40 ## Build main Samba source
44 libtoolize --copy --force # get it to recognize IA-64
47 EXTRA="-D_LARGEFILE64_SOURCE"
49 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
50 if [ ! -f "configure" ]; then
53 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
55 --localstatedir=/var \
56 --with-configdir=/etc/samba \
57 --with-privatedir=/etc/samba \
65 --with-sambabook=%{prefix}/share/swat/using_samba \
66 --with-swatdir=%{prefix}/share/swat \
68 make -j${NUMCPU} proto
69 make -j${NUMCPU} all nsswitch/libnss_wins.so modules
70 make -j${NUMCPU} debug2html
71 make -j${NUMCPU} bin/smbspool
73 # Remove some permission bits to avoid to many dependencies
74 find examples docs -type f | xargs -r chmod -x
77 rm -rf $RPM_BUILD_ROOT
78 mkdir -p $RPM_BUILD_ROOT
79 mkdir -p $RPM_BUILD_ROOT/sbin
80 mkdir -p $RPM_BUILD_ROOT/etc/samba
81 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
82 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
83 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
84 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
85 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
86 mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
87 mkdir -p $RPM_BUILD_ROOT/var/cache/samba
88 mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
89 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
90 mkdir -p $RPM_BUILD_ROOT/lib/security
91 mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
92 mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
94 # Install standard binary files
95 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
96 rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt net \
97 smbcacls pdbedit tdbbackup smbtree
99 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
102 for i in mksmbpasswd.sh smbtar findsmb
104 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
107 # Install secure binary files
108 for i in smbd nmbd swat smbmount smbumount debug2html winbindd
110 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
113 # we need a symlink for mount to recognise the smb and smbfs filesystem types
114 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
115 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
117 # This allows us to get away without duplicating code that
118 # sombody else can maintain for us.
120 make DESTDIR=$RPM_BUILD_ROOT \
122 CONFIGDIR=/etc/samba \
123 LIBDIR=%{prefix}/lib/samba \
125 SBINDIR=%{prefix}/sbin \
126 BINDIR=$%{prefix}/bin \
127 MANDIR=MANDIR_MACRO \
128 SWATDIR=%{prefix}/share/swat \
129 SAMBABOOK=%{prefix}/share/swat/using_samba \
130 installman installswat installdat installmodules
133 # Install the nsswitch wins library
134 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
135 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2; )
137 # Install winbind shared libraries
138 install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
139 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2; )
140 install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
142 # Install pam_smbpass.so
143 install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
146 install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
147 install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
148 install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
150 # Install SWAT helper files
151 #for i in swat/help/*.html docs/htmldocs/*.html
153 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
155 #for i in swat/images/*.gif
157 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
159 #for i in swat/include/*.html
161 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
164 # Install the miscellany
165 install -m755 swat/README $RPM_BUILD_ROOT%{prefix}/share/swat/README
166 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
167 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
168 install -m755 packaging/RedHat/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
169 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
170 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
171 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
172 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
173 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
174 install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
175 install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
176 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
178 # Remove "*.old" files
179 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
182 rm -rf $RPM_BUILD_ROOT
185 if [ "$1" -eq "1" ]; then
186 /sbin/chkconfig --add smb
187 /sbin/chkconfig --add winbind
188 /sbin/chkconfig smb off
189 /sbin/chkconfig winbind off
192 echo "Looking for old /etc/smb.conf..."
193 if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
194 echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
195 mv /etc/smb.conf /etc/samba/smb.conf
198 echo "Looking for old /etc/smbusers..."
199 if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
200 echo "Moving old /etc/smbusers to /etc/samba/smbusers"
201 mv /etc/smbusers /etc/samba/smbusers
204 echo "Looking for old /etc/lmhosts..."
205 if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
206 echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
207 mv /etc/lmhosts /etc/samba/lmhosts
210 echo "Looking for old /etc/MACHINE.SID..."
211 if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
212 echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
213 mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
216 echo "Looking for old /etc/smbpasswd..."
217 if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
218 echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
219 mv /etc/smbpasswd /etc/samba/smbpasswd
223 # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
224 # to preserve across reboots.
226 echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
227 for i in /var/lock/samba/*.tdb
230 newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
231 echo "Moving $i to $newname"
236 # Remove the transient tdb files.
237 if [ -e /var/cache/samba/brlock.tdb ]; then
238 rm -f /var/cache/samba/brlock.tdb
241 if [ -e /var/cache/samba/unexpected.tdb ]; then
242 rm -f /var/cache/samba/unexpected.tdb
245 if [ -e /var/cache/samba/connections.tdb ]; then
246 rm -f /var/cache/samba/connections.tdb
249 if [ -e /var/cache/samba/locking.tdb ]; then
250 rm -f /var/cache/samba/locking.tdb
253 if [ -e /var/cache/samba/messages.tdb ]; then
254 rm -f /var/cache/samba/messages.tdb
257 if [ -d /var/lock/samba ]; then
258 rm -rf /var/lock/samba
261 # Add swat entry to /etc/services if not already there.
262 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
263 echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
266 # Add swat entry to /etc/inetd.conf if needed.
267 if [ -f /etc/inetd.conf ]; then
268 if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
269 echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
270 killall -1 inetd || :
274 # Add swat entry to xinetd.d if needed.
275 if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
276 mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
278 rm -f /etc/samba/samba.xinetd
281 # Install the correct version of the samba pam file, depending on pam version.
282 if [ -f /lib/security/pam_stack.so ]; then
283 echo "Installing stack version of /etc/pam.d/samba..."
284 mv /etc/samba/samba.stack /etc/pam.d/samba
286 echo "Installing non-stack version of /etc/pam.d/samba..."
287 rm -f /etc/samba/samba.stack
290 # Create winbind nss client symlink
292 if [ -e /lib/libnss_winbind.so ]; then
293 ln -sf /lib/libnss_winbind.so /lib/libnss_winbind.so.2
298 /sbin/chkconfig --del smb
300 # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
301 if [ -e /var/cache/samba/browse.dat ]; then
302 rm -f /var/cache/samba/browse.dat
304 if [ -e /var/cache/samba/wins.dat ]; then
305 rm -f /var/cache/samba/wins.dat
308 # Remove the transient tdb files.
309 if [ -e /var/cache/samba/brlock.tdb ]; then
310 rm -f /var/cache/samba/brlock.tdb
313 if [ -e /var/cache/samba/unexpected.tdb ]; then
314 rm -f /var/cache/samba/unexpected.tdb
317 if [ -e /var/cache/samba/connections.tdb ]; then
318 rm -f /var/cache/samba/connections.tdb
321 if [ -e /var/cache/samba/locking.tdb ]; then
322 rm -f /var/cache/samba/locking.tdb
325 if [ -e /var/cache/samba/messages.tdb ]; then
326 rm -f /var/cache/samba/messages.tdb
329 # Remove winbind nss client symlink
331 if [ -L /lib/libnss_winbind.so.2 ]; then
332 rm -f /lib/libnss_winbind.so.2
337 # Only delete remnants of samba if this is the final deletion.
339 if [ -x /etc/pam.d/samba ]; then
340 rm -f /etc/pam.d/samba
342 if [ -e /var/log/samba ]; then
343 rm -rf /var/log/samba
345 if [ -e /var/cache/samba ]; then
346 rm -rf /var/cache/samba
349 # Remove swat entries from /etc/inetd.conf and /etc/services
352 if [ -f /etc/inetd.conf ]; then
353 # preserve inetd.conf permissions.
354 cp -p /etc/inetd.conf $tmpfile
355 sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
356 mv $tmpfile inetd.conf
358 # preserve services permissions.
359 cp -p /etc/services $tmpfile
360 sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
361 mv $tmpfile /etc/services
363 # Remove swat entry from /etc/xinetd.d
364 if [ -f /etc/xinetd.d/swat ]; then
365 rm -r /etc/xinetd.d/swat
370 %defattr(-,root,root)
371 %doc README COPYING Manifest Read-Manifest-Now
372 %doc WHATSNEW.txt Roadmap
380 %{prefix}/sbin/smbmount
381 %{prefix}/sbin/smbumount
382 %{prefix}/sbin/winbindd
384 %{prefix}/sbin/debug2html
387 %{prefix}/bin/mksmbpasswd.sh
388 %{prefix}/bin/smbclient
389 %{prefix}/bin/smbspool
390 %{prefix}/bin/rpcclient
391 %{prefix}/bin/testparm
392 %{prefix}/bin/testprns
393 %{prefix}/bin/findsmb
394 %{prefix}/bin/smbstatus
395 %{prefix}/bin/nmblookup
396 %{prefix}/bin/smbpasswd
398 %{prefix}/bin/smbprint
399 %{prefix}/bin/smbcontrol
402 %{prefix}/bin/smbcacls
403 %{prefix}/bin/pdbedit
404 %{prefix}/bin/tdbbackup
405 %{prefix}/bin/smbtree
406 %attr(755,root,root) /lib/libnss_wins.s*
407 %attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
408 #%attr(755,root,root) %{prefix}/lib/samba/pdb/*.so
409 %attr(755,root,root) %{prefix}/lib/samba/*.dat
410 %{prefix}/include/libsmbclient.h
411 %{prefix}/lib/libsmbclient.a
412 %{prefix}/lib/libsmbclient.so
413 %{prefix}/share/swat/help/*
414 %{prefix}/share/swat/images/*
415 %{prefix}/share/swat/include/*.html
416 %{prefix}/share/swat/lang/*/help/*
417 %{prefix}/share/swat/lang/*/images/*
418 %{prefix}/share/swat/lang/*/include/*.html
419 %{prefix}/share/swat/using_samba/*
420 %{prefix}/share/swat/README
421 %config(noreplace) /etc/samba/lmhosts
422 %config(noreplace) /etc/samba/smb.conf
423 %config(noreplace) /etc/samba/smbusers
424 /etc/samba/samba.stack
425 /etc/samba/samba.xinetd
427 /etc/rc.d/init.d/winbind
428 /etc/logrotate.d/samba
429 %config(noreplace) /etc/pam.d/samba
434 %attr(755,root,root) %dir /var/cache/samba
437 %attr(1777,root,root) %dir /var/spool/samba
438 %attr(-,root,root) /lib/libnss_winbind.so
439 %attr(-,root,root) /lib/security/pam_winbind.so
440 %attr(-,root,root) /lib/security/pam_smbpass.so