source: branches/stable/tools/rpm-env @ 442

Last change on this file since 442 was 442, checked in by bcornec, 13 years ago

Fix a bug for redhat package generation

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs environment from SVN repository
4#
5# $Id: rpm-env 442 2006-03-15 21:43:43Z bcornec $
6#
7
8dname=`dirname $0`
9prem=`echo $dname |cut -c1`
10if [ ${prem} == "/" ]; then
11        export TOOLHOME=$dname
12else
13    export TOOLHOME=${PWD}/$dname
14fi
15
16. $TOOLHOME/common-env
17
18export ARCH=`rpm --showrc | egrep "^build arch" | awk '{print $4}'`
19
20# Should not be modified below
21export pkg=""
22export opt=""
23
24if [ -f ${HOME}/.rpmmacros ]; then
25    export TOPDIR=`egrep '^%_topdir' ${HOME}/.rpmmacros | awk '{print $2}'`
26else
27    export TOPDIR=${BASE}/RPMS
28fi
29mkdir -p ${TOPDIR}
30cd ${TOPDIR}
31mkdir -p RPMS SRPMS SPECS SOURCES BUILD
32
33if [ -e /etc/mandriva-release ]; then
34    export dfam="mandriva"
35    export ddir="mandriva"
36    export dver=`awk '{print $4}' /etc/mandriva-release`
37    export suf=".`echo $dver | sed 's/\.//'`mdk"
38elif [ -e /etc/mandrake-release ]; then
39    export dfam="mandriva"
40    export ddir="mandrake"
41    export dver=`awk '{print $3}' /etc/mandrake-release`
42    export suf=".`echo $dver | sed 's/\.//'`mdk"
43elif [ -e /etc/redhat-release ]; then
44    grep -q Enterprise /etc/redhat-release
45    if [ $? -eq 0 ]; then
46        export dfam="redhat"
47        export ddir="rhel"
48        export dver=`awk '{print $7}' /etc/redhat-release`
49    elif grep -q Fedora /etc/redhat-release ; then
50        export dfam="redhat"
51        export ddir="fedora"
52        export dver=`awk '{print $4}' /etc/redhat-release`
53        export suf=".fc${dver}"
54    else
55        export dfam="redhat"
56        export ddir="redhat"
57        dver=`awk '{print $5}' /etc/redhat-release`
58        export dver=`echo ${dver} | sed "s/\.//"`
59        export suf=".rh${dver}"
60    fi
61elif [ -e /etc/SuSE-release ]; then
62    grep -q Enterprise /etc/SuSE-release
63    if [ $? -eq 0 ]; then
64        export dfam="suse"
65        export ddir="sles"
66        export dver=`head -1 /etc/SuSE-release | awk '{print $5}'`
67    else
68        export dfam="suse"
69        export ddir="suse"
70        export dver=`head -1 /etc/SuSE-release | awk '{print $3}'`
71    fi
72else
73    export dfam="generic"
74    export dver=""
75    export ddir="generic"
76fi
77
78if [ _"$suf" = _"" ]; then
79    export suf=".${ddir}${dver}"
80fi
Note: See TracBrowser for help on using the repository browser.