X-Git-Url: https://git.einval.com/cgi-bin/gitweb.cgi?p=training-lab.git;a=blobdiff_plain;f=bootstrap-toolchain-vm.sh;h=05f7a0106b689083183e8ebb225cb5952d3678e9;hp=978e6c930d9ef67e4806e25158bbd61efd992b3b;hb=02918de66fd83137bf51fb4e3bd0b00628811d66;hpb=7a45b1198c7091d614b54d93ad49f5ce6f4ee86c diff --git a/bootstrap-toolchain-vm.sh b/bootstrap-toolchain-vm.sh index 978e6c9..05f7a01 100755 --- a/bootstrap-toolchain-vm.sh +++ b/bootstrap-toolchain-vm.sh @@ -2,19 +2,33 @@ # # Runtime provisioning script for Vagrant-based training lab setup +# runtime type - arm32 (default) or arm64 +RUNTIME=$1 +if [ "$RUNTIME"x = ""x ]; then + RUNTIME=arm32 +fi +shift +OPTS=$1 + # Location of the runtime files. MANIFEST must exist there, and # describes what else needs to be downloaded: in the format: # ::: # Apart from the MANIFEST itself, all files should be compressed with # gzip. In each case, the script will download $FILENAME.gz, # decompress it and then validate the checksum -RUNTIME_DL=https://www.einval.com/arm/training-lab/arm64/ +if [ "$OPTS"x = "localtest"x ]; then + RUNTIME_DL=http://www.einval.org/share/arm-security/$RUNTIME/ +else + RUNTIME_DL=https://www.einval.com/arm/training-lab/$RUNTIME/ +fi # Abort on errors set -e # set -x -# Make sure we have updates applied, and all our needed packages +# Make sure we have updates applied, and all our needed packages. Kill +# inattended-upgrades if it's running, as it will clash here +killall unattended-upgrade unattended-upgrades || true apt-get update apt-get dist-upgrade -y apt-get install -y qemu-system-arm gcc-aarch64-linux-gnu @@ -39,7 +53,9 @@ for LINE in $(cat MANIFEST); do DL_NEEDED=1 # Quick and dirty - if the file exists and is the right size, - # we'll believe it + # we'll believe it's OK. This will save us downloading a 2G test + # image every time, but make sure we delete it if people are + # changing tests! echo " Checking $FILENAME.gz" if [ -f $FILENAME ]; then SIZE=$(stat -c%s $FILENAME) @@ -48,6 +64,10 @@ for LINE in $(cat MANIFEST); do fi fi + if [ "$OPTS"x = "nodownload"x ]; then + "IGNORING DOWNLOAD FOR $FILENAME" + DL_NEEDED=0 + fi if [ $DL_NEEDED = 1 ]; then # Grab a compressed version of the file, and extract it as we # go @@ -62,5 +82,5 @@ for LINE in $(cat MANIFEST); do chmod $MODE $FILENAME done -echo "Starting emulated runtime VM next" -./start_runtime +echo "Starting emulated runtime VM for $RUNTIME next" +MACH=$RUNTIME ./start_runtime