source: MondoRescue/trunk/tools/rpm-env @ 394

Last change on this file since 394 was 394, checked in by bcornec, 14 years ago

merge -r387:391 $SVN_M/branches/stable

  • 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 394 2006-02-15 10:44:31Z 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 dfam="mandriva"
36    export ddir="mandriva"
37    export dver=`awk '{print $4}' /etc/mandriva-release`
38    export suf=".`echo $dver | sed 's/\.//'`mdk"
39elif [ -e /etc/mandrake-release ]; then
40    export dfam="mandriva"
41    export ddir="mandrake"
42    export dver=`awk '{print $3}' /etc/mandrake-release`
43    export suf=".`echo $dver | sed 's/\.//'`mdk"
44elif [ -e /etc/redhat-release ]; then
45    grep -q Enterprise /etc/redhat-release
46    if [ $? -eq 0 ]; then
47        export dfam="redhat"
48        export ddir="rhel"
49        export dver=`awk '{print $7}' /etc/redhat-release`
50    elif grep -q Fedora /etc/redhat-release ; then
51        export dfam="redhat"
52        export ddir="fedora"
53        export dver=`awk '{print $4}' /etc/redhat-release`
54        export suf=".fc${dver}"
55    else
56        export dfam="redhat"
57        export ddir="redhat"
58        dver=`awk '{print $5}' /etc/redhat-release`
59        export suf=".rh${dver}"
60        export dver=`echo ${dver} | sed "s/\.//"`
61    fi
62elif [ -e /etc/SuSE-release ]; then
63    grep -q Enterprise /etc/SuSE-release
64    if [ $? -eq 0 ]; then
65        export dfam="suse"
66        export ddir="sles"
67        export dver=`head -1 /etc/SuSE-release | awk '{print $5}'`
68    else
69        export dfam="suse"
70        export ddir="suse"
71        export dver=`head -1 /etc/SuSE-release | awk '{print $3}'`
72    fi
73else
74    export dfam="generic"
75    export dver=""
76    export ddir="generic"
77fi
78
79if [ _"$suf" = _"" ]; then
80    export suf=".${ddir}${dver}"
81fi
Note: See TracBrowser for help on using the repository browser.