source: MondoRescue/branches/stable/tools/build2qemu@ 888

Last change on this file since 888 was 888, checked in by Bruno Cornec, 18 years ago
  • Build process improved following 2.2.0 delivery
  • Announce of 2.2.0
  • On mandriva we need a BuildRequire on glibc-static-devel for mindi-busybox
  • Fix again a remaining bug on #25 (Thanks Michael Shapiro again !)
  • Property svn:executable set to *
File size: 2.3 KB
RevLine 
[440]1#!/bin/bash
2#
3# $Id$
4#
[553]5# Script build packages on various distributions with qemu
[440]6#
7
[572]8#if [ _"$1" == _"" ]; then
9 #echo "Syntax: build2qemu [version-tag [vm1]..|vmx]] )"
10 #exit -1
11#fi
12
13# Syntax: build2qemu [version-tag [vm1]..|vmx]]
14
[757]15(
[572]16dname=`dirname $0`
17prem=`echo $dname |cut -c1`
18if [ ${prem} == "/" ]; then
19 export TOOLHOME=$dname
20else
21 export TOOLHOME=${PWD}/$dname
[440]22fi
23
[572]24
[553]25. $TOOLHOME/common-env
26. $TOOLHOME/distro-env
27
28# We need to get $VER and $TAG
29if [ "$1" = "" ]; then
30 LAST=`cat ${TOPDIR}/LAST`
[440]31else
[553]32 LAST=$1
33 shift
[440]34fi
[553]35VER=`echo $LAST | cut -d- -f1`
36TAG=`echo $LAST | cut -d- -f2`
37echo "Working on ${VER}-$TAG"
[440]38
[553]39if [ _"$1" == _"" ]; then
[556]40 export VMS=`cat ${TOOLHOME}/DISTROS`
[596]41 single=0
[553]42else
[596]43 export VMS="$*"
44 single=1
[553]45fi
46
[882]47cat > $MONDOTMP/mkmondo << EOF
[440]48#!/bin/bash
49
50export LANG="C"
51export LANGUAGE="C"
52export LC_ALL="C"
[553]53export TOOLHOME=$TOOLHOME
[440]54
[596]55$TOOLHOME/build2pkg $LAST < /dev/null
56$TOOLHOME/pkg2ftp $LAST
[440]57EOF
[882]58chmod 755 $MONDOTMP/mkmondo
[440]59
[596]60if [ $single -eq 0 ]; then
61 $TOOLHOME/file2ftp
62fi
[553]63
[888]64# TOPDIR contains ../.. which causes problems to tar
65# so we need to recompute it
66cd $TOPDIR
67dir=`pwd`
68tar cfz $MONDOTMP/mkmondo.tar.gz $TOOLHOME $MONDOTMP/mkmondo $dir/${VER}-$TAG
69
[553]70for m in $VMS; do
[440]71 vmp=0
[556]72 if [ ! -f /users/qemu/$m.qemu ]; then
[440]73 echo "VM unaccessible. Verify NFS mount"
[882]74 rm -rf $MONDOTMP
[440]75 exit -1
76 fi
[721]77 if [ _"$sp" = _"" ]; then
78 export sp=2222
79 fi
[556]80 ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu
[440]81 if [ $? -ne 0 ]; then
82 # Virtual machine alreday started
83 vmp=1
[556]84 $TOOLHOME/mkqemu $m &
[519]85 sleep 300
[440]86 fi
[882]87 scp -P $sp $MONDOTMP/mkmondo.tar.gz ~/.rpmmacros ~/.rpmrc bruno@localhost:
[599]88 rdate=`date "+%m%d%H%M"`
89 ssh -p $sp root@localhost "date $rdate"
[882]90 ssh -p $sp bruno@localhost "cd / ; rm -rf ~bruno/mondo ~bruno/RPMS/BUILD/* ~bruno/RPMS/tmp/* /tmp/* ; tar xfz ~bruno/mkmondo.tar.gz ; $MONDOTMP/mkmondo " | tee $MONDOTMP/mkvm.log
91 #ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $MONDOTMP/mkmondo ; rm -f $MONDOTMP" | tee $MONDOTMP/mkvm.log
[440]92 if [ $vmp -eq 1 ]; then
[441]93 ssh -p $sp root@localhost "halt -p"
[519]94 sleep 300
[599]95 proces=`ps auxww | grep qemu | grep -v grep | grep /users/qemu/$m.qemu | awk '{print $2}'`
[519]96 if [ "$proces" != "" ]; then
97 kill $proces
[603]98 sleep 10
[519]99 fi
[440]100 fi
101done
[572]102
103# Should be removed at the end
[882]104rm -rf $MONDOTMP
[757]105) 2>&1 | tee /tmp/build2qemu.log
Note: See TracBrowser for help on using the repository browser.