Commit | Line | Data |
---|---|---|
7cf713a4 | 1 | w#!/bin/bash |
925451e6 | 2 | # |
7cf713a4 MB |
3 | # Copyright (C) 2016 The CyanogenMod Project |
4 | # Copyright (C) 2017-2020 The LineageOS Project | |
925451e6 | 5 | # |
7cf713a4 | 6 | # SPDX-License-Identifier: Apache-2.0 |
0379b2ac | 7 | # |
925451e6 S |
8 | |
9 | set -e | |
10 | ||
925451e6 | 11 | DEVICE_COMMON=universal7580-common |
7cf713a4 | 12 | VENDOR=samsung |
925451e6 | 13 | |
0379b2ac | 14 | # Load extract_utils and do some sanity checks |
925451e6 | 15 | MY_DIR="${BASH_SOURCE%/*}" |
0379b2ac | 16 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi |
925451e6 | 17 | |
7cf713a4 | 18 | ANDROID_ROOT="${MY_DIR}/../../.." |
925451e6 | 19 | |
7cf713a4 | 20 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" |
0379b2ac VO |
21 | if [ ! -f "${HELPER}" ]; then |
22 | echo "Unable to find helper script at ${HELPER}" | |
925451e6 S |
23 | exit 1 |
24 | fi | |
0379b2ac VO |
25 | source "${HELPER}" |
26 | ||
7cf713a4 MB |
27 | # Default to sanitizing the vendor folder before extraction |
28 | CLEAN_VENDOR=true | |
29 | ||
0379b2ac | 30 | KANG= |
7cf713a4 | 31 | SECTION= |
0379b2ac VO |
32 | |
33 | while [ "${#}" -gt 0 ]; do | |
34 | case "${1}" in | |
35 | -n | --no-cleanup ) | |
36 | CLEAN_VENDOR=false | |
37 | ;; | |
38 | -k | --kang ) | |
39 | KANG="--kang" | |
40 | ;; | |
41 | -s | --section ) | |
42 | SECTION="${2}"; shift | |
43 | CLEAN_VENDOR=false | |
44 | ;; | |
45 | * ) | |
46 | SRC="${1}" | |
47 | ;; | |
48 | esac | |
49 | shift | |
50 | done | |
51 | ||
52 | if [ -z "${SRC}" ]; then | |
53 | SRC="adb" | |
925451e6 S |
54 | fi |
55 | ||
7cf713a4 | 56 | |
925451e6 | 57 | # Initialize the helper |
7cf713a4 | 58 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" |
925451e6 | 59 | |
7cf713a4 | 60 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" |
925451e6 | 61 | |
0379b2ac | 62 | # Fix proprietary blobs |
7cf713a4 | 63 | BLOB_ROOT="$ANDROID_ROOT"/vendor/"$VENDOR"/"$DEVICE_COMMON"/proprietary |
9f5f4ccf | 64 | "${PATCHELF}" --replace-needed libgui.so libsensor.so $BLOB_ROOT/vendor/bin/gpsd |
7a187109 | 65 | |
066bef21 | 66 | # replace SSLv3_client_method with SSLv23_method |
b739e47b | 67 | sed -i "s/SSLv3_client_method/SSLv23_method\x00\x00\x00\x00\x00\x00/" $BLOB_ROOT/vendor/bin/gpsd |
066bef21 | 68 | |
7cf713a4 | 69 | |
0379b2ac | 70 | "${MY_DIR}/setup-makefiles.sh" |