forked from whatawurst/android_device_sony_lilac
-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
extract-files.sh
executable file
·141 lines (115 loc) · 4.64 KB
/
extract-files.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
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
DEVICE=lilac
VENDOR=sony
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
LINEAGE_ROOT="$MY_DIR"/../../..
HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh
if [ ! -f "$HELPER" ]; then
echo "Unable to find helper script at $HELPER"
exit 1
fi
# Patch utils if not done
if ! grep -qF "# if line contains apk, jar or vintf fragment, it needs to be packaged" "$HELPER"; then
patch --directory "$(dirname "$HELPER")" --quiet --no-backup-if-mismatch << 'EOF'
Author: Michael Bestas <[email protected]>
Date: Mon Nov 15 22:18:04 2021 +0200
extract_utils: Automatically add apk/jar/vintf fragments to PRODUCT_PACKAGES
Change-Id: I9d12e00c294d02b40fde2b66d7797f69f6504c35
diff --git a/extract_utils.sh b/extract_utils.sh
index 455830f..b3dce4a 100644
--- a/extract_utils.sh
+++ b/extract_utils.sh
@@ -1127,6 +1127,13 @@ function parse_file_list() {
PRODUCT_PACKAGES_LIST+=("${SPEC#-}")
PRODUCT_PACKAGES_HASHES+=("$HASH")
PRODUCT_PACKAGES_FIXUP_HASHES+=("$FIXUP_HASH")
+ # if line contains apk, jar or vintf fragment, it needs to be packaged
+ elif suffix_match_file ".apk" "$(src_file "$SPEC")" || \
+ suffix_match_file ".jar" "$(src_file "$SPEC")" || \
+ [[ "$SPEC" == *"etc/vintf/manifest/"* ]]; then
+ PRODUCT_PACKAGES_LIST+=("$SPEC")
+ PRODUCT_PACKAGES_HASHES+=("$HASH")
+ PRODUCT_PACKAGES_FIXUP_HASHES+=("$FIXUP_HASH")
else
PRODUCT_COPY_FILES_LIST+=("$SPEC")
PRODUCT_COPY_FILES_HASHES+=("$HASH")
@@ -1794,11 +1801,7 @@ function generate_prop_list_from_image() {
if array_contains "$FILE" "${skipped_vendor_files[@]}"; then
continue
fi
- if suffix_match_file ".apk" "$FILE" ; then
- echo "-vendor/$FILE" >> "$output_list_tmp"
- else
- echo "vendor/$FILE" >> "$output_list_tmp"
- fi
+ echo "vendor/$FILE" >> "$output_list_tmp"
done
# Sort merged file with all lists
EOF
fi
source "${HELPER}"
if [ -z "${PATCHELF}" ]; then
PATCHELF="$MY_DIR"/tools/patchelf-0_9
fi
# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true
SECTION=
while [ "$1" != "" ]; do
case $1 in
-n | --no-cleanup ) CLEAN_VENDOR=false
;;
-s | --section ) shift
SECTION=$1
CLEAN_VENDOR=false
;;
* ) SRC=$1
;;
esac
shift
done
if [ -z "$SRC" ]; then
SRC=adb
fi
# Initialize the helper
setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false "$CLEAN_VENDOR"
extract "$MY_DIR"/proprietary-files.txt "$SRC" "$SECTION"
extract "$MY_DIR"/proprietary-files-vendor.txt "$SRC" "$SECTION"
#
# Blobs fixup start
#
DEVICE_ROOT="$LINEAGE_ROOT"/vendor/"$VENDOR"/"$DEVICE"/proprietary
# Fix referenced set_sched_policy for stock audio hal
"${PATCHELF}" --replace-needed "libcutils.so" "libprocessgroup.so" "${DEVICE_ROOT}"/vendor/lib/hw/audio.primary.msm8998.so
# Let ffu load ufs firmare files from /etc
sed -i 's/\/lib\/firmware\/ufs/\/etc\/firmware\/ufs/g' "${DEVICE_ROOT}"/vendor/bin/ffu
# Add a restorecon for /persist/wlan to taimport_vendor.rc
sed -i '4 a\ restorecon /persist/wlan' "${DEVICE_ROOT}"/vendor/etc/init/taimport_vendor.rc
# Change xml version from 2.0 to 1.0
sed -i 's/version\=\"2\.0\"/version\=\"1\.0\"/g' "${DEVICE_ROOT}"/product/etc/permissions/vendor.qti.hardware.data.connection-V1.0-java.xml
sed -i 's/version\=\"2\.0\"/version\=\"1\.0\"/g' "${DEVICE_ROOT}"/product/etc/permissions/vendor.qti.hardware.data.connection-V1.1-java.xml
# Fix product path
function fix_product_path () {
sed -i \
's/\/system\/framework\//\/system\/product\/framework\//g' \
"$DEVICE_ROOT"/"$1"
}
fix_product_path product/etc/permissions/com.qualcomm.qti.imscmservice-V2.0-java.xml
fix_product_path product/etc/permissions/com.qualcomm.qti.imscmservice-V2.1-java.xml
fix_product_path product/etc/permissions/com.qualcomm.qti.imscmservice.xml
fix_product_path product/etc/permissions/embms.xml
fix_product_path product/etc/permissions/lpa.xml
fix_product_path product/etc/permissions/qcrilhook.xml
fix_product_path product/etc/permissions/telephonyservice.xml
#
# Blobs fixup end
#
"$MY_DIR"/setup-makefiles.sh