From 668208198c474df730aaf360e3a3cbb452dc3142 Mon Sep 17 00:00:00 2001 From: Pete Vander Giessen Date: Fri, 29 Nov 2019 20:20:42 +0000 Subject: [PATCH] Added "make a dev box" script. Added a script to tools that makes it a bit easier to spin up a checkout of the MicroStack source in a vm, in preparation for making a change and testing a build. Change-Id: I6b88c99f4c3bfa22e82bc740193c1993776eb757 --- tools/make-a-dev-box.sh | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 tools/make-a-dev-box.sh diff --git a/tools/make-a-dev-box.sh b/tools/make-a-dev-box.sh new file mode 100755 index 0000000..79b869c --- /dev/null +++ b/tools/make-a-dev-box.sh @@ -0,0 +1,49 @@ +#!/bin/bash +############################################################################## +# +# Make a dev box for microstack! +# +# This is a tool to quickly spin up a multipass vm and set it up for +# developing MicroStack. +# +############################################################################## + +set -e + +DISTRO=18.04 + +MACHINE=$(petname) || : +if [ -z "$MACHINE" ]; then + echo -n "Please enter a machine name: " + read MACHINE +fi + +NAME=$(git config --global user.name) +if [ -z "$NAME" ]; then + echo -n "Please enter your name: " + read NAME +fi + +EMAIL=$(git config --global user.email) +if [ -z "$EMAIL" ]; then + echo -n "Please enter your email address: " + read EMAIL +fi + +# Make a vm +multipass launch --cpus 2 --mem 16G $DISTRO --name $MACHINE --disk 100G + +PREFIX="multipass exec $MACHINE -- " + +$PREFIX sudo apt update +$PREFIX sudo apt upgrade -y +$PREFIX sudo apt install tox git-review -y +$PREFIX git clone https://opendev.org/x/microstack.git + +$PREFIX sudo snap install lxd +$PREFIX sudo /snap/bin/lxd.migrate -yes + +$PREFIX git config --global user.name "$NAME" +$PREFIX git config --global user.email "$EMAIL" + +multipass connect $MACHINE