-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmanifest.sh
98 lines (91 loc) · 3.36 KB
/
manifest.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
#
# Copyright (C) 2021 The Waydroid project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
top_dir=`pwd`
LOCALDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
loc_man="${top_dir}/.repo/local_manifests"
manifests_url="https://raw.githubusercontent.com/waydroid/android_vendor_waydroid/lineage-18.1/manifest_scripts/manifests-30"
manifests_path="${LOCALDIR}/manifests"
#setup colors
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
purple=`tput setaf 5`
teal=`tput setaf 6`
light=`tput setaf 7`
dark=`tput setaf 8`
ltred=`tput setaf 9`
ltgreen=`tput setaf 10`
ltyellow=`tput setaf 11`
ltblue=`tput setaf 12`
ltpurple=`tput setaf 13`
CL_CYN=`tput setaf 12`
CL_RST=`tput sgr0`
reset=`tput sgr0`
if [ ! -d "${top_dir}/.repo" ]; then
echo -e ${reset}""${reset}
echo -e ${ltred}"ERROR: Manifest generation requires repo to be initialized first."${reset}
echo -e ${reset}""${reset}
exit
fi
mkdir -p ${loc_man}
if [ -f build/make/core/version_defaults.mk ]; then
if grep -q "PLATFORM_SDK_VERSION := 28" build/make/core/version_defaults.mk; then
manifests_url="${manifests_url}-28"
manifests_path="${manifests_path}-28"
fi
if grep -q "PLATFORM_SDK_VERSION := 29" build/make/core/version_defaults.mk; then
manifests_url="${manifests_url}"
manifests_path="${manifests_path}"
fi
if grep -q "PLATFORM_SDK_VERSION := 30" build/make/core/version_defaults.mk; then
manifests_url="${manifests_url}-30"
manifests_path="${manifests_path}-30"
fi
fi
echo -e ${reset}""${reset}
echo -e ${green}"Placing manifest fragments..."${reset}
echo -e ${reset}""${reset}
if [ -d "${manifests_path}" ]; then
cp -fpr ${manifests_path}/*.xml "${loc_man}/"
else
echo -e ${reset}""${reset}
echo -e ${ltblue}"INFO: Manifests not found, downloading"${reset}
echo -e ${reset}""${reset}
curl "${manifests_url}/00-remotes.xml" -o "${loc_man}/00-remotes.xml"
curl "${manifests_url}/01-removes.xml" -o "${loc_man}/01-removes.xml"
curl "${manifests_url}/02-waydroid.xml" -o "${loc_man}/02-waydroid.xml"
fi
echo -e ${reset}""${reset}
echo -e ${teal}"INFO: Cleaning up remove manifest entries"${reset}
echo -e ${reset}""${reset}
while IFS= read -r rpitem; do
if [[ $rpitem == *"remove-project"* ]]; then
rpitem_trimmed="$(echo "$rpitem" | xargs)"
if grep -qRlZ "$rpitem_trimmed" "${top_dir}/.repo/manifests/"; then
echo -e ${yellow}"WARN: ROM already includes: $rpitem"${reset}
else
echo -e ${green}"INFO: Needed: $rpitem"${reset}
prefix="<remove-project name="
suffix=" />"
item=${rpitem_trimmed#"$prefix"}
item=${item%"$suffix"}
if ! grep -qRlZ "$item" "${top_dir}/.repo/manifests/"; then
sed -e "$item"'d' "${loc_man}/01-removes.xml"
fi
fi
fi
done < "${loc_man}/01-removes.xml"