Skip to content

Commit 258defb

Browse files
committed
Update from base builder
1 parent 542a03d commit 258defb

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

build.sh

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fi
8686
if [ "$VM_ISO_LINK" ]; then
8787
#start from iso, install to the vir disk
8888

89-
$vmsh createVM $VM_ISO_LINK $osname $ostype $sshport
89+
$vmsh createVM "$VM_ISO_LINK" "$osname" "$ostype" "$sshport" "$VM_PRE_DISK_LINK"
9090

9191
sleep 2
9292

@@ -182,7 +182,9 @@ start_and_wait() {
182182
}
183183

184184
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
186188

187189
sleep 30
188190

@@ -247,8 +249,10 @@ echo >>enablessh.local
247249

248250
cat enablessh.local
249251

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
252256
vmip=$($vmsh getVMIP $osname)
253257
sshpass -p "$VM_ROOT_PASSWORD" ssh -o StrictHostKeyChecking=no -tt root@$vmip TERM=xterm <enablessh.local
254258
#sleep for the sshd server to restart
@@ -393,6 +397,7 @@ fi
393397
ssh $osname 'cat ~/.ssh/id_rsa.pub' >$output-id_rsa.pub
394398

395399

400+
if [ -z "$VM_NO_REBOOT_CRONTAB" ]; then
396401

397402
#upload reboot.sh
398403
if [ -e "hooks/reboot.sh" ]; then
@@ -437,6 +442,10 @@ crontab -l
437442
438443
EOF
439444

445+
#VM_NO_REBOOT_CRONTAB
446+
447+
fi
448+
440449

441450
# Install any requested packages
442451
if [ "$VM_PRE_INSTALL_PKGS" ]; then
@@ -489,7 +498,14 @@ if [ -z "$VM_RSYNC_PKG$VM_SSHFS_PKG" ]; then
489498
else
490499
$vmsh addSSHAuthorizedKeys $output-id_rsa.pub
491500
$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
493509
#these packages should also be installed before.
494510
#so remove the following code, since openIndiana returns error 4 if sshfs is already installed.
495511
#if [ "$VM_RSYNC_PKG" ]; then
@@ -524,9 +540,15 @@ else
524540
ssh $osname cat /etc/ssh/sshd_config
525541
exit 1
526542
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
530552
fi
531553

532554
echo "Build finished."

0 commit comments

Comments
 (0)