source: trunk/mkrpm @ 18

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

Common script for both ia64 and i386 dev. with a single HOME dir parameter.
Should now work for most installations

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs packages from SVN repository for local tests
4
5# Adapt to your needs
6BASE=/bruno/mondo
7# Look at opt below if this is dangerous for you or not.
8
9# Should not be modified below
10VER=trunk
11pkg=""
12opt=""
13ARCH=`/bin/arch`
14
15mkdir -p ${BASE}/RPMS
16TMP=${BASE}/tmp
17mkdir -p ${TMP}
18if [ -f ${HOME}/.rpmmacros ]; then
19    TOPDIR=`grep _topdir ${HOME}/.rpmmacros | awk '{print $2}'`
20else
21    TOPDIR=${BASE}/RPMS
22fi
23cd ${TOPDIR}
24mkdir -p RPMS SRPMS SPECS SOURCES BUILD
25
26if [ "$1" = "" ]; then
27    c="mindi mondo"
28else
29    c=$1
30fi
31if [ "`echo $c | grep mindi`" != "" ]; then
32    cd ${BASE}/svn
33    MINDI_VER=`cat ${VER}/mindi/mindi.spec | egrep '^Version:' | cut -d: -f2 | sed "s/[     ]*//"`
34    echo "Management of mindi ${MINDI_VER}"
35    rm -fr mindi-${MINDI_VER}
36    cp -a ${VER}/mindi mindi-${MINDI_VER}
37    find mindi-${MINDI_VER} -type d -name .svn | xargs rm -rf
38    find mindi-${MINDI_VER} -type f -name '.*.swp' | xargs rm -rf
39    rm -f mindi-${MINDI_VER}/parted2fdisk mindi-${MINDI_VER}/parted2fdisk.c mindi-${MINDI_VER}/rootfs/sbin/parted2fdisk-ia64
40    mkdir -p ${TOPDIR}/SOURCES
41    tar cvfhz ${TOPDIR}/SOURCES/mindi-${MINDI_VER}.tgz mindi-${MINDI_VER}
42    cp mindi-${MINDI_VER}/mindi.spec ${TOPDIR}/SPECS/mindi.spec
43    rm -f ${TMP}/mindi-*-root
44    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-1.${ARCH}.rpm"
45    # ATTENTION: This could be dangerous for your setup
46    opt="rm -rf /usr/share/mindi ;"
47fi
48if [ "`echo $c | grep  mondo`" != "" ]; then
49    cd ${BASE}/svn
50    MONDO_VER=`cat ${VER}/mondo/mondo.spec | egrep '^Version:' | cut -d: -f2 | sed "s/[     ]*//"`
51    rm -rf mondo-${MONDO_VER}
52    cp -a ${VER}/mondo mondo-${MONDO_VER}
53    cd mondo-${MONDO_VER}
54    echo "Bootstraping mondo ... "
55    ./bootstrap
56    find . -type d -name .svn | xargs rm -rf
57    find . -type f -name '.*.swp' | xargs rm -rf
58    cd ..
59    tar cvfhz ${TOPDIR}/SOURCES/mondo-${MONDO_VER}.tgz mondo-${MONDO_VER}
60    cp mondo-${MONDO_VER}/mondo.spec ${TOPDIR}/SPECS/mondo.spec
61    rm -f ${TMP}/mondo-*-root
62    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-1.${ARCH}.rpm"
63fi
64cd ${TOPDIR}/SPECS
65if [ "`echo $c | grep mindi`" != "" ]; then
66    rpmbuild -ba mindi.spec
67fi
68if [ "`echo $c | grep mondo`" != "" ]; then
69    rpmbuild -ba --without xmondo mondo.spec
70fi
71su - -c "$opt rpm -Uvh --force $pkg"
Note: See TracBrowser for help on using the repository browser.