extract-files.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. set -e
  9. DEVICE=DPL_sprout
  10. VENDOR=hmd
  11. # Load extract_utils and do some sanity checks
  12. MY_DIR="${BASH_SOURCE%/*}"
  13. if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
  14. ANDROID_ROOT="${MY_DIR}/../../.."
  15. HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
  16. if [ ! -f "${HELPER}" ]; then
  17. echo "Unable to find helper script at ${HELPER}"
  18. exit 1
  19. fi
  20. source "${HELPER}"
  21. # Default to sanitizing the vendor folder before extraction
  22. CLEAN_VENDOR=true
  23. KANG=
  24. SECTION=
  25. while [ "${#}" -gt 0 ]; do
  26. case "${1}" in
  27. -n | --no-cleanup )
  28. CLEAN_VENDOR=false
  29. ;;
  30. -k | --kang )
  31. KANG="--kang"
  32. ;;
  33. -s | --section )
  34. SECTION="${2}"; shift
  35. CLEAN_VENDOR=false
  36. ;;
  37. * )
  38. SRC="${1}"
  39. ;;
  40. esac
  41. shift
  42. done
  43. if [ -z "${SRC}" ]; then
  44. SRC="adb"
  45. fi
  46. # Initialize the helper
  47. setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
  48. extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
  49. "${MY_DIR}/setup-makefiles.sh"