| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright 2014 Google Inc. | 3 # Copyright 2014 Google Inc. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 | 8 |
| 9 usage() { | 9 usage() { |
| 10 cat >&2 <<EOF | 10 cat >&2 <<EOF |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 DISPLAY='' nohup \ | 112 DISPLAY='' nohup \ |
| 113 "$foundation" \ | 113 "$foundation" \ |
| 114 --image="${firmware}" \ | 114 --image="${firmware}" \ |
| 115 --cores=4 \ | 115 --cores=4 \ |
| 116 --block-device="${rootfs}" \ | 116 --block-device="${rootfs}" \ |
| 117 --network="nat" \ | 117 --network="nat" \ |
| 118 --network-nat-subnet="192.168.31.0/24" \ | 118 --network-nat-subnet="192.168.31.0/24" \ |
| 119 --network-nat-ports="8022=22" \ | 119 --network-nat-ports="8022=22" \ |
| 120 > /dev/null 2>&1 & | 120 > /dev/null 2>&1 & |
| 121 echo 'Waiting for foundation model to boot...' |
| 122 while ! ssh -i "${working_dir}/key" \ |
| 123 -o NoHostAuthenticationForLocalhost=yes \ |
| 124 -p 8022 user@localhost true 2> /dev/null; do |
| 125 sleep 5 |
| 126 done |
| 121 echo 'Listening to SSH on port 8022.' | 127 echo 'Listening to SSH on port 8022.' |
| 122 } | 128 } |
| 123 | 129 |
| 124 arm64_download() { | 130 arm64_download() { |
| 125 local working_directory="$1" | 131 local working_directory="$1" |
| 126 try mkdir -p "$working_directory" || return | 132 try mkdir -p "$working_directory" || return |
| 127 | 133 |
| 128 try download_necessary_software_to_dir "$working_directory" || return | 134 try download_necessary_software_to_dir "$working_directory" || return |
| 129 | 135 |
| 130 try install_compiler "$working_directory" || return | 136 try install_compiler "$working_directory" || return |
| 131 | 137 |
| 132 try install_runtime "$working_directory" || return | 138 try install_runtime "$working_directory" || return |
| 133 | 139 |
| 134 try start_arm64_image "$working_directory" || return | 140 try start_arm64_image "$working_directory" || return |
| 135 | 141 |
| 136 try start_arm64_image \ | 142 try start_arm64_image \ |
| 137 "$working_directory" \ | 143 "$working_directory" \ |
| 138 || return | 144 || return |
| 139 } | 145 } |
| 140 | 146 |
| 141 for command in gsutil xz tar md5sum gunzip; do | 147 for command in gsutil xz tar md5sum gunzip; do |
| 142 try command -v "$command" > /dev/null || usage || exit | 148 try command -v "$command" > /dev/null || usage || exit |
| 143 done | 149 done |
| 144 | 150 |
| 145 if [ -z "$1" ] ; then | 151 if [ -z "$1" ] ; then |
| 146 usage || exit | 152 usage || exit |
| 147 fi | 153 fi |
| 148 try arm64_download "$1" | 154 try arm64_download "$1" |
| OLD | NEW |