6c30d22a56
This allows the URL used to clone our specific version of u-boot to be specified in the environment, instead of being hard-coded. This new flexibility will be required by the new Continuous Integration infrastructure, whose test nodes are in a network without direct internet access. Change-Id: I7440b5bba6786f979623b4509111e4e99c6558f6
59 lines
1.1 KiB
Bash
Executable file
59 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Perform a checkout / update the MINIX u-boot git repo if needed
|
|
#
|
|
: ${UBOOT_REPO_URL=git://git.minix3.org/u-boot}
|
|
|
|
# -o output dir
|
|
OUTPUT_DIR=""
|
|
GIT_VERSION=""
|
|
while getopts "o:n:?" c
|
|
do
|
|
case "$c" in
|
|
\?)
|
|
echo "Usage: $0 -o output dir -n version " >&2
|
|
exit 1
|
|
;;
|
|
o)
|
|
OUTPUT_DIR=$OPTARG
|
|
;;
|
|
n)
|
|
GIT_VERSION=$OPTARG
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
#
|
|
# check arguments
|
|
#
|
|
if [ -z "$OUTPUT_DIR" -o -z "$GIT_VERSION" ]
|
|
then
|
|
echo "Missing required parameters OUTPUT_DIR=$OUTPUT_DIR GIT_VERSION=$GIT_VERSION"
|
|
echo "Usage: $0 -o output dir -n version " >&2
|
|
exit 1
|
|
fi
|
|
|
|
|
|
#
|
|
# if the file doesn't exist it's easy , to a checkout
|
|
#
|
|
if [ ! -e "$OUTPUT_DIR" ]
|
|
then
|
|
git clone ${UBOOT_REPO_URL} -b minix $OUTPUT_DIR
|
|
fi
|
|
|
|
(
|
|
cd "$OUTPUT_DIR"
|
|
|
|
#
|
|
# perform an update
|
|
#
|
|
CURRENT_VERSION=`git rev-parse HEAD`
|
|
if [ "$CURRENT_VERSION" != "$GIT_VERSION" ]
|
|
then
|
|
echo "Current version $CURRENT_VERSION does not match wanted $GIT_VERSION performing update and checkout"
|
|
git fetch -v
|
|
git checkout $GIT_VERSION
|
|
fi
|
|
)
|