]>
Commit | Line | Data |
---|---|---|
e4bb5998 RD |
1 | #!/bin/bash |
2 | #---------------------------------------------------------------------- | |
3 | ||
4 | set -o errexit | |
5 | ||
6 | # read the config variables from the file given on the command line | |
7 | . $1 | |
8 | ||
9 | coHost=$2 | |
10 | host=$3 | |
11 | reltag=$4 | |
12 | shift;shift;shift;shift | |
13 | pyver=$@ | |
14 | ||
15 | ||
16 | function TestOnline { | |
17 | local host=$1 | |
18 | local message=$2 | |
19 | ||
20 | if ping -q -c1 -w1 $host > /dev/null; then | |
21 | return 0 | |
22 | else | |
23 | return 1 | |
24 | fi | |
25 | } | |
26 | ||
27 | ||
28 | if [ $skiplinux != yes ]; then | |
29 | ||
30 | startedCoHost=no | |
31 | hostAvailable=no | |
32 | ||
33 | # test if the target machine is online | |
34 | if TestOnline $host; then | |
35 | hostAvailable=yes | |
36 | else | |
37 | # Attempt to start the host via it's coLinux host, if there is one | |
38 | if [ $coHost != none ]; then | |
39 | if TestOnline $coHost; then | |
40 | echo "Attempting to start $host via coLinux on $coHost..." | |
41 | ssh $coHost "/c/coLinux/VMs/$host.bat -d > /dev/null 2>&1 &" | |
42 | ||
43 | # Give it time to boot and be ready for conenctions, | |
44 | # and then test with ssh, limiting retries. | |
45 | for x in `seq 12`; do | |
46 | sleep 5 | |
47 | echo "checking..." | |
48 | if ssh root@$host "true" >/dev/null 2>&1; then | |
49 | # success! the host is ready so we can break out of the loop | |
50 | break; | |
51 | fi | |
52 | done | |
53 | ||
54 | # test if the host is ready | |
55 | if TestOnline $host; then | |
56 | echo "coLinux start of $host on $coHost successful." | |
57 | startedCoHost=yes | |
58 | hostAvailable=yes | |
59 | fi | |
60 | else | |
61 | echo "The $coHost machine is offline, unable to start coLinux for $host" | |
62 | fi | |
63 | fi | |
64 | fi | |
65 | ||
66 | if [ $hostAvailable = yes ]; then | |
67 | echo "The $host machine is online, build continuing..." | |
68 | else | |
69 | echo "The $host machine is **OFFLINE**, skipping the binary RPM build." | |
70 | exit 0 | |
71 | fi | |
72 | ||
73 | ||
74 | echo "Copying source files and build script..." | |
75 | ssh root@$host "mkdir -p $LINUX_BUILD && rm -rf $LINUX_BUILD/*" | |
76 | scp $STAGING_DIR/wxPython-src* $STAGING_DIR/wxPython.spec\ | |
77 | distrib/all/do-build-rpm \ | |
78 | root@$host:$LINUX_BUILD | |
79 | ||
80 | echo "Running build script on $host..." | |
81 | cmd=./do-build-rpm | |
82 | ssh root@$host "cd $LINUX_BUILD && $cmd $reltag $skipclean $VERSION $pyver" | |
83 | ||
84 | echo "Fetching the results..." | |
85 | scp "root@$host:$LINUX_BUILD/wxPython*.i[0-9]86.rpm" $STAGING_DIR | |
86 | ssh root@$host "rm $LINUX_BUILD/wxPython*.i[0-9]86.rpm" | |
87 | ||
88 | ||
89 | if [ $startedCoHost = yes ]; then | |
90 | echo "Halting $host on $coHost..." | |
91 | ssh root@$host "/sbin/halt" | |
92 | sleep 10 | |
93 | fi | |
94 | fi |