etc/protocols - sync with NetBSD-8
[minix.git] / releasetools / fetch_u-boot.sh
blob5531cd5b8a31068e95ee2e2b7f8dcc10b29a229f
1 #!/bin/sh
3 # Perform a checkout / update the MINIX u-boot git repo if needed
4 #
5 : ${UBOOT_REPO_URL=git://git.minix3.org/u-boot}
7 # -o output dir
8 OUTPUT_DIR=""
9 GIT_VERSION=""
10 while getopts "o:n:?" c
12 case "$c" in
13 \?)
14 echo "Usage: $0 -o output dir -n version " >&2
15 exit 1
18 OUTPUT_DIR=$OPTARG
21 GIT_VERSION=$OPTARG
23 esac
24 done
28 # check arguments
30 if [ -z "$OUTPUT_DIR" -o -z "$GIT_VERSION" ]
31 then
32 echo "Missing required parameters OUTPUT_DIR=$OUTPUT_DIR GIT_VERSION=$GIT_VERSION"
33 echo "Usage: $0 -o output dir -n version " >&2
34 exit 1
39 # if the file doesn't exist it's easy , to a checkout
41 if [ ! -e "$OUTPUT_DIR" ]
42 then
43 git clone ${UBOOT_REPO_URL} -b minix $OUTPUT_DIR
47 cd "$OUTPUT_DIR"
50 # perform an update
52 CURRENT_VERSION=`git rev-parse HEAD`
53 if [ "$CURRENT_VERSION" != "$GIT_VERSION" ]
54 then
55 echo "Current version $CURRENT_VERSION does not match wanted $GIT_VERSION performing update and checkout"
56 git fetch -v
57 git checkout $GIT_VERSION