-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup-kernel-mirror.sh
executable file
·76 lines (63 loc) · 2.8 KB
/
setup-kernel-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
#!/usr/bin/env bash
SCRIPT_PATH="$(cd "$(dirname "$0")";pwd -P)"
MIRROR_ROOT="${SCRIPT_PATH}/../.."
KERNEL_MIRROR=${MIRROR_ROOT}/kernel
TORVALDS_LINUX=linux/torvalds/linux.git
STABLE_LINUX=linux/stable/linux.git
GOOGLE_COMMON=aosp/kernel/common.git
MIRRORS="linux aosp caf"
AOSP_PROJECTS="kernel/arm64 kernel/exynos kernel/goldfish kernel/gs kernel/hikey-linaro kernel/mediatek kernel/msm kernel/omap kernel/samsung kernel/tegra kernel/x86_64 kernel/x86"
CLO_PROJECTS="kernel/msm kernel/msm-3.10 kernel/msm-3.18 kernel/msm-4.4 kernel/msm-4.9 kernel/msm-4.14 kernel/msm-4.19 kernel/msm-5.4 kernel/msm-5.10 kernel/msm-5.15"
for mirror in ${MIRRORS}; do
if [ ! -d ${KERNEL_MIRROR}/${mirror} ] ; then
mkdir -p ${KERNEL_MIRROR}/${mirror}
fi
done
pushd ${KERNEL_MIRROR}/linux
if [ ! -d .repo ] ; then
repo init -u https://github.com/mikeNG/kernel-mirror --mirror
fi
if [ ! -d stable/linux.git ] ; then
mkdir -p stable/linux.git
GIT_DIR="stable/linux.git" git init --bare
echo ${KERNEL_MIRROR}/linux/torvalds/linux.git/objects > stable/linux.git/objects/info/alternates
fi
popd
pushd ${KERNEL_MIRROR}/aosp
if [ ! -d .repo ] ; then
repo init -u https://github.com/mikeNG/kernel-mirror --mirror --manifest-name aosp.xml
fi
if [ ! -d kernel/common.git ] ; then
mkdir -p kernel/common.git
GIT_DIR="kernel/common.git" git init --bare
echo ${KERNEL_MIRROR}/${TORVALDS_LINUX}/objects > kernel/common.git/objects/info/alternates
echo ${KERNEL_MIRROR}/${STABLE_LINUX}/objects >> kernel/common.git/objects/info/alternates
fi
for aosp_project in ${AOSP_PROJECTS}; do
if [ ! -d "${aosp_project}.git" ] ; then
mkdir -p "${aosp_project}.git"
GIT_DIR="${aosp_project}.git" git init --bare
echo ${KERNEL_MIRROR}/${TORVALDS_LINUX}/objects > "${aosp_project}.git/objects/info/alternates"
echo ${KERNEL_MIRROR}/${STABLE_LINUX}/objects >> "${aosp_project}.git/objects/info/alternates"
echo ${KERNEL_MIRROR}/${GOOGLE_COMMON}/objects >> "${aosp_project}.git/objects/info/alternates"
fi
if [ ! -L "${MIRROR_ROOT}/aosp/${aosp_project}.git" ] ; then
ln -s "../../kernel/aosp/${aosp_project}.git" "${MIRROR_ROOT}/aosp/${aosp_project}.git"
fi
done
popd
pushd ${KERNEL_MIRROR}/caf
if [ ! -d .repo ] ; then
repo init -u https://github.com/mikeNG/kernel-mirror --mirror --manifest-name caf.xml
fi
for clo_project in ${CLO_PROJECTS}; do
if [ ! -d "${clo_project}.git" ] ; then
mkdir -p "${clo_project}.git"
GIT_DIR="${clo_project}.git" git init --bare
GIT_DIR="${clo_project}.git" git remote add clo https://git.codelinaro.org/clo/la/"${clo_project}.git"
echo ${KERNEL_MIRROR}/${TORVALDS_LINUX}/objects > "${clo_project}.git/objects/info/alternates"
echo ${KERNEL_MIRROR}/${STABLE_LINUX}/objects >> "${clo_project}.git/objects/info/alternates"
echo ${KERNEL_MIRROR}/${GOOGLE_COMMON}/objects >> "${clo_project}.git/objects/info/alternates"
fi
done
popd