|
86 | 86 | if [ "$VM_ISO_LINK" ]; then |
87 | 87 | #start from iso, install to the vir disk |
88 | 88 |
|
89 | | - $vmsh createVM $VM_ISO_LINK $osname $ostype $sshport |
| 89 | + $vmsh createVM "$VM_ISO_LINK" "$osname" "$ostype" "$sshport" "$VM_PRE_DISK_LINK" |
90 | 90 |
|
91 | 91 | sleep 2 |
92 | 92 |
|
@@ -182,7 +182,9 @@ start_and_wait() { |
182 | 182 | } |
183 | 183 |
|
184 | 184 | shutdown_and_wait() { |
185 | | - ssh $osname "$VM_SHUTDOWN_CMD" |
| 185 | + if ! ssh -o ConnectTimeout=5 -o ServerAliveInterval=2 $osname "$VM_SHUTDOWN_CMD"; then |
| 186 | + echo "shutdown $?, haiku? but we just ignore it." |
| 187 | + fi |
186 | 188 |
|
187 | 189 | sleep 30 |
188 | 190 |
|
@@ -247,8 +249,10 @@ echo >>enablessh.local |
247 | 249 |
|
248 | 250 | cat enablessh.local |
249 | 251 |
|
250 | | - |
251 | | -if [ "$VM_USE_SSHROOT_BUILD_SSH" ]; then |
| 252 | +if [ -e "hooks/enablessh.sh" ]; then |
| 253 | + cat "hooks/enablessh.sh" |
| 254 | + . "hooks/enablessh.sh" |
| 255 | +elif [ "$VM_USE_SSHROOT_BUILD_SSH" ]; then |
252 | 256 | vmip=$($vmsh getVMIP $osname) |
253 | 257 | sshpass -p "$VM_ROOT_PASSWORD" ssh -o StrictHostKeyChecking=no -tt root@$vmip TERM=xterm <enablessh.local |
254 | 258 | #sleep for the sshd server to restart |
|
393 | 397 | ssh $osname 'cat ~/.ssh/id_rsa.pub' >$output-id_rsa.pub |
394 | 398 |
|
395 | 399 |
|
| 400 | +if [ -z "$VM_NO_REBOOT_CRONTAB" ]; then |
396 | 401 |
|
397 | 402 | #upload reboot.sh |
398 | 403 | if [ -e "hooks/reboot.sh" ]; then |
@@ -437,6 +442,10 @@ crontab -l |
437 | 442 |
|
438 | 443 | EOF |
439 | 444 |
|
| 445 | +#VM_NO_REBOOT_CRONTAB |
| 446 | + |
| 447 | +fi |
| 448 | + |
440 | 449 |
|
441 | 450 | # Install any requested packages |
442 | 451 | if [ "$VM_PRE_INSTALL_PKGS" ]; then |
@@ -489,7 +498,14 @@ if [ -z "$VM_RSYNC_PKG$VM_SSHFS_PKG" ]; then |
489 | 498 | else |
490 | 499 | $vmsh addSSHAuthorizedKeys $output-id_rsa.pub |
491 | 500 | $vmsh startVM $osname |
492 | | - $vmsh waitForVMReady $osname |
| 501 | + if [ -z "$VM_NO_REBOOT_CRONTAB" ]; then |
| 502 | + $vmsh waitForVMReady $osname |
| 503 | + else |
| 504 | + while ! timeout 5 ssh $osname exit; do |
| 505 | + echo not ready yet, just sleep. |
| 506 | + sleep 5 |
| 507 | + done |
| 508 | + fi |
493 | 509 | #these packages should also be installed before. |
494 | 510 | #so remove the following code, since openIndiana returns error 4 if sshfs is already installed. |
495 | 511 | #if [ "$VM_RSYNC_PKG" ]; then |
@@ -524,9 +540,15 @@ else |
524 | 540 | ssh $osname cat /etc/ssh/sshd_config |
525 | 541 | exit 1 |
526 | 542 | fi |
527 | | - #check if the /home dir is writable |
528 | | - ssh $osname mkdir -p $HOME/work |
529 | | - ssh $osname ls -lah $HOME |
| 543 | + if [ "$osname" = "haiku" ]; then |
| 544 | + #it's /boot/home |
| 545 | + ssh $osname mkdir -p '$HOME/work' |
| 546 | + ssh $osname ls -lah '$HOME' |
| 547 | + else |
| 548 | + #check if the /home dir is writable |
| 549 | + ssh $osname mkdir -p $HOME/work |
| 550 | + ssh $osname ls -lah $HOME |
| 551 | + fi |
530 | 552 | fi |
531 | 553 |
|
532 | 554 | echo "Build finished." |
|
0 commit comments