source: trunk/tools/rpm-env @ 357

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

merge -r 349:356 $SVN_M/branches/stable

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs environment from SVN repository
4#
5# $Id: rpm-env 357 2006-01-29 01:14:27Z 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 VER=trunk
22export pkg=""
23export opt=""
24
25if [ -f ${HOME}/.rpmmacros ]; then
26    export TOPDIR=`egrep '^%_topdir' ${HOME}/.rpmmacros | awk '{print $2}'`
27else
28    export TOPDIR=${BASE}/RPMS
29fi
30mkdir -p ${TOPDIR}
31cd ${TOPDIR}
32mkdir -p RPMS SRPMS SPECS SOURCES BUILD
33
34if [ -e /etc/mandriva-release ]; then
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 ddir="mandrake"
40    export dver=`awk '{print $3}' /etc/mandrake-release`
41    export suf=".`echo $dver | sed 's/\.//'`mdk"
42elif [ -e /etc/redhat-release ]; then
43    grep -q Enterprise /etc/redhat-release
44    if [ $? -eq 0 ]; then
45        export ddir="rhel"
46        export dver=`awk '{print $7}' /etc/redhat-release`
47    elif grep -q Fedora /etc/redhat-release ; then
48        export ddir="fedora"
49        export dver=`awk '{print $4}' /etc/redhat-release`
50        export suf=".fc${dver}"
51    else
52        export ddir="redhat"
53        dver=`awk '{print $5}' /etc/redhat-release`
54        export suf=".rh${dver}"
55        export dver=`echo ${dver} | sed "s/\.//"`
56    fi
57elif [ -e /etc/SuSE-release ]; then
58    grep -q Enterprise /etc/SuSE-release
59    if [ $? -eq 0 ]; then
60        export ddir="sles"
61        export dver=`head -1 /etc/SuSE-release | awk '{print $5}'`
62    else
63        export ddir="suse"
64        export dver=`head -1 /etc/SuSE-release | awk '{print $3}'`
65    fi
66else
67    export dver=""
68    export ddir="generic"
69fi
70
71if [ _"$suf" = _"" ]; then
72    export suf=".${ddir}${dver}"
73fi
Note: See TracBrowser for help on using the repository browser.