From e881a441f6d9da76f34f8049f1f84658b9c57813 Mon Sep 17 00:00:00 2001 From: Alexey Rogachevskiy Date: Mon, 24 Feb 2020 02:21:05 +0300 Subject: [PATCH] clever_vm: Add scripts to install ROS and VSCode --- ros_ide_vm.json | 50 ++++++++++++++++++++++++++++++++ scripts/installGuestAdditions.sh | 7 +++++ scripts/installRos.sh | 9 ++++++ scripts/installRosUser.sh | 4 +++ scripts/installVsCode.sh | 11 +++++++ 5 files changed, 81 insertions(+) create mode 100644 ros_ide_vm.json create mode 100644 scripts/installGuestAdditions.sh create mode 100644 scripts/installRos.sh create mode 100644 scripts/installRosUser.sh create mode 100644 scripts/installVsCode.sh diff --git a/ros_ide_vm.json b/ros_ide_vm.json new file mode 100644 index 0000000..80a601d --- /dev/null +++ b/ros_ide_vm.json @@ -0,0 +1,50 @@ +{ + "variables": { + "user": "clever", + "password": "clever", + "vm-name": "clever-devel", + "scriptsDir": "scripts" + }, + "builders": [{ + "type": "virtualbox-ovf", + "vm_name": "{{user `vm-name`}}", + "source_path": "output-virtualbox-iso/{{user `vm-name`}}.ova", + "format": "ova", + + "vboxmanage": [ + ["modifyvm", "{{.Name}}", "--memory", "4096", "--vram", "128", "--mouse", "usbtablet", "--rtcuseutc", "on", "--usb", "on", "--usbxhci", "on"], + ["storageattach", "{{.Name}}", "--storagectl", "SATA Controller", "--port", "0", "--nonrotational", "on", "--discard", "on"] + ], + "import_opts": "importtovdi", + + "ssh_username": "{{user `user`}}", + "ssh_password": "{{user `password`}}", + "ssh_wait_timeout": "10000s", + + "boot_wait": "30s", + + "virtualbox_version_file": ".vbox_version", + + "shutdown_command": "echo '{{user `password`}}' | sudo -S shutdown -P now" + }], + "provisioners": [{ + "type": "shell", + "script": "scripts/installGuestAdditions.sh", + "execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S sh '{{.Path}}'" + }, + { + "type": "shell", + "script": "scripts/installRos.sh", + "execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S sh '{{.Path}}'" + }, + { + "type": "shell", + "script": "scripts/installVsCode.sh", + "execute_command": "echo '{{user `password`}}' | {{.Vars}} sudo -E -S sh '{{.Path}}'" + }, + { + "type": "shell", + "script": "scripts/installRosUser.sh" + } +] +} \ No newline at end of file diff --git a/scripts/installGuestAdditions.sh b/scripts/installGuestAdditions.sh new file mode 100644 index 0000000..657c75e --- /dev/null +++ b/scripts/installGuestAdditions.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +sudo apt update +sudo apt install -y build-essential make perl +sudo mount -o loop,ro /home/clever/VBoxGuestAdditions.iso /mnt +sudo /mnt/VBoxLinuxAdditions.run +sudo umount /mnt diff --git a/scripts/installRos.sh b/scripts/installRos.sh new file mode 100644 index 0000000..1d2f6ff --- /dev/null +++ b/scripts/installRos.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +sudo apt update +sudo apt install -y python-rosinstall python-rosinstall-generator python-wstool build-essential +sudo apt install -y ros-melodic-desktop + +sudo rosdep init diff --git a/scripts/installRosUser.sh b/scripts/installRosUser.sh new file mode 100644 index 0000000..0d0a442 --- /dev/null +++ b/scripts/installRosUser.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +rosdep update +echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc diff --git a/scripts/installVsCode.sh b/scripts/installVsCode.sh new file mode 100644 index 0000000..4910877 --- /dev/null +++ b/scripts/installVsCode.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +sudo apt update +sudo apt install -y curl +curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg +sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/ +sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' + +sudo apt-get install -y apt-transport-https +sudo apt-get update +sudo apt-get install -y code