g12: overlay: Remove config_enableMultiUserUI
[GitHub/LineageOS/G12/android_device_amlogic_g12-common.git] / extract-files.sh
CommitLineData
11fc4c85
NJ
1#!/bin/bash
2#
3# Copyright (C) 2016 The CyanogenMod Project
4# Copyright (C) 2017-2020 The LineageOS Project
5#
6# SPDX-License-Identifier: Apache-2.0
7#
8
9set -e
10
11# Load extract_utils and do some sanity checks
12MY_DIR="${BASH_SOURCE%/*}"
13if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
14
15ANDROID_ROOT="${MY_DIR}/../../.."
16
17HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
18if [ ! -f "${HELPER}" ]; then
19 echo "Unable to find helper script at ${HELPER}"
20 exit 1
21fi
22source "${HELPER}"
23
24# Default to sanitizing the vendor folder before extraction
25CLEAN_VENDOR=true
26
27ONLY_COMMON=
28ONLY_TARGET=
29KANG=
30SECTION=
31
32while [ "${#}" -gt 0 ]; do
33 case "${1}" in
34 --only-common )
35 ONLY_COMMON=true
36 ;;
37 --only-target )
38 ONLY_TARGET=true
39 ;;
40 -n | --no-cleanup )
41 CLEAN_VENDOR=false
42 ;;
43 -k | --kang )
44 KANG="--kang"
45 ;;
46 -s | --section )
47 SECTION="${2}"; shift
48 CLEAN_VENDOR=false
49 ;;
50 * )
51 SRC="${1}"
52 ;;
53 esac
54 shift
55done
56
57if [ -z "${SRC}" ]; then
58 SRC="adb"
59fi
60
61function blob_fixup() {
62 case "${1}" in
368b9b40
NJ
63 vendor/etc/init/fs.rc)
64 sed -i '/media 0770 media_rw media_rw/d' "${2}"
4f1c8cad 65 sed -i '/setprop ro.crypto.fuse_sdcard true/d' "${2}"
368b9b40 66 ;;
cee11e45
AK
67 vendor/etc/init/tee-supplicant.rc)
68 sed -i s#/vendor/lib/#/vendor/lib/modules/#g "${2}"
69 ;;
f160d00f
JC
70 vendor/etc/wifi/wpa_supplicant_overlay.conf)
71 echo "driver_param=use_p2p_group_interface=1">>"${2}"
72 ;;
11fc4c85
NJ
73 esac
74 }
75
76if [ -z "${ONLY_TARGET}" ]; then
77 # Initialize the helper for common device
78 setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"
79
80 extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
a4badd77 81 extract "${MY_DIR}/proprietary-files-tee.txt" "${SRC}" "${KANG}" --section "${SECTION}"
11fc4c85
NJ
82fi
83
84if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../../${VENDOR_DEVICE}/${DEVICE}/proprietary-files.txt" ]; then
85 # Reinitialize the helper for device
86 source "${MY_DIR}/../../${VENDOR_DEVICE}/${DEVICE}/extract-files.sh"
87 setup_vendor "${DEVICE}" "${VENDOR_DEVICE}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
88
89 extract "${MY_DIR}/../../${VENDOR_DEVICE}/${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
90fi
91
92"${MY_DIR}/setup-makefiles.sh"