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

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

Fix for RedHat 7.3 compiler. declarations should happen earlier.

  • Property svn:executable set to *
File size: 2.3 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 [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
22fi
23
24
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`
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
39if [ _"$1" == _"" ]; then
40 export VMS=`cat ${TOOLHOME}/DISTROS`
41 single=0
42else
43 export VMS="$*"
44 single=1
45fi
46
47mkdir -p $TMP
48cat > $TMP/mkmondo << EOF
49#!/bin/bash
50
51export LANG="C"
52export LANGUAGE="C"
53export LC_ALL="C"
54export TOOLHOME=$TOOLHOME
55
56$TOOLHOME/build2pkg $LAST < /dev/null
57$TOOLHOME/pkg2ftp $LAST
58EOF
59chmod 755 $TMP/mkmondo
60
61if [ $single -eq 0 ]; then
62 $TOOLHOME/file2ftp
63fi
64cd $TOOLHOME/..
65tar cfz $TMP/mkmondo.tar.gz $TOOLHOME $TMP/mkmondo $TOPDIR/${VER}-$TAG
66
67for m in $VMS; do
68 vmp=0
69 if [ ! -f /users/qemu/$m.qemu ]; then
70 echo "VM unaccessible. Verify NFS mount"
71 rm -rf $TMP
72 exit -1
73 fi
74 export sp=2223
75 ps auxww | grep qemu | grep -v grep | grep -q /users/qemu/$m.qemu
76 if [ $? -ne 0 ]; then
77 # Virtual machine alreday started
78 vmp=1
79 $TOOLHOME/mkqemu $m &
80 sleep 300
81 fi
82 ssh -p $sp root@localhost "perl -pi -e 's|/home/bruno|/users/bruno|' /etc/passwd /home/bruno/.rpmmacros ; mv /home /users; rpm -e tetex tetex-latex passivetex jadetex texinfo xmltex linuxdoc-tools xmlto docbook-utils-pdf subversion tetex-context tetex-dvips docbook-utils"
83 rdate=`date "+%m%d%H%M"`
84 ssh -p $sp root@localhost "date $rdate"
85 scp -P $sp $TMP/mkmondo.tar.gz bruno@localhost:
86 ssh -p $sp bruno@localhost "cd / ; rm -rf ~bruno/mondo ~bruno/RPMS/BUILD/* ~bruno/RPMS/tmp/* /tmp/* ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo " | tee $TMP/mkvm.log
87 #ssh -p $sp bruno@localhost "cd / ; tar xfz ~bruno/mkmondo.tar.gz ; $TMP/mkmondo ; rm -f $TMP" | tee $TMP/mkvm.log
88 if [ $vmp -eq 1 ]; then
89 ssh -p $sp root@localhost "halt -p"
90 sleep 300
91 proces=`ps auxww | grep qemu | grep -v grep | grep /users/qemu/$m.qemu | awk '{print $2}'`
92 if [ "$proces" != "" ]; then
93 kill $proces
94 sleep 10
95 fi
96 fi
97done
98
99# Should be removed at the end
100rm -rf $TMP
Note: See TracBrowser for help on using the repository browser.