source: trunk/tools/build2qemu @ 561

Last change on this file since 561 was 561, checked in by bcornec, 13 years ago

merge -r 542:560 $SVN_M/branches/stable

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Script build packages on various distributions with qemu
6#
7
8if [ _"$1" == _"" ]; then
9    echo "Syntax: build2qemu [version-tag [vm1]..|vmx]] )"
10    exit -1
11fi
12
13. $TOOLHOME/common-env
14. $TOOLHOME/distro-env
15
16# We need to get $VER and $TAG
17if [ "$1" = "" ]; then
18    LAST=`cat ${TOPDIR}/LAST`
19else
20    LAST=$1
21    shift
22fi
23VER=`echo $LAST | cut -d- -f1`
24TAG=`echo $LAST | cut -d- -f2`
25echo "Working on ${VER}-$TAG"
26
27if [ _"$1" == _"" ]; then
28    export VMS=`cat ${TOOLHOME}/DISTROS` 
29else
30    export VMS="$1"
31fi
32
33
34cat > $TMP/mkmondo << EOF
35#!/bin/bash
36
37export LANG="C"
38export LANGUAGE="C"
39export LC_ALL="C"
40export TOOLHOME=$TOOLHOME
41
42\$TOOLHOME/build2pkg
43\$TOOLHOME/mkdeliv
44EOF
45chmod 755 $TMP/mkmondo
46
47cd $TOOLHOME/..
48tar cvfz $TMP/mkmondo.tar.gz $TOOLHOME/tools $TMP/mkmondo $TOPDIR/${VER}-$TAG
49
50for m in $VMS; do
51    vmp=0
52    if [ ! -f /users/qemu/$m.qemu ]; then
53            echo "VM unaccessible. Verify NFS mount"
54            exit -1
55    fi
56    ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu
57    if [ $? -ne 0 ]; then
58        # Virtual machine alreday started
59        vmp=1
60        $TOOLHOME/mkqemu $m &
61        sleep 300
62    fi
63    scp -P $sp $TMP/mkmondo.tar.gz bruno@localhost:
64    ssh -p $sp bruno@localhost "cd / ; tar xvfz $TMP/mkmondo.tar.gz ; $TMP/mkmondo" | tee $TMP/mkvm.log
65    if [ $vmp -eq 1 ]; then
66        ssh -p $sp root@localhost "halt -p"
67        sleep 300
68        proces=`ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu | awk '{print $2}'`
69        if [ "$proces" != "" ]; then
70            kill $proces
71        fi
72    fi
73done
Note: See TracBrowser for help on using the repository browser.