blob: c0b02b93648f43609f5ac28180e57b2f49c08cfe [file] [log] [blame]
Anthony Younge7fa9092011-11-07 16:10:59 -06001#!/usr/bin/env bash
2
3# Keep track of the current directory
4TOOLS_DIR=$(cd $(dirname "$0") && pwd)
5TOP_DIR=`cd $TOOLS_DIR/..; pwd`
6
7# cd to top of devstack
8cd $TOP_DIR
9
10# Echo usage
11usage() {
12 echo "Cache OpenStack dependencies on a uec image to speed up performance."
13 echo ""
14 echo "Usage: $0 [full path to raw uec base image]"
15}
16
17# Make sure this is a raw image
18if ! qemu-img info $1 | grep -q "file format: raw"; then
19 usage
20 exit 1
21fi
22
23# Mount the image
24STAGING_DIR=`mktemp -d uec.XXXXXXXXXX`
25mkdir -p $STAGING_DIR
26mount -t ext4 -o loop $1 $STAGING_DIR
27
28# Make sure that base requirements are installed
29cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
30
31# Perform caching on the base image to speed up subsequent runs
32chroot $STAGING_DIR apt-get update
33chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep NOPRIME | cut -d\# -f1`
34chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1`
35chroot $STAGING_DIR pip install `cat files/pips/*`
36umount $STAGING_DIR && rm -rf $STAGING_DIR