sync with SAMBA_2_2
[kai/samba.git] / packaging / RedHat / makerpms.sh.tmpl
index 1767176a1fe94743a7dd51af106e4426549bab6c..44b89a45ec8eb2dec6334dc69677e8cdac4b4574 100644 (file)
@@ -1,36 +1,25 @@
 #!/bin/sh
 # Copyright (C) John H Terpstra 1998
 # Updated for RPM 3 by Jochen Wiedmann, joe@ispsoft.de
-#
+# Changed for a generic tar file rebuild by abartlet@pcug.org.au
 USERID=`id -u`
 GRPID=`id -g`
+VERSION='PVERSION'
 
-rpm3var () {
-    echo "rpm3var start $1" >>/tmp/log
-    var=`rpm --showrc \
-         | awk "/-[0-9]+[:=][[:blank:]]+$1[[:blank:]]/ {print \\$3}"`
-    echo "var=$var" >>/tmp/log
-    while test -n "`echo $var | egrep '%{[_a-zA-Z]+}'`"; do
-       v=`echo $var | sed 's/.*%{\([_a-zA-Z]\+\)}.*/\1/'`
-       echo "Loop: v=$v" >>/tmp/log
-       w="`rpm3var $v`"
-       var=`echo $var | sed "s,%{\\([_a-zA-Z]\\+\\)},$w,g"`
-       echo "Loop: var=$var" >>/tmp/log
-    done
-    echo "rpm3var stop $1 $var" >>/tmp/log
-    echo $var
-}
+rm -f ../../samba2.*.spec
 
 case `rpm --version | awk '{print $3}'` in
     2.*)
-       RPMDIR=`rpm --showrc | awk '/^rpmdir/ { print $3}'`
-       SPECDIR=`rpm --showrc | awk '/^specdir/ { print $3}'`
-       SRCDIR=`rpm --showrc | awk '/^sourcedir/ { print $3}'`
+       sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba2.rpm2.spec
+       cp samba2.rpm2.spec ../../
        ;;
     3.*)
-       RPMDIR=`rpm3var _rpmdir`
-       SPECDIR=`rpm3var _specdir`
-       SRCDIR=`rpm3var _sourcedir`
+       sed -e "s/MANDIR_MACRO/\%\{prefix\}\/man/g" < samba2.spec > samba2.rpm3.spec
+       cp samba2.rpm3.spec ../../
+       ;;
+    4.*)
+       sed -e "s/MANDIR_MACRO/\%\{_mandir\}/g" < samba2.spec > samba2.rpm4.spec
+       cp samba2.rpm4.spec ../../
        ;;
     *)
        echo "Unknown RPM version: `rpm --version`"
@@ -38,10 +27,12 @@ case `rpm --version | awk '{print $3}'` in
        ;;
 esac
 
-( cd ../../.. ; chown -R ${USERID}.${GRPID} ${SRCDIR}/samba-PVERSION )
-( cd ../../.. ; tar czvf ${SRCDIR}/samba-PVERSION.tar.gz samba-PVERSION )
+( cd ../../source; if [ -f Makefile ]; then make distclean; fi )
+( cd ../../.. ; chown -R ${USERID}.${GRPID} samba-${VERSION} )
+( cd ../../.. ; tar --exclude=CVS -czvf samba-${VERSION}.tar.gz samba-${VERSION}/samba2.*.spec samba-${VERSION} )
+
+rpm -ta -v ../../../samba-${VERSION}.tar.gz
+
+
+
 
-cp -a *.spec $SPECDIR
-cp -a *.patch smb.* samba.log $SRCDIR
-cd $SPECDIR
-rpm -ba -v samba2.spec