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

Last change on this file since 1508 was 1508, checked in by Bruno Cornec, 17 years ago
  • Add scsi_transport_sas to SCSI_MODS for LSI SAS1064E on CentOS 5 (Brandon Poyner bpoyner_at_ccac.edu)
  • Fix a bug on the MODULE variable and grep -F usage with spaces.
  • Fix Virtual media usage (Patrick Albert)
  • Also computes number of media for NFS backups
  • Do not launch 64 bits versions if called with specific VMs
  • Improve message around ISO directory (Patrick Albert and Bryan Gartner)
  • Fix mondo mailing list archive link
  • Ubuntu version is 6.06
  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Script build packages on various distributions with qemu
6#
7
8#if [ _"$1" = _"" ]; then
9 #echo "Syntax: build2qemu [version-tag [vm1]..|vmx]] )"
10 #exit -1
11#fi
12
13# Syntax: build2qemu [version-tag [--pkg "pkg1...pkgn"] [vm1]..|vmx]]
14
15(
16dname=`dirname $0`
17prem=`echo $dname |cut -c1`
18if [ _${prem} = _"/" ]; then
19 export TOOLHOME=$dname
20else
21 export TOOLHOME=${PWD}/$dname
22fi
23
24. $TOOLHOME/common-env
25. $TOOLHOME/distro-env
26. $TOOLHOME/qemu-env
27
28# We need to get $VER and $TAG
29if [ "$1" = "" ]; then
30 LAST=`cat ${TOPDIR}/LAST`
31else
32 LAST=$1
33 shift
34fi
35VER=`echo $LAST | cut -d- -f1`
36TAG=`echo $LAST | cut -d- -f2`
37echo "Working on ${VER}-$TAG"
38
39c=""
40if [ _"$1" = _"--pkg" ]; then
41 shift
42 c=$1
43 shift
44fi
45
46if [ _"$1" = _"" ]; then
47 export VMS=`cat ${TOOLHOME}/DISTROS`
48 single=0
49else
50 export VMS="$*"
51 single=1
52fi
53
54VMS64=`echo $VMS | perl -pi -e 's/\b([A-z0-9_.]+)\b/$1_64/g'`
55
56cat > $MONDOTMP/mkmondo << EOF
57#!/bin/bash
58
59export LANG="C"
60export LANGUAGE="C"
61export LC_ALL="C"
62export TOOLHOME=$TOOLHOME
63
64$TOOLHOME/build2pkg $LAST $c < /dev/null
65$TOOLHOME/pkg2ftp $LAST $c
66EOF
67chmod 755 $MONDOTMP/mkmondo
68
69if [ $single -eq 0 ]; then
70 $TOOLHOME/file2ftp
71 ALLVMS="$VMS $VMS64"
72else
73 ALLVMS="$VMS"
74fi
75
76# TOPDIR contains ../.. which causes problems to tar
77# so we need to recompute it
78cd $TOPDIR
79dir=`pwd`
80tar cfz $MONDOTMP/mkmondo.tar.gz $TOOLHOME $MONDOTMP/mkmondo $dir/${VER}-$TAG
81
82for m in $ALLVMS; do
83 echo "Working on $m"
84 vmp=0
85 if [ ! -f /users/qemu/$m.qemu ]; then
86 echo $m | grep -Eq '_64$'
87 if [ $? -eq 0 ]; then
88 echo "VM unaccessible. No x86_64 version yet probably"
89 continue
90 else
91 echo "VM unaccessible. Verify NFS mount"
92 rm -rf $MONDOTMP
93 exit -1
94 fi
95 fi
96 ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu
97 if [ $? -ne 0 ]; then
98 # Virtual machine alreday started
99 vmp=1
100 $TOOLHOME/mkqemu $m &
101 sleep 300
102 fi
103 scp -P $sp $MONDOTMP/mkmondo.tar.gz ~/.rpmmacros ~/.rpmrc bruno@localhost:
104 rdate=`date "+%m%d%H%M"`
105 ssh -q -p $sp root@localhost "date $rdate"
106 ssh -q -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
107 if [ $vmp -eq 1 ]; then
108 ssh -q -p $sp root@localhost "halt -p"
109 sleep 300
110 proces=`ps auxww | grep qemu | grep -v grep | grep /users/qemu/$m.qemu | awk '{print $2}'`
111 if [ "$proces" != "" ]; then
112 kill $proces
113 sleep 10
114 fi
115 fi
116done
117
118# Should be removed at the end
119rm -rf $MONDOTMP
120) 2>&1 | tee /tmp/build2qemu.log
Note: See TracBrowser for help on using the repository browser.