[PATCH] Updated spec file for RPM

Andrew Bartlett abartlet at pcug.org.au
Fri Feb 9 08:29:13 GMT 2001


I have made a few changes to the RedHat RPM spec file for Samba 2.2,
allowing a functional install of samba via RPM.  It rebuilds on RH6.2
and RH7+rawhide except in that the makerpms script doesn't work on
RPMv4.

I've had this sitting around waiting to be dealt with for a while, so
something recent might have broken it, but in any case its better than
what's currently in CVS.

Quirks:  I have removed the second copy of the samba book, pointing swat
(which I don't use and haven't tested) to the RH7 documentation
directory.  I have also moved code page generation into the RPM, thus
getting rid of the code-page source from the final distribution (idea
from what RH does on their own spec file).

Hope its useful,
Andrew Bartlett

-- 
Andrew Bartlett
abartlet at pcug.org.au
-------------- next part --------------
--- samba2.spec.tmpl.orig	Mon Nov 13 18:33:46 2000
+++ samba2.spec.tmpl	Fri Feb  9 18:05:18 2001
@@ -1,10 +1,10 @@
 Summary: Samba SMB client and server
 Name: samba
-Version: PVERSION
-Release: PRELEASE
+Version: PVERSION 
+Release: PRELEASE 
 Copyright: GNU GPL version 2
 Group: Networking
-Source: ftp://samba.org/pub/samba/samba-PVERSION.tar.gz
+Source: ftp://samba.org/pub/samba/samba-%{version}.tar.gz
 Patch: makefile-path.patch
 Patch1: smbw.patch
 Packager: John H Terpstra [Samba-Team] <jht at samba.org>
@@ -151,7 +151,7 @@
 	--with-vfs \
 	--with-msdfs \
 	--with-netatalk \
-	--with-sambabook=%{prefix}/share/swat/using_samba
+	--with-sambabook=%{prefix}/share/doc/samba-${version}/docs/htmldocs/using_samba
 make -j${NUMCPU} all smbfilter nsswitch/libnss_wins.so
 make -j${NUMCPU} smbtorture debug2html locktest2
 make -j${NUMCPU} masktest bin/smbspool
@@ -161,17 +161,17 @@
 %install
 rm -rf $RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/etc/codepages/src
-mkdir -p $RPM_BUILD_ROOT/etc/{logrotate.d,pam.d}
-mkdir -p $RPM_BUILD_ROOT/etc/rc.d/{init.d,rc0.d,rc1.d,rc2.d,rc3.d,rc5.d,rc6.d}
-mkdir -p $RPM_BUILD_ROOT/home/samba
+mkdir -p $RPM_BUILD_ROOT/etc/{codepages,logrotate.d,pam.d}
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
 mkdir -p $RPM_BUILD_ROOT%{prefix}/{bin,sbin}
 mkdir -p $RPM_BUILD_ROOT/sbin
-mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include}
+mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/{images,help,include,using_samba}
+mkdir -p $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/{figs,gifs}
 mkdir -p $RPM_BUILD_ROOT%{prefix}/man/{man1,man5,man7,man8}
 mkdir -p $RPM_BUILD_ROOT/var/lock/samba
 mkdir -p $RPM_BUILD_ROOT/var/log/samba
 mkdir -p $RPM_BUILD_ROOT/var/spool/samba
+mkdir -p $RPM_BUILD_ROOT/lib
 
 # Install standard binary files
 for i in nmblookup smbclient smbpasswd smbstatus testparm testprns \
@@ -198,22 +198,23 @@
 ln -sf %{prefix}/sbin/smbmount $RPM_BUILD_ROOT/sbin/mount.smb
 
 # Install level 1 man pages
-for i in smbclient.1 smbrun.1 smbstatus.1 smbtar.1 testparm.1 testprns.1 make_smbcodepage.1 nmblookup.1
+for i in smbclient.1 smbrun.1 smbstatus.1 smbtar.1 testparm.1 testprns.1 make_smbcodepage.1 make_unicodemap.1 nmblookup.1
 do
 install -m644 docs/manpages/$i $RPM_BUILD_ROOT%{prefix}/man/man1
 done
 
 # Install codepage source files
-for i in 437 737 775 850 852 861 866 932 936 949 950 1251
+# Build codepage load files
+for i in 437 737 850 852 861 866 932 936 949 950 1251
 do
-install -m644 source/codepages/codepage_def.$i $RPM_BUILD_ROOT/etc/codepages/src
+$RPM_BUILD_ROOT%{prefix}/bin/make_smbcodepage c $i source/codepages/codepage_def.$i $RPM_BUILD_ROOT/etc/codepages/codepage.$i
 done
 for i in 437 737 850 852 861 866 932 936 949 950 ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
 do
-install -m644 source/codepages/CP$i.TXT $RPM_BUILD_ROOT/etc/codepages/src
+$RPM_BUILD_ROOT%{prefix}/bin/make_unicodemap $i source/codepages/CP$i.TXT $RPM_BUILD_ROOT/etc/codepages/unicode_map.$i
 done
 
-# Install the nsswitch library extension file
+# Install the nsswitch library extenstion file
 install -m755 source/nsswitch/libnss_wins.so $RPM_BUILD_ROOT/lib
 # Make link for wins resolver
 ( cd $RPM_BUILD_ROOT/lib; ln -s libnss_wins.so libnss_wins.so.2; )
@@ -230,18 +231,6 @@
 for i in swat/include/*.html
 do
 install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/include
-done# This is the O'Reily Samba Book - on-line
-for i in docs/htmldocs/using_samba/*.html
-do
-install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba
-done
-for i in docs/htmldocs/using_samba/figs/*.gif
-do
-install -m644 $i $RPM_BUILD_ROOT%{prefix}/share/swat/using_samba/figs
-done
-for i in docs/htmldocs/using_samba/gifs/*.gif
-do
-install -m644 $i $RPM_BUILD_ROOT%{prefix/share/swat/using_samba/gifs
 done
 
 # Install the miscellany
@@ -274,25 +263,17 @@
 %post
 /sbin/chkconfig --add smb
 
-# Build codepage load files
-for i in 437 737 850 852 861 866 932 936 949 950 1251
-do
-%{prefix}/bin/make_smbcodepage c $i /etc/codepages/src/codepage_def.$i /etc/codepages/codepage.$i
-done
-for i in 437 737 850 852 861 866 932 936 949 950 ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
-do
-%{prefix/bin/make_unicodemap $i /etc/codepages/src/CP$i.TXT /etc/codepages/unicode_map.$i
-done
-
 # Add swat entry to /etc/services if not already there
 if !( grep ^[:space:]*swat /etc/services > /dev/null ) then
 	echo 'swat		901/tcp				# Add swat service used via inetd' >> /etc/services
 fi
 
 # Add swat entry to /etc/inetd.conf if needed
-if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
-	echo 'swat	stream	tcp	nowait.400	root	%{prefix}/sbin/swat swat' >> /etc/inetd.conf
-killall -1 inetd || :
+if [ -f /etc/inetd.conf ]; then
+	if !( grep ^[:space:]*swat /etc/inetd.conf > /dev/null ) then
+		echo 'swat	stream	tcp	nowait.400	root	%{prefix}/sbin/swat swat' >> /etc/inetd.conf
+	killall -1 inetd || :
+	fi
 fi
 
 %preun
@@ -328,9 +309,11 @@
 
     # Remove swat entries from /etc/inetd.conf and /etc/services
     cd /etc
-    tmpfile=/etc/tmp.$$
-    sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
-    mv $tmpfile inetd.conf
+	if [ -f /etc/inetd.conf ]; then
+      tmpfile=/etc/tmp.$$
+      sed -e '/^[:space:]*swat.*$/d' /etc/inetd.conf > $tmpfile
+      mv $tmpfile inetd.conf
+	fi
     sed -e '/^[:space:]*swat.*$/d' /etc/services > $tmpfile
     mv $tmpfile services
 fi
@@ -392,30 +375,27 @@
 %attr(-,root,root) /etc/rc.d/init.d/smb
 %attr(-,root,root) /etc/logrotate.d/samba
 %attr(-,root,root) /etc/pam.d/samba
-%attr(-,root,root) /etc/codepages/src/codepage_def.*
-%attr(-,root,root) %{prefix}/man/man1/make_smbcodepage.1
-%attr(-,root,root) %{prefix}/man/man1/make_unicodemap.1
-%attr(-,root,root) %{prefix}/man/man1/nmblookup.1
-%attr(-,root,root) %{prefix}/man/man1/smbclient.1
-%attr(-,root,root) %{prefix}/man/man1/smbrun.1
-%attr(-,root,root) %{prefix}/man/man1/smbstatus.1
-%attr(-,root,root) %{prefix}/man/man1/smbtar.1
-%attr(-,root,root) %{prefix}/man/man1/testparm.1
-%attr(-,root,root) %{prefix}/man/man1/testprns.1
-%attr(-,root,root) %{prefix}/man/man5/lmhosts.5
-%attr(-,root,root) %{prefix}/man/man5/smb.conf.5
-%attr(-,root,root) %{prefix}/man/man5/smbpasswd.5
-%attr(-,root,root) %{prefix}/man/man7/samba.7
-%attr(-,root,root) %{prefix}/man/man8/nmbd.8
-%attr(-,root,root) %{prefix}/man/man8/smbd.8
-%attr(-,root,root) %{prefix}/man/man8/smbmnt.8
-%attr(-,root,root) %{prefix}/man/man8/smbmount.8
-%attr(-,root,root) %{prefix}/man/man8/smbpasswd.8
-%attr(-,root,root) %{prefix}/man/man8/smbspool.8
-%attr(-,root,root) %{prefix}/man/man8/swat.8
-%attr(-,root,nobody) %dir /home/samba
-%attr(-,root,root) %dir /etc/codepages
-%attr(-,root,root) %dir /etc/codepages/src
+%attr(-,root,root) %{prefix}/man/man1/make_smbcodepage.1*
+%attr(-,root,root) %{prefix}/man/man1/make_unicodemap.1*
+%attr(-,root,root) %{prefix}/man/man1/nmblookup.1*
+%attr(-,root,root) %{prefix}/man/man1/smbclient.1*
+%attr(-,root,root) %{prefix}/man/man1/smbrun.1*
+%attr(-,root,root) %{prefix}/man/man1/smbstatus.1*
+%attr(-,root,root) %{prefix}/man/man1/smbtar.1*
+%attr(-,root,root) %{prefix}/man/man1/testparm.1*
+%attr(-,root,root) %{prefix}/man/man1/testprns.1*
+%attr(-,root,root) %{prefix}/man/man5/lmhosts.5*
+%attr(-,root,root) %{prefix}/man/man5/smb.conf.5*
+%attr(-,root,root) %{prefix}/man/man5/smbpasswd.5*
+%attr(-,root,root) %{prefix}/man/man7/samba.7*
+%attr(-,root,root) %{prefix}/man/man8/nmbd.8*
+%attr(-,root,root) %{prefix}/man/man8/smbd.8*
+%attr(-,root,root) %{prefix}/man/man8/smbmnt.8*
+%attr(-,root,root) %{prefix}/man/man8/smbmount.8*
+%attr(-,root,root) %{prefix}/man/man8/smbpasswd.8*
+%attr(-,root,root) %{prefix}/man/man8/smbspool.8*
+%attr(-,root,root) %{prefix}/man/man8/swat.8*
+%attr(-,root,root) %dir /etc/codepages/*
 %attr(-,root,root) %dir /var/lock/samba
 %attr(-,root,root) %dir /var/log/samba
 %attr(1777,root,root) %dir /var/spool/samba


More information about the samba-technical mailing list