-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-mirror.sh
executable file
·146 lines (128 loc) · 2.83 KB
/
config-mirror.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
REPO=${REPO:-./repo}
sync_flags=""
repo_sync() {
rm -rf .repo/manifest* &&
$REPO init -u $GITREPO -b $BRANCH -m $1.xml $REPO_INIT_FLAGS &&
./chmanifest.js $1 &&
$REPO sync $sync_flags $REPO_SYNC_FLAGS &&
git -C .repo/manifests/ reset --hard
ret=$?
if [ "$GITREPO" = "$GIT_TEMP_REPO" ]; then
rm -rf $GIT_TEMP_REPO
fi
if [ $ret -ne 0 ]; then
echo Repo sync failed
exit -1
fi
}
case `uname` in
"Darwin")
# Should also work on other BSDs
CORE_COUNT=`sysctl -n hw.ncpu`
;;
"Linux")
CORE_COUNT=`grep processor /proc/cpuinfo | wc -l`
;;
*)
echo Unsupported platform: `uname`
exit -1
esac
#BASEURL=`git remote -v | grep fetch | grep origin | cut -f 2 | cut -f 1 -d "/"`
BASEURL=${BASEURL:-"[email protected]:central"}
GITREPO=${GITREPO:-$BASEURL"/manifest.git"}
BRANCH=${BRANCH:-v1.0}
while [ $# -ge 1 ]; do
case $1 in
-d|-l|-f|-n|-c|-q|-j*|--no-*|--force-sync)
sync_flags="$sync_flags $1"
if [ $1 = "-j" ]; then
shift
sync_flags+=" $1"
fi
shift
;;
--help|-h)
# The main case statement will give a usage message.
break
;;
-*)
echo "$0: unrecognized option $1" >&2
exit 1
;;
*)
break
;;
esac
done
GIT_TEMP_REPO="tmp_manifest_repo"
if [ -n "$2" ]; then
GITREPO=$GIT_TEMP_REPO
rm -rf $GITREPO &&
git init $GITREPO &&
cp $2 $GITREPO/$1.xml &&
cd $GITREPO &&
git add $1.xml &&
git commit -m "manifest" &&
git branch -m $BRANCH &&
cd ..
fi
echo MAKE_FLAGS=-j$((CORE_COUNT + 2)) > .tmp-config
echo GECKO_OBJDIR=$PWD/objdir-gecko >> .tmp-config
echo DEVICE_NAME=$1 >> .tmp-config
case "$1" in
"aries"|"aries-l")
echo PRODUCT_NAME=aries >> .tmp-config &&
repo_sync $1
;;
"emulator-kk"|"emulator-l")
echo DEVICE=generic >> .tmp-config &&
echo LUNCH=full-eng >> .tmp-config &&
repo_sync $1
;;
"emulator-x86-kk"|"emulator-x86-l")
echo DEVICE=generic_x86 >> .tmp-config &&
echo LUNCH=full_x86-eng >> .tmp-config &&
repo_sync $1
;;
"flame"|"flame-l"|"flame-f")
echo PRODUCT_NAME=flame >> .tmp-config &&
repo_sync $1
;;
"nexus-5"|"nexus-5-l")
echo DEVICE=hammerhead >> .tmp-config &&
repo_sync $1
;;
"nexus-6")
echo DEVICE=shamu >> .tmp-config &&
repo_sync $1
;;
"octans"|"msm8909")
echo PRODUCT_NAME=$1 >> .tmp-config &&
repo_sync $1
;;
*)
echo "Usage: $0 [-cdflnq] (device name)"
echo "Flags are passed through to |./repo sync|."
echo
echo Valid devices to configure are:
echo - flame "(kitkat)"
echo - flame-l "(lollipop)"
echo - flame-f "(feature phone on flame with kitkat)"
echo - nexus-5 "(kitkat)"
echo - nexus-5-l "(lollipop)"
echo - nexus-6 "(lollipop)"
echo - emulator-kk "(kitkat)"
echo - emulator-l "(lollipop)"
echo - emulator-x86-kk "(kitkat)"
echo - emulator-x86-l "(lollipop)"
echo - octans "(lollipop)"
exit -1
;;
esac
if [ $? -ne 0 ]; then
echo Configuration failed
exit -1
fi
mv .tmp-config .config
echo Run \|./build.sh\| to start building