summaryrefslogtreecommitdiff
path: root/packaging/RedHat/makerpms.sh.tmpl
blob: 1767176a1fe94743a7dd51af106e4426549bab6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# Copyright (C) John H Terpstra 1998
# Updated for RPM 3 by Jochen Wiedmann, joe@ispsoft.de
#
USERID=`id -u`
GRPID=`id -g`

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
}

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}'`
       ;;
    3.*)
       RPMDIR=`rpm3var _rpmdir`
       SPECDIR=`rpm3var _specdir`
       SRCDIR=`rpm3var _sourcedir`
       ;;
    *)
       echo "Unknown RPM version: `rpm --version`"
       exit 1
       ;;
esac

( cd ../../.. ; chown -R ${USERID}.${GRPID} ${SRCDIR}/samba-PVERSION )
( cd ../../.. ; tar czvf ${SRCDIR}/samba-PVERSION.tar.gz samba-PVERSION )

cp -a *.spec $SPECDIR
cp -a *.patch smb.* samba.log $SRCDIR
cd $SPECDIR
rpm -ba -v samba2.spec