source: branches/2.06/tools/mkrpm @ 311

Last change on this file since 311 was 311, checked in by bcornec, 15 years ago
  • no Mindi in install.sh anymore
  • mkrpm now use svn log correctly from the right place
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs packages from SVN repository for local tests
4#
5# $Id: mkrpm 311 2006-01-13 09:08:03Z 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
19# To be safe for SVN commands
20cd $TOOLHOME/..
21rev=`$TOOLHOME/mksvnversion`
22svn log -v > /tmp/mondorescue-svn.log
23
24if [ "$1" = "" ]; then
25    c="mindi mondo"
26else
27    c=$1
28fi
29if [ "`echo $c | grep mindi-kernel`" != "" ]; then
30    cd ${BASE}/svn
31    echo "Management of mindi-kernel ${MINDI_VER}"
32    rm -fr mindi-kernel-${MINDI_VER}
33    cp -a ${VER}/mindi-kernel mindi-kernel-${MINDI_VER}
34    find mindi-kernel-${MINDI_VER} -type d -name .svn | xargs rm -rf
35    find mindi-kernel-${MINDI_VER} -type f -name '.*.swp' | xargs rm -rf
36    find mindi-kernel-${MINDI_VER} -type f -name '*~' | xargs rm -rf
37    mkdir -p ${TOPDIR}/SOURCES
38    tar cvfhz ${TOPDIR}/SOURCES/mindi-kernel-${MINDI_VER}.tgz mindi-kernel-${MINDI_VER}
39    tar cvfhj ${TOPDIR}/SOURCES/mindi-kernel-${MINDI_VER}.tar.bz2 mindi-kernel-${MINDI_VER}
40    sed "s/^%define mrel..*/%define mrel    ${rev}.${suf}/" mindi-kernel-${MINDI_VER}/mindi-kernel.spec > ${TOPDIR}/SPECS/mindi-kernel.spec
41    rm -f ${TMP}/mindi-kernel*-root
42    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-kernel-${MINDI_VER}-${rev}.${suf}.${ARCH}.rpm"
43fi
44if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
45    cd ${BASE}/svn
46    echo "Management of mindi ${MINDI_VER}"
47    rm -fr mindi-${MINDI_VER}
48    cp -a ${VER}/mindi mindi-${MINDI_VER}
49    cp -a /tmp/mondorescue-svn.log mindi-${MINDI_VER}/svn.log
50    find mindi-${MINDI_VER} -type d -name .svn | xargs rm -rf
51    find mindi-${MINDI_VER} -type f -name '.*.swp' | xargs rm -rf
52    find mindi-${MINDI_VER} -type f -name '*~' | xargs rm -rf
53    rm -f mindi-${MINDI_VER}/parted2fdisk mindi-${MINDI_VER}/parted2fdisk.c mindi-${MINDI_VER}/rootfs/sbin/parted2fdisk-ia64
54    mkdir -p ${TOPDIR}/SOURCES
55    tar cvfhz ${TOPDIR}/SOURCES/mindi-${MINDI_VER}.tgz mindi-${MINDI_VER}
56    tar cvfhj ${TOPDIR}/SOURCES/mindi-${MINDI_VER}.tar.bz2 mindi-${MINDI_VER}
57    sed -e "s/^%define mrel..*/%define mrel ${rev}.${suf}/" -e "s/VVV/${MINDI_VER}/" mindi-${MINDI_VER}/mindi.spec > ${TOPDIR}/SPECS/mindi.spec
58    rm -f ${TMP}/mindi-*-root
59    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-${rev}.${suf}.${ARCH}.rpm"
60    # ATTENTION: This could be dangerous for your setup
61    opt="rm -rf /usr/lib/mindi ;"
62fi
63if [ "`echo $c | grep  mondo`" != "" ]; then
64    cd ${BASE}/svn
65    echo "Management of mondo ${MONDO_VER}"
66    rm -rf mondo-${MONDO_VER}
67    cp -a ${VER}/mondo mondo-${MONDO_VER}
68    cp -a /tmp/mondorescue-svn.log mondo-${MONDO_VER}/svn.log
69    cd mondo-${MONDO_VER}
70    echo "Bootstraping mondo ... "
71    ./bootstrap
72    find . -type d -name .svn | xargs rm -rf
73    find . -type f -name '.*.swp' | xargs rm -rf
74    find . -type f -name '*~' | xargs rm -rf
75    cd ..
76    tar cvfhz ${TOPDIR}/SOURCES/mondo-${MONDO_VER}.tgz mondo-${MONDO_VER}
77    tar cvfhj ${TOPDIR}/SOURCES/mondo-${MONDO_VER}.tar.bz2 mondo-${MONDO_VER}
78    sed -e "s/^%define mrel..*/%define mrel ${rev}.${suf}/" -e "s/VVV/${MONDO_VER}/" mondo-${MONDO_VER}/mondo.spec > ${TOPDIR}/SPECS/mondo.spec
79    rm -f ${TMP}/mondo-*-root
80    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-${rev}.${suf}.${ARCH}.rpm"
81fi
82cd ${TOPDIR}/SPECS
83if [ "`echo $c | grep kernel`" != "" ]; then
84    rpmbuild -ba mindi-kernel.spec
85fi
86if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
87    rpmbuild -ba mindi.spec
88fi
89if [ "`echo $c | grep mondo`" != "" ]; then
90    rpmbuild -ba mondo.spec
91fi
92su - -c "$opt rpm -Uvh --force $pkg"
Note: See TracBrowser for help on using the repository browser.