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
This commit is contained in:
Pete Vander Giessen 2019-11-29 20:20:42 +00:00
parent 1a25e50a17
commit 668208198c
1 changed files with 49 additions and 0 deletions

49
tools/make-a-dev-box.sh Executable file
View File

@ -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