manila-test-image/init-buildroot.sh
Ben Swartzlander 3c8053515a Install packages automatically on Ubuntu
For gate jobs, we need to automate the installing of
dependencies, so check if we're on Ubuntu and handle that
case automatically. Other distros can still use the script
but need to manually take care of dependencies.

Change-Id: Id2c6a815c018cdfe3b288c38c7033275f25d8f13
2017-01-27 19:59:07 -05:00

39 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright 2016 (C) NetApp, Inc.
# Author: Ben Swartzlander <ben@swartzlander.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
if which lsb_release 2> /dev/null && [ $(lsb_release -i -s) = "Ubuntu" ]
then
sudo apt-get -y install curl unzip bc python quilt parted qemu-utils \
build-essential gcc-multilib
fi
VERSION=2016.02
FILENAME=buildroot-${VERSION}.tar.bz2
# Download buildroot if we don't have it already
if [ ! -f download/$FILENAME ]
then
wget -P download http://buildroot.org/downloads/$FILENAME
fi
# Untar buildroot if it's not already there
if [ ! -d buildroot ]
then
mkdir buildroot
tar -C buildroot -xf download/$FILENAME --strip 1
fi
# Apply patches to buildroot if we haven't done so before
PATCH_FLAG_FILE=buildroot/.manila-patches-applied
if [ ! -f $PATCH_FLAG_FILE ]
then
( cd buildroot ; QUILT_PATCHES=../patches quilt push -a )
touch $PATCH_FLAG_FILE
fi