Skip to content

Commit

Permalink
Fix apt install (#11781)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh authored Jun 21, 2022
1 parent d4ae313 commit 1e51bfe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
24 changes: 13 additions & 11 deletions apps/microtvm/reference-vm/base-box-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@

# Extra scripts required to execute on provisioning
# in [platform]/base-box/base_box_provision.sh
COMMON_SCRIPTS = [
"apps/microtvm/reference-vm/base_box_setup_common.sh",
"docker/install/ubuntu_install_core.sh",
"docker/install/ubuntu_install_python.sh",
"docker/utils/apt-install-and-clear.sh",
]

EXTRA_SCRIPTS = {
"arduino": (
"apps/microtvm/reference-vm/base_box_setup_common.sh",
"docker/install/ubuntu_install_core.sh",
"docker/install/ubuntu_install_python.sh",
),
"zephyr": (
"apps/microtvm/reference-vm/base_box_setup_common.sh",
"docker/install/ubuntu_install_core.sh",
"docker/install/ubuntu_install_python.sh",
"arduino": [],
"zephyr": [
"docker/install/ubuntu_init_zephyr_project.sh",
"docker/install/ubuntu_install_zephyr_sdk.sh",
"docker/install/ubuntu_install_cmsis.sh",
),
],
}

PACKER_FILE_NAME = "packer.json"
Expand Down Expand Up @@ -251,7 +251,9 @@ def generate_packer_config(platform, file_path, providers):
repo_root = subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], encoding="utf-8"
).strip()
for script in EXTRA_SCRIPTS[platform]:

scripts_to_copy = COMMON_SCRIPTS + EXTRA_SCRIPTS[platform]
for script in scripts_to_copy:
script_path = os.path.join(repo_root, script)
filename = os.path.basename(script_path)
provisioners.append({"type": "file", "source": script_path, "destination": f"~/{filename}"})
Expand Down
16 changes: 9 additions & 7 deletions apps/microtvm/reference-vm/base_box_setup_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
# specific language governing permissions and limitations
# under the License.

set -e
set -x

# Fix network DNS issue
sudo sed -i 's/DNSSEC=yes/DNSSEC=no/' /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved

sudo cp ~/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear
rm -f ~/apt-install-and-clear.sh

sudo apt update
sudo apt install -y build-essential
sudo apt-install-and-clear -y build-essential
sudo apt-get --purge remove modemmanager # required to access serial ports.

# Core
sudo ~/ubuntu_install_core.sh
rm -f ~/ubuntu_install_core.sh

sudo apt install -y --no-install-recommends git \
sudo apt-install-and-clear -y --no-install-recommends git \
gperf ccache dfu-util device-tree-compiler xz-utils file \
gcc gcc-multilib g++-multilib libsdl2-dev

Expand All @@ -40,22 +42,22 @@ wget --no-verbose https://apt.kitware.com/keys/kitware-archive-latest.asc
sudo apt-key add kitware-archive-latest.asc
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt update
sudo apt install -y --no-install-recommends \
sudo apt-install-and-clear -y --no-install-recommends \
cmake=3.22.2-0kitware1ubuntu18.04.1 cmake-data=3.22.2-0kitware1ubuntu18.04.1 \

# Python
sudo ~/ubuntu_install_python.sh
rm -f ~/ubuntu_install_python.sh

# Poetry deps
sudo apt install -y python3-venv
sudo apt-install-and-clear -y python3-venv

# TVM deps
# TODO(mehrdadh): replace with ubuntu_install_llvm.sh
sudo apt install -y llvm
sudo apt-install-and-clear -y llvm

# ONNX deps
sudo apt install -y protobuf-compiler libprotoc-dev
sudo apt-install-and-clear -y protobuf-compiler libprotoc-dev

# Poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3
Expand Down

0 comments on commit 1e51bfe

Please sign in to comment.