Andy Doan | 15aa23b | 2012-02-02 16:40:58 -0600 | [diff] [blame] | 1 | #!/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 | |
| 24 | set -e |
| 25 | |
| 26 | OUTDIR="./out" |
| 27 | |
| 28 | usage() |
| 29 | { |
| 30 | echo "Usage: please see build-images.py" |
| 31 | echo "In addition, this script accepts the ENV variable BZRARGS for arguments to pass to the bzr branch command" |
| 32 | exit 1 |
| 33 | } |
| 34 | |
| 35 | while getopts "o:" optn; do |
| 36 | case $optn in |
| 37 | o ) OUTDIR=$OPTARG;; |
| 38 | esac |
| 39 | done |
| 40 | |
Andy Doan | cee877a | 2012-02-15 14:02:04 -0600 | [diff] [blame^] | 41 | if [ ! -z $DELETEDIR ] && [ -d ${OUTDIR} ] ; then |
| 42 | echo "INFO: Deleting past output directory: ${OUTDIR}" |
| 43 | rm -rf ${OUTDIR} |
| 44 | fi |
| 45 | |
| 46 | if [ -d ${OUTDIR} ] && [ -z $REUSE ] ; then |
| 47 | echo "ERROR: directory [$OUTDIR] already exists. Delete this or run with RESUSE=1" |
| 48 | exit 1 |
| 49 | fi |
Andy Doan | 15aa23b | 2012-02-02 16:40:58 -0600 | [diff] [blame] | 50 | |
| 51 | LITDIR=${OUTDIR}/linaro-image-tools |
Andy Doan | cee877a | 2012-02-15 14:02:04 -0600 | [diff] [blame^] | 52 | if [ ! -d ${OUTDIR} ] ; then |
| 53 | mkdir ${OUTDIR} |
| 54 | bzr branch ${BZRARGS} lp:linaro-image-tools ${LITDIR} |
| 55 | fi |
Andy Doan | 15aa23b | 2012-02-02 16:40:58 -0600 | [diff] [blame] | 56 | |
Andy Doan | cee877a | 2012-02-15 14:02:04 -0600 | [diff] [blame^] | 57 | export PYTHONPATH=${LITDIR} |
Andy Doan | 15aa23b | 2012-02-02 16:40:58 -0600 | [diff] [blame] | 58 | SCRIPTDIR=$(dirname $(readlink -f $0)) |
| 59 | ${SCRIPTDIR}/build-images.py $* |