extract-files.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. #
  3. # Copyright (C) 2016 The CyanogenMod Project
  4. # Copyright (C) 2017 The LineageOS Project
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. set -e
  19. export GAPPS_COMMON=common
  20. export VENDOR=gapps
  21. # Load extract_utils and do some sanity checks
  22. MY_DIR="${BASH_SOURCE%/*}"
  23. if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
  24. CM_ROOT="$MY_DIR"/../..
  25. HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
  26. if [ ! -f "$HELPER" ]; then
  27. echo "Unable to find helper script at $HELPER"
  28. exit 1
  29. fi
  30. . "$HELPER"
  31. while [ "$1" != "" ]; do
  32. case $1 in
  33. -p | --path ) shift
  34. SRC=$1
  35. ;;
  36. -t | --target ) shift
  37. export TARGET=$1
  38. esac
  39. shift
  40. done
  41. if [ -z "$SRC" ]; then
  42. echo "Warning, path to system dump not specified, pulling from adb"
  43. SRC=adb
  44. fi
  45. if [ -z "$TARGET" ]; then
  46. echo "Warning, target for extraction not specified, defaulting to arm"
  47. TARGET=arm
  48. fi
  49. # Initialize the helper for common gapps
  50. setup_vendor "$GAPPS_COMMON" "$VENDOR" "$CM_ROOT"
  51. extract "$MY_DIR"/common-proprietary-files.txt "$SRC"
  52. # Reinitialize the helper for target gapps
  53. setup_vendor "$TARGET" "$VENDOR" "$CM_ROOT"
  54. extract "$MY_DIR"/proprietary-files-$TARGET.txt "$SRC"
  55. extract "$MY_DIR"/proprietary-files.txt "$SRC"
  56. "$MY_DIR"/setup-makefiles.sh