source: MondoRescue/branches/2.06/tools/mkrpm @ 319

Last change on this file since 319 was 319, checked in by bcornec, 15 years ago
  • split build architecture to allow for multiple packages generation (rpms, debs, ebuild, ...)
  • only prepared for rpms and debs at the moment

Use tools/mkrpm to generate all the RPMs
Use tools/mkdeb (to be coded correctly) to generate all the debs

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs packages from SVN repository for local tests
4#
5# $Id: mkrpm 319 2006-01-14 10:44:12Z bcornec $
6#
7
8umask 022
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ ${prem} == "/" ]; then
12    export TOOLHOME=$dname
13else
14    export TOOLHOME=${PWD}/$dname
15fi
16
17. $TOOLHOME/rpm-env
18
19if [ "$1" = "" ]; then
20    c="mindi mondo"
21else
22    c=$1
23fi
24
25$TOOLHOME/mkcommon "$c"
26
27if [ "`echo $c | grep mindi-kernel`" != "" ]; then
28    cd ${BASE}/svn
29    mkdir -p ${TOPDIR}/SOURCES
30    sed "s/^%define mrel..*RRR/%define mrel ${REVISION}${suf}/" mindi-kernel-${MINDI_VER}/mindi-kernel.spec > ${TOPDIR}/SPECS/mindi-kernel.spec
31    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-kernel-${MINDI_VER}-${REVISION}${suf}.${ARCH}.rpm"
32fi
33if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
34    cd ${BASE}/svn
35    if [ -f mindi-${MINDI_VER}/distributions/${ddir}/mindi.spec ]; then
36        specfile=mindi-${MINDI_VER}/distributions/${ddir}/mindi.spec
37    else
38        specfile=mindi-${MINDI_VER}/distributions/common/mindi.spec
39    fi
40    sed -e "s/^%define mrel..*RRR/%define mrel  ${REVISION}${suf}/" -e "s/VVV/${MINDI_VER}/" $specfile > ${TOPDIR}/SPECS/mindi.spec
41    rm -rf mindi-${MINDI_VER}/distributions
42    mkdir -p ${TOPDIR}/SOURCES
43
44    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-${REVISION}${suf}.${ARCH}.rpm"
45    # ATTENTION: This could be dangerous for your setup
46    opt="rm -rf /usr/lib/mindi ;"
47fi
48if [ "`echo $c | grep  mondo`" != "" ]; then
49    cd ${BASE}/svn
50    if [ -f mondo-${MONDO_VER}/distributions/${ddir}/mondo.spec ]; then
51        specfile=mondo-${MONDO_VER}/distributions/${ddir}/mondo.spec
52    else
53        specfile=mondo-${MONDO_VER}/distributions/common/mondo.spec
54    fi
55    sed -e "s/^%define mrel..*RRR/%define mrel  ${REVISION}${suf}/" -e "s/VVV/${MONDO_VER}/" $specfile > ${TOPDIR}/SPECS/mondo.spec
56    rm -rf mondo-${MONDO_VER}/distributions
57
58    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-${REVISION}${suf}.${ARCH}.rpm"
59fi
60
61cd ${TOPDIR}/SPECS
62status=0
63if [ "`echo $c | grep kernel`" != "" ]; then
64    echo "Generating mindi-kernel RPMS"
65    log=/tmp/mindi-kernel-rpm.log
66    rpmbuild -ba mindi-kernel.spec 2> $log 1> $log
67    if [ $? != 0 ]; then 
68        cat $log
69        status=-1
70    fi
71fi
72if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
73    echo "Generating mindi RPMS"
74    log=/tmp/mindi-rpm.log
75    rpmbuild -ba mindi.spec 2> $log 1> $log
76    if [ $? != 0 ]; then
77        cat $log
78        status=-1
79    fi
80fi
81if [ "`echo $c | grep mondo`" != "" ]; then
82    echo "Generating mondo RPMS"
83    log=/tmp/mondo-rpm.log
84    rpmbuild -ba mondo.spec 2> $log 1> $log
85    if [ $? != 0 ]; then 
86        cat $log
87        status=-1
88    fi
89fi
90if [ $status = 0 ]; then
91    echo "Installing RPMS as root ($pkg)"
92    su - -c "$opt rpm -Uvh --force $pkg"
93fi
Note: See TracBrowser for help on using the repository browser.