Drop redundant VM_BASE_SSH_PORT
Use VM_SSH_PORT from config.base instead of VM_BASE_SSH_PORT; remove references to VM_BASE_SSH_PORT. Make vm_install_base pass vm_name instead of VM_BASE_SSH_PORT to ssh_process_autostart (same as _vbox_boot_with_autostart). Have ssh_process_autostart actually make use of the argument it gets passed. Change-Id: I61434760554c38c0cc55995288c9d878a2c6a6bf
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
# Used by osbash.sh and guest scripts
|
||||
|
||||
# Port used for ssh forwarding when building base disk
|
||||
: ${VM_BASE_SSH_PORT:=2229}
|
||||
|
||||
: ${OSBASH_LIB_DIR:=$LIB_DIR/osbash}
|
||||
: ${OSBASH_SCRIPTS_DIR:=$SCRIPTS_DIR/osbash}
|
||||
|
||||
|
||||
@@ -155,6 +155,8 @@ function ssh_exec_script {
|
||||
|
||||
# Wait for sshd, prepare autostart dirs, and execute autostart scripts on VM
|
||||
function ssh_process_autostart {
|
||||
local vm_name=$1
|
||||
|
||||
# Run this function in sub-shell to protect our caller's environment
|
||||
# (which might be _our_ enviroment if we get called again)
|
||||
(
|
||||
|
||||
@@ -28,9 +28,6 @@ function vm_install_base {
|
||||
local base_build_disk=$DISK_DIR/tmp-disk.vdi
|
||||
local vm_name=base
|
||||
|
||||
# Port used for ssh forwarding when building base disk
|
||||
: ${VM_BASE_SSH_PORT:=2229}
|
||||
|
||||
echo >&2 "$(date) osbash vm_install starts."
|
||||
|
||||
${WBATCH:-:} wbatch_begin_base
|
||||
@@ -75,8 +72,13 @@ function vm_install_base {
|
||||
# Set up communication with base VM: ssh port forwarding by default,
|
||||
# VirtualBox shared folders for wbatch
|
||||
|
||||
(
|
||||
# Get the VM_SSH_PORT for the base disk
|
||||
source "$CONFIG_DIR/config.$vm_name"
|
||||
|
||||
# wbatch runs cannot use ssh, so skip port forwarding in that case
|
||||
${WBATCH:+:} vm_port "$vm_name" ssh "$VM_BASE_SSH_PORT" 22
|
||||
${WBATCH:+:} vm_port "$vm_name" ssh "$VM_SSH_PORT" 22
|
||||
)
|
||||
|
||||
# Automounted on /media/sf_bootstrap for first boot
|
||||
${WBATCH:-:} vm_add_share_automount "$vm_name" "$SHARE_DIR" bootstrap
|
||||
@@ -112,7 +114,7 @@ function vm_install_base {
|
||||
|
||||
# Wait for ssh connection and execute scripts in autostart directory
|
||||
# (for wbatch, osbashauto does the processing instead)
|
||||
${WBATCH:+:} ssh_process_autostart "$VM_BASE_SSH_PORT" &
|
||||
${WBATCH:+:} ssh_process_autostart "$vm_name" &
|
||||
# After reboot
|
||||
wait_for_autofiles
|
||||
echo -e >&2 "${CStatus:-}Installation done for VM ${CData:-}$vm_name${CReset:-}"
|
||||
|
||||
Reference in New Issue
Block a user