]> git.ozlabs.org Git - next-scripts/blob - add_repo
update to_build_host a bit
[next-scripts] / add_repo
1 #!/bin/sh
2
3 if [ $# -lt 2 ] || [ $# -gt 3 ]; then
4         printf 'usage: %s <remote name> <url> [<branch>]\n' "$0" 1>&2
5         exit 1
6 fi
7
8 name="$1"
9 url="$2"
10 branch="$3"
11
12 if [ -z "$name" ]; then
13         printf 'Need a remote name\n' 1>&2
14         exit 1
15 fi
16 if [ -z "$url" ]; then
17         printf 'Need a URL\n' 1>&2
18         exit 1
19 fi
20 if [ -z "$branch" ]; then
21         branch='master'
22 fi
23
24 if git remote add --no-tags -t "$branch" "$name" "$url"; then
25         cp .git/config ../etc/git-config
26 fi
27
28 exit 0