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