blob: 5531cd5b8a31068e95ee2e2b7f8dcc10b29a229f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/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
)
|