source: MondoRescue/branches/stable/tools/mkrpm@ 388

Last change on this file since 388 was 388, checked in by bcornec, 18 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: 2.1 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs packages from SVN repository for local tests
4#
5# $Id: mkrpm 388 2006-02-14 22:36:15Z 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 $TOOLHOME/mkspec ${MINDI_VER} 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 $TOOLHOME/mkspec ${MINDI_VER} mindi-${MINDI_VER}/distributions/rpm/mindi.spec > ${TOPDIR}/SPECS/mindi.spec
36 rm -rf mindi-${MINDI_VER}/distributions
37 mkdir -p ${TOPDIR}/SOURCES
38
39 pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-${REVISION}${suf}.${ARCH}.rpm"
40 # ATTENTION: This could be dangerous for your setup
41 opt="rm -rf /usr/lib/mindi ;"
42fi
43if [ "`echo $c | grep mondo`" != "" ]; then
44 cd ${BASE}/svn
45 $TOOLHOME/mkspec ${MONDO_VER} mondo-${MONDO_VER}/distributions/rpm/mondo.spec > ${TOPDIR}/SPECS/mondo.spec
46 rm -rf mondo-${MONDO_VER}/distributions
47
48 pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-${REVISION}${suf}.${ARCH}.rpm"
49fi
50
51cd ${TOPDIR}/SPECS
52status=0
53if [ "`echo $c | grep kernel`" != "" ]; then
54 echo "Generating mindi-kernel RPMS"
55 log=/tmp/mindi-kernel-rpm.log
56 rpmbuild -ba mindi-kernel.spec 2> $log 1> $log
57 if [ $? != 0 ]; then
58 cat $log
59 status=-1
60 fi
61fi
62if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
63 echo "Generating mindi RPMS"
64 log=/tmp/mindi-rpm.log
65 rpmbuild -ba mindi.spec 2> $log 1> $log
66 if [ $? != 0 ]; then
67 cat $log
68 status=-1
69 fi
70fi
71if [ "`echo $c | grep mondo`" != "" ]; then
72 echo "Generating mondo RPMS"
73 log=/tmp/mondo-rpm.log
74 rpmbuild -ba mondo.spec 2> $log 1> $log
75 if [ $? != 0 ]; then
76 cat $log
77 status=-1
78 fi
79fi
80if [ $status = 0 ]; then
81 echo "Installing RPMS as root ($pkg)"
82 su - -c "$opt rpm -Uvh --force $pkg"
83fi
Note: See TracBrowser for help on using the repository browser.