1 Summary: Samba SMB client and server
5 Copyright: 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: /var/tmp/samba
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.
31 * Mon Nov 18 2002 Gerald Carter <jerry@samba.org>
32 - removed change log entries since history
33 is being maintained in CVS
39 ## Build main Samba source
43 libtoolize --copy --force # get it to recognize IA-64
46 EXTRA="-D_LARGEFILE64_SOURCE"
48 NUMCPU=`grep processor /proc/cpuinfo | wc -l`
49 CFLAGS="$RPM_OPT_FLAGS $EXTRA" ./configure \
51 --localstatedir=/var \
52 --with-configdir=/etc/samba \
53 --with-privatedir=/etc/samba \
61 --with-sambabook=%{prefix}/share/swat/using_samba \
62 --with-swatdir=%{prefix}/share/swat \
64 make -j${NUMCPU} proto
65 make -j${NUMCPU} all nsswitch/libnss_wins.so modules
66 make -j${NUMCPU} debug2html
67 make -j${NUMCPU} bin/smbspool
69 # Remove some permission bits to avoid to many dependencies
70 find examples docs -type f | xargs -r chmod -x
73 rm -rf $RPM_BUILD_ROOT
74 mkdir -p $RPM_BUILD_ROOT
75 mkdir -p $RPM_BUILD_ROOT/sbin
76 mkdir -p $RPM_BUILD_ROOT/etc/samba
77 mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d,samba}
78 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
79 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
80 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
81 mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
82 mkdir -p $RPM_BUILD_ROOTMANDIR_MACRO
83 mkdir -p $RPM_BUILD_ROOT/var/cache/samba
84 mkdir -p $RPM_BUILD_ROOT/var/{log,run}/samba
85 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
86 mkdir -p $RPM_BUILD_ROOT/lib/security
87 mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/samba/vfs
88 mkdir -p $RPM_BUILD_ROOT%{prefix}/{lib,include}
90 # Install standard binary files
91 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
92 rpcclient smbspool smbcacls smbcontrol wbinfo smbmnt net smbgroupedit \
93 smbcacls pdbedit tdbbackup smbtree
95 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/bin
98 for i in mksmbpasswd.sh smbtar findsmb
100 install -m755 source/script/$i $RPM_BUILD_ROOT%{prefix}/bin
103 # Install secure binary files
104 for i in smbd nmbd swat smbmount smbumount debug2html winbindd wrepld
106 install -m755 source/bin/$i $RPM_BUILD_ROOT%{prefix}/sbin
109 # we need a symlink for mount to recognise the smb and smbfs filesystem types
110 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smbfs
111 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
113 # This allows us to get away without duplicating code that
114 # sombody else can maintain for us.
116 make BASEDIR=$RPM_BUILD_ROOT/usr \
117 CONFIGDIR=$RPM_BUILD_ROOT/etc/samba \
118 LIBDIR=$RPM_BUILD_ROOT%{prefix}/lib/samba \
119 VARDIR=$RPM_BUILD_ROOT/var \
120 SBINDIR=$RPM_BUILD_ROOT%{prefix}/sbin \
121 BINDIR=$RPM_BUILD_ROOT%{prefix}/bin \
122 MANDIR=$RPM_BUILD_ROOTMANDIR_MACRO \
123 SWATDIR=$RPM_BUILD_ROOT%{prefix}/share/swat \
124 SAMBABOOK=$RPM_BUILD_ROOT%{prefix}/share/swat/using_samba \
125 installman installswat installdat installmodules
128 # Install the nsswitch wins library
129 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
130 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_wins.so libnss_wins.so.2; )
132 # Install winbind shared libraries
133 install -m755 source/nsswitch/libnss_winbind.so $RPM_BUILD_ROOT/lib
134 ( cd $RPM_BUILD_ROOT/lib; ln -sf libnss_winbind.so libnss_winbind.so.2; )
135 install -m755 source/nsswitch/pam_winbind.so $RPM_BUILD_ROOT/lib/security
137 # Install pam_smbpass.so
138 install -m755 source/bin/pam_smbpass.so $RPM_BUILD_ROOT/lib/security
141 install -m 755 source/bin/libsmbclient.so $RPM_BUILD_ROOT%{prefix}/lib/
142 install -m 755 source/bin/libsmbclient.a $RPM_BUILD_ROOT%{prefix}/lib/
143 install -m 644 source/include/libsmbclient.h $RPM_BUILD_ROOT%{prefix}/include/
145 # Install SWAT helper files
146 #for i in swat/help/*.html docs/htmldocs/*.html
148 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/help
150 #for i in swat/images/*.gif
152 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/images
154 #for i in swat/include/*.html
156 # install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
159 # Install the miscellany
160 install -m755 packaging/RedHat/smbprint $RPM_BUILD_ROOT%{prefix}/bin
161 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT/etc/rc.d/init.d/smb
162 install -m755 packaging/RedHat/winbind.init $RPM_BUILD_ROOT/etc/rc.d/init.d/winbind
163 install -m755 packaging/RedHat/smb.init $RPM_BUILD_ROOT%{prefix}/sbin/samba
164 install -m644 packaging/RedHat/samba.log $RPM_BUILD_ROOT/etc/logrotate.d/samba
165 install -m644 packaging/RedHat/smb.conf $RPM_BUILD_ROOT/etc/samba/smb.conf
166 install -m644 packaging/RedHat/smbusers $RPM_BUILD_ROOT/etc/samba/smbusers
167 install -m644 packaging/RedHat/samba.pamd $RPM_BUILD_ROOT/etc/pam.d/samba
168 install -m644 packaging/RedHat/samba.pamd.stack $RPM_BUILD_ROOT/etc/samba/samba.stack
169 install -m644 packaging/RedHat/samba.xinetd $RPM_BUILD_ROOT/etc/samba/samba.xinetd
170 echo 127.0.0.1 localhost > $RPM_BUILD_ROOT/etc/samba/lmhosts
173 rm -rf $RPM_BUILD_ROOT
176 /sbin/chkconfig --add smb
177 /sbin/chkconfig --add winbind
178 /sbin/chkconfig smb off
179 /sbin/chkconfig winbind off
181 echo "Looking for old /etc/smb.conf..."
182 if [ -f /etc/smb.conf -a ! -f /etc/samba/smb.conf ]; then
183 echo "Moving old /etc/smb.conf to /etc/samba/smb.conf"
184 mv /etc/smb.conf /etc/samba/smb.conf
187 echo "Looking for old /etc/smbusers..."
188 if [ -f /etc/smbusers -a ! -f /etc/samba/smbusers ]; then
189 echo "Moving old /etc/smbusers to /etc/samba/smbusers"
190 mv /etc/smbusers /etc/samba/smbusers
193 echo "Looking for old /etc/lmhosts..."
194 if [ -f /etc/lmhosts -a ! -f /etc/samba/lmhosts ]; then
195 echo "Moving old /etc/lmhosts to /etc/samba/lmhosts"
196 mv /etc/lmhosts /etc/samba/lmhosts
199 echo "Looking for old /etc/MACHINE.SID..."
200 if [ -f /etc/MACHINE.SID -a ! -f /etc/samba/MACHINE.SID ]; then
201 echo "Moving old /etc/MACHINE.SID to /etc/samba/MACHINE.SID"
202 mv /etc/MACHINE.SID /etc/samba/MACHINE.SID
205 echo "Looking for old /etc/smbpasswd..."
206 if [ -f /etc/smbpasswd -a ! -f /etc/samba/smbpasswd ]; then
207 echo "Moving old /etc/smbpasswd to /etc/samba/smbpasswd"
208 mv /etc/smbpasswd /etc/samba/smbpasswd
212 # For 2.2.1 we move the tdb files from /var/lock/samba to /var/cache/samba
213 # to preserve across reboots.
215 echo "Moving tdb files in /var/lock/samba/*.tdb to /var/cache/samba/*.tdb"
216 for i in /var/lock/samba/*.tdb
219 newname=`echo $i | sed -e's|var\/lock\/samba|var\/cache\/samba|'`
220 echo "Moving $i to $newname"
225 # Remove the transient tdb files.
226 if [ -e /var/cache/samba/brlock.tdb ]; then
227 rm -f /var/cache/samba/brlock.tdb
230 if [ -e /var/cache/samba/unexpected.tdb ]; then
231 rm -f /var/cache/samba/unexpected.tdb
234 if [ -e /var/cache/samba/connections.tdb ]; then
235 rm -f /var/cache/samba/connections.tdb
238 if [ -e /var/cache/samba/locking.tdb ]; then
239 rm -f /var/cache/samba/locking.tdb
242 if [ -e /var/cache/samba/messages.tdb ]; then
243 rm -f /var/cache/samba/messages.tdb
246 if [ -d /var/lock/samba ]; then
247 rm -rf /var/lock/samba
250 # Add swat entry to /etc/services if not already there.
251 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
252 echo 'swat 901/tcp # Add swat service used via inetd' >> /etc/services
255 # Add swat entry to /etc/inetd.conf if needed.
256 if [ -f /etc/inetd.conf ]; then
257 if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
258 echo 'swat stream tcp nowait.400 root %{prefix}/sbin/swat swat' >> /etc/inetd.conf
259 killall -1 inetd || :
263 # Add swat entry to xinetd.d if needed.
264 if [ -d $RPM_BUILD_ROOT/etc/xinetd.d -a ! -f /etc/xinetd.d/swat ]; then
265 mv /etc/samba/samba.xinetd /etc/xinetd.d/swat
267 rm -f /etc/samba/samba.xinetd
270 # Install the correct version of the samba pam file, depending on pam version.
271 if [ -f /lib/security/pam_stack.so ]; then
272 echo "Installing stack version of /etc/pam.d/samba..."
273 mv /etc/samba/samba.stack /etc/pam.d/samba
275 echo "Installing non-stack version of /etc/pam.d/samba..."
276 rm -f /etc/samba/samba.stack
279 # Create winbind nss client symlink
281 if [ -e /lib/libnss_winbind.so ]; then
282 ln -sf /lib/libnss_winbind.so /lib/libnss_winbind.so.2
287 /sbin/chkconfig --del smb
289 # We want to remove the browse.dat and wins.dat files so they can not interfer with a new version of samba!
290 if [ -e /var/cache/samba/browse.dat ]; then
291 rm -f /var/cache/samba/browse.dat
293 if [ -e /var/cache/samba/wins.dat ]; then
294 rm -f /var/cache/samba/wins.dat
297 # Remove the transient tdb files.
298 if [ -e /var/cache/samba/brlock.tdb ]; then
299 rm -f /var/cache/samba/brlock.tdb
302 if [ -e /var/cache/samba/unexpected.tdb ]; then
303 rm -f /var/cache/samba/unexpected.tdb
306 if [ -e /var/cache/samba/connections.tdb ]; then
307 rm -f /var/cache/samba/connections.tdb
310 if [ -e /var/cache/samba/locking.tdb ]; then
311 rm -f /var/cache/samba/locking.tdb
314 if [ -e /var/cache/samba/messages.tdb ]; then
315 rm -f /var/cache/samba/messages.tdb
318 # Remove winbind nss client symlink
320 if [ -L /lib/libnss_winbind.so.2 ]; then
321 rm -f /lib/libnss_winbind.so.2
326 # Only delete remnants of samba if this is the final deletion.
328 if [ -x /etc/pam.d/samba ]; then
329 rm -f /etc/pam.d/samba
331 if [ -e /var/log/samba ]; then
332 rm -rf /var/log/samba
334 if [ -e /var/cache/samba ]; then
335 rm -rf /var/cache/samba
338 # Remove swat entries from /etc/inetd.conf and /etc/services
341 if [ -f /etc/inetd.conf ]; then
342 # preserve inetd.conf permissions.
343 cp -p /etc/inetd.conf $tmpfile
344 sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
345 mv $tmpfile inetd.conf
347 # preserve services permissions.
348 cp -p /etc/services $tmpfile
349 sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
350 mv $tmpfile /etc/services
352 # Remove swat entry from /etc/xinetd.d
353 if [ -f /etc/xinetd.d/swat ]; then
354 rm -r /etc/xinetd.d/swat
359 %defattr(-,root,root)
360 %doc README COPYING Manifest Read-Manifest-Now
361 %doc WHATSNEW.txt Roadmap
369 %{prefix}/sbin/smbmount
370 %{prefix}/sbin/smbumount
371 %{prefix}/sbin/winbindd
372 %{prefix}/sbin/wrepld
374 %{prefix}/sbin/debug2html
377 %{prefix}/bin/mksmbpasswd.sh
378 %{prefix}/bin/smbclient
379 %{prefix}/bin/smbspool
380 %{prefix}/bin/rpcclient
381 %{prefix}/bin/testparm
382 %{prefix}/bin/testprns
383 %{prefix}/bin/findsmb
384 %{prefix}/bin/smbstatus
385 %{prefix}/bin/nmblookup
386 %{prefix}/bin/smbpasswd
388 %{prefix}/bin/smbprint
389 %{prefix}/bin/smbcontrol
392 %{prefix}/bin/smbgroupedit
393 %{prefix}/bin/smbcacls
394 %{prefix}/bin/pdbedit
395 %{prefix}/bin/tdbbackup
396 %{prefix}/bin/smbtree
397 %attr(755,root,root) /lib/libnss_wins.s*
398 %attr(755,root,root) %{prefix}/lib/samba/vfs/*.so
399 %attr(755,root,root) %{prefix}/lib/samba/*.dat
400 %{prefix}/include/libsmbclient.h
401 %{prefix}/lib/libsmbclient.a
402 %{prefix}/lib/libsmbclient.so
403 %{prefix}/share/swat/help/*
404 %{prefix}/share/swat/images/*
405 %{prefix}/share/swat/include/*.html
406 %{prefix}/share/swat/lang/*/help/*
407 %{prefix}/share/swat/lang/*/images/*
408 %{prefix}/share/swat/lang/*/include/*.html
409 %{prefix}/share/swat/using_samba/*
410 %config(noreplace) /etc/samba/lmhosts
411 %config(noreplace) /etc/samba/smb.conf
412 %config(noreplace) /etc/samba/smbusers
413 /etc/samba/samba.stack
414 /etc/samba/samba.xinetd
416 /etc/rc.d/init.d/winbind
417 /etc/logrotate.d/samba
418 %config(noreplace) /etc/pam.d/samba
423 %attr(755,root,root) %dir /var/cache/samba
426 %attr(1777,root,root) %dir /var/spool/samba
427 %attr(-,root,root) /lib/libnss_winbind.so
428 %attr(-,root,root) /lib/security/pam_winbind.so
429 %attr(-,root,root) /lib/security/pam_smbpass.so