1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Creates debs packages from SVN repository for local tests
|
---|
4 | #
|
---|
5 | # $Id: mkdeb 319 2006-01-14 10:44:12Z bcornec $
|
---|
6 | #
|
---|
7 |
|
---|
8 | umask 022
|
---|
9 | dname=`dirname $0`
|
---|
10 | prem=`echo $dname |cut -c1`
|
---|
11 | if [ ${prem} == "/" ]; then
|
---|
12 | export TOOLHOME=$dname
|
---|
13 | else
|
---|
14 | export TOOLHOME=${PWD}/$dname
|
---|
15 | fi
|
---|
16 |
|
---|
17 | . $TOOLHOME/deb-env
|
---|
18 |
|
---|
19 | if [ "$1" = "" ]; then
|
---|
20 | c="mindi mondo"
|
---|
21 | else
|
---|
22 | c=$1
|
---|
23 | fi
|
---|
24 |
|
---|
25 | $TOOLHOME/mkcommon "$c"
|
---|
26 |
|
---|
27 | if [ "`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"
|
---|
32 | fi
|
---|
33 | if [ "`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 ;"
|
---|
47 | fi
|
---|
48 | if [ "`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"
|
---|
59 | fi
|
---|
60 |
|
---|
61 | cd ${TOPDIR}/SPECS
|
---|
62 | status=0
|
---|
63 | if [ "`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
|
---|
71 | fi
|
---|
72 | if [ "`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
|
---|
80 | fi
|
---|
81 | if [ "`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
|
---|
89 | fi
|
---|
90 | if [ $status = 0 ]; then
|
---|
91 | echo "Installing RPMS as root ($pkg)"
|
---|
92 | su - -c "$opt rpm -Uvh --force $pkg"
|
---|
93 | fi
|
---|