source: trunk/tools/mkrpm @ 537

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

merge -r 526:534 $SVN_M/branches/stable

  • 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 537 2006-05-12 00:04:55Z 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="mondo-doc mindi mondo"
21else
22    if [ "$1" = "all" ]; then
23        c="mindi-kernel mondo-doc mindi mondo"
24    else
25        c=$1
26    fi
27fi
28
29$TOOLHOME/mkcommon "$c"
30
31if [ "`echo $c | grep mindi-kernel`" != "" ]; then
32    cd ${BASE}/svn
33    mkdir -p ${TOPDIR}/SOURCES
34    $TOOLHOME/mkspec ${MINDI_VER} mindi-kernel-${MINDI_VER}/mindi-kernel.spec > ${TOPDIR}/SPECS/mindi-kernel.spec
35    chmod 644 ${TOPDIR}/SPECS/mindi-kernel.spec
36    pkg1="${TOPDIR}/RPMS/${ARCH}/mindi-kernel-${MINDI_VER}-${REVISION}${suf}.${ARCH}.rpm"
37    pkg="$pkg $pkg1"
38    rm -f $pkg1
39fi
40if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
41    cd ${BASE}/svn
42    $TOOLHOME/mkspec ${MINDI_VER} mindi-${MINDI_VER}/distributions/rpm/mindi.spec > ${TOPDIR}/SPECS/mindi.spec
43    cat mindi-${MINDI_VER}/distributions/$dfam/changelog >> ${TOPDIR}/SPECS/mindi.spec
44    chmod 644 ${TOPDIR}/SPECS/mindi.spec
45    rm -rf mindi-${MINDI_VER}/distributions
46    mkdir -p ${TOPDIR}/SOURCES
47
48    pkg1="${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-${REVISION}${suf}.${ARCH}.rpm"
49    pkg="$pkg $pkg1"
50    rm -f $pkg1
51    # ATTENTION: This could be dangerous for your setup
52    opt="rm -rf /usr/lib/mindi ;"
53fi
54if [ "`echo $c | grep mondo-doc`" != "" ]; then
55    cd ${BASE}/svn
56    $TOOLHOME/mkspec ${MONDO_VER} mondo-${MONDO_VER}/distributions/rpm/mondo-doc.spec > ${TOPDIR}/SPECS/mondo-doc.spec
57    cat mondo-${MONDO_VER}/distributions/$dfam/changelog >> ${TOPDIR}/SPECS/mondo-doc.spec
58    chmod 644 ${TOPDIR}/SPECS/mondo-doc.spec
59
60    pkg1="${TOPDIR}/RPMS/${ARCH}/mondo-doc-${MONDO_VER}-${REVISION}${suf}.${ARCH}.rpm"
61    pkg="$pkg $pkg1"
62    rm -f $pkg1
63fi
64
65if [ "`echo $c | grep -v doc | grep mondo`" != "" ]; then
66    cd ${BASE}/svn
67    $TOOLHOME/mkspec ${MONDO_VER} mondo-${MONDO_VER}/distributions/rpm/mondo.spec > ${TOPDIR}/SPECS/mondo.spec
68    cat mondo-${MONDO_VER}/distributions/$dfam/changelog >> ${TOPDIR}/SPECS/mondo.spec
69    chmod 644 ${TOPDIR}/SPECS/mondo.spec
70    rm -rf mondo-${MONDO_VER}/distributions
71
72    pkg1="${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-${REVISION}${suf}.${ARCH}.rpm"
73    pkg="$pkg $pkg1"
74    rm -f $pkg1
75fi
76
77cd ${TOPDIR}/SPECS
78status=0
79
80for p in $c; do
81    echo "Generating $p RPMS"
82    log=/tmp/$p-rpm.log
83    rpmbuild -ba $p.spec 2> $log 1> $log
84    if [ $? != 0 ]; then 
85        cat $log
86        status=-1
87    fi
88done
89if [ $status = 0 ]; then
90    echo "Installing RPMS as root ($pkg)"
91    su - -c "$opt rpm -Uvh --force $pkg"
92fi
Note: See TracBrowser for help on using the repository browser.