source: MondoRescue/branches/2.0.8/tools/build2qemu@ 576

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

2.08 synced with stable as of r575
VERSION files updated

  • Property svn:executable set to *
File size: 1.8 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
15umask 022
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`
[553]41else
42 export VMS="$1"
43fi
44
[572]45mkdir -p $TMP
[553]46cat > $TMP/mkmondo << EOF
[440]47#!/bin/bash
48
49export LANG="C"
50export LANGUAGE="C"
51export LC_ALL="C"
[553]52export TOOLHOME=$TOOLHOME
[440]53
[572]54$TOOLHOME/build2pkg $LAST
55#$TOOLHOME/mkdeliv
[440]56EOF
[553]57chmod 755 $TMP/mkmondo
[440]58
[553]59cd $TOOLHOME/..
[572]60tar cfz $TMP/mkmondo.tar.gz $TOOLHOME $TMP/mkmondo $TOPDIR/${VER}-$TAG
[553]61
62for m in $VMS; do
[440]63 vmp=0
[556]64 if [ ! -f /users/qemu/$m.qemu ]; then
[440]65 echo "VM unaccessible. Verify NFS mount"
[572]66 rm -rf $TMP
[440]67 exit -1
68 fi
[556]69 ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu
[572]70 export sp=2222
[440]71 if [ $? -ne 0 ]; then
72 # Virtual machine alreday started
73 vmp=1
[556]74 $TOOLHOME/mkqemu $m &
[519]75 sleep 300
[440]76 fi
[553]77 scp -P $sp $TMP/mkmondo.tar.gz bruno@localhost:
[572]78 ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo " | tee $TMP/mkvm.log
79 #ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo ; rm -f $TMP" | tee $TMP/mkvm.log
[440]80 if [ $vmp -eq 1 ]; then
[441]81 ssh -p $sp root@localhost "halt -p"
[519]82 sleep 300
[556]83 proces=`ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu | awk '{print $2}'`
[519]84 if [ "$proces" != "" ]; then
85 kill $proces
86 fi
[440]87 fi
88done
[572]89
90# Should be removed at the end
91rm -rf $TMP
Note: See TracBrowser for help on using the repository browser.