-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcros_init.sh
executable file
·45 lines (35 loc) · 1.02 KB
/
cros_init.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
#!/bin/bash
set -eo pipefail
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
echo "usage: $0 <path/to/root> [manifest-branch]"
echo " eg.: manifest-branch: release-R77-12371.B"
exit 1
fi
if [[ "$(id -u)" == "0" ]]; then
echo "This script cannot be run as root user."
echo "Try: sudo -EHu chronos -- $0 $@"
exit 1
fi
SELF_PATH="$(dirname $(readlink -f "$0"))"
TARGET_PATH="$1"
MANIFEST_BRANCH="${2:-$MANIFEST_BRANCH}"
shift 2
mkdir -p "$TARGET_PATH/"
cd "$TARGET_PATH/"
if [[ -z "$MANIFEST_BRANCH" ]]; then
echo "Missing MANIFEST_BRANCH."
exit 1
fi
if [[ ! -x repo ]]; then
curl https://storage.googleapis.com/git-repo-downloads/repo > repo.tmp
chmod a+x repo.tmp
mv repo.tmp repo
fi
if [[ ! -e ~/.gitconfig ]]; then
git config --global user.name "$USERNAME"
git config --global user.email "$USERNAME@$USERNAME"
fi
./repo init -u https://chromium.googlesource.com/chromiumos/manifest.git \
--repo-url https://chromium.googlesource.com/external/repo.git \
--manifest-branch="$MANIFEST_BRANCH"
./repo sync -j 10