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

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

RPMs are now made with a .spec containing m4 macros expanded with tools/mkrpm
this allows for a simpler spec file at the end,
which should be suited for at least Mandriva official packages.
Added a new mkspec tool which does the expansion
This way of dealing with distributions will be used is some other areas in the future

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