blob: 30ad44ad2085ba27217ad41a099fef850813132c [file] [log] [blame]
Andy Doan15aa23b2012-02-02 16:40:58 -06001#!/bin/sh
2# Copyright (C) 2012 Linaro
3#
4# Author: Andy Doan <andy.doan@linaro.org>
5#
6# This file is part of Linaro Daily Prebuilt Images. Its a small wrapper that
7# sets up the environment so that build-images.py can run
8#
9# Linaro Daily Prebuilt Images is free software; you can redistribute it and/or
10# modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation; either version 2
12# of the License, or (at your option) any later version.
13#
14# Linaro Daily Prebuilt Images is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with Linaro Image Tools; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22# USA.
23
24set -e
25
26OUTDIR="./out"
27
28usage()
29{
Andy Doand198b3e2012-03-15 14:16:39 -050030 echo "Usage: please see build-images.py"
31 echo "In addition, this script accepts the ENV variables:"
32 echo " LITREPO - for the linaro image tools repo"
33 echo " LFIREPO - for the linaro fetch image repo"
Andy Doan15aa23b2012-02-02 16:40:58 -060034 exit 1
35}
36
Andy Doand198b3e2012-03-15 14:16:39 -050037while getopts "ho:b:w:d:p:" optn; do
Andy Doan15aa23b2012-02-02 16:40:58 -060038 case $optn in
39 o ) OUTDIR=$OPTARG;;
40 esac
41done
42
Andy Doancee877a2012-02-15 14:02:04 -060043if [ ! -z $DELETEDIR ] && [ -d ${OUTDIR} ] ; then
44 echo "INFO: Deleting past output directory: ${OUTDIR}"
45 rm -rf ${OUTDIR}
46fi
47
48if [ -d ${OUTDIR} ] && [ -z $REUSE ] ; then
49 echo "ERROR: directory [$OUTDIR] already exists. Delete this or run with RESUSE=1"
50 exit 1
51fi
Andy Doan15aa23b2012-02-02 16:40:58 -060052
Andy Doand198b3e2012-03-15 14:16:39 -050053[ -n "$LITREPO" ] || LITREPO="lp:linaro-image-tools"
54[ -n "$LFIREPO" ] || LFIREPO="lp:linaro-fetch-image"
55
Andy Doan15aa23b2012-02-02 16:40:58 -060056LITDIR=${OUTDIR}/linaro-image-tools
Andy Doand198b3e2012-03-15 14:16:39 -050057LFIDIR=${OUTDIR}/linaro-fetch-image
Andy Doancee877a2012-02-15 14:02:04 -060058if [ ! -d ${OUTDIR} ] ; then
59 mkdir ${OUTDIR}
Andy Doand198b3e2012-03-15 14:16:39 -050060 bzr branch ${LITREPO} ${LITDIR}
61 bzr branch ${LFIREPO} ${LFIDIR}
Andy Doancee877a2012-02-15 14:02:04 -060062fi
Andy Doan15aa23b2012-02-02 16:40:58 -060063
Andy Doand198b3e2012-03-15 14:16:39 -050064export PYTHONPATH="${LITDIR}:${LFIDIR}"
Andy Doan15aa23b2012-02-02 16:40:58 -060065SCRIPTDIR=$(dirname $(readlink -f $0))
66${SCRIPTDIR}/build-images.py $*