source: branches/stable/tools/mkqemu @ 553

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

Build process in 3 steps:

svn2build creates tar files from SVN (works mostly)
build2pkg creates packages from tar files (works mostly)
build2qemu (has to be created from mkqemu) will create packages for all supported virtuel machines

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