You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

treble_repo_update.sh 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/bash
  2. # exit script immediately if a command fails
  3. set -e
  4. ANDROOT=$PWD
  5. HTTP=https
  6. RESOLVED_REPO_PATH="$ANDROOT/$(dirname $(readlink $0))"
  7. PATCHES_PATH=$RESOLVED_REPO_PATH/patches
  8. pushd () {
  9. command pushd "$@" > /dev/null
  10. }
  11. popd () {
  12. command popd "$@" > /dev/null
  13. }
  14. commit_exists() {
  15. _sha1=$1
  16. git rev-parse --quiet --verify $_sha1^{commit}
  17. }
  18. apply_commit() {
  19. _commit=$1
  20. if commit_exists $_commit
  21. then
  22. git cherry-pick $_commit
  23. else
  24. git fetch $LINK $_commit && git cherry-pick $_commit
  25. fi
  26. }
  27. apply_gerrit_cl_commit() {
  28. _cl=$1
  29. _commit=$2
  30. if commit_exists $_commit
  31. then
  32. git cherry-pick $_commit
  33. else
  34. git fetch $LINK $_cl && git cherry-pick FETCH_HEAD
  35. fi
  36. }
  37. apply_pull_commit() {
  38. _pull=$1
  39. _commit=$2
  40. if commit_exists $_commit
  41. then
  42. git cherry-pick $_commit
  43. else
  44. git fetch $LINK pull/$_pull/head && git cherry-pick $_commit
  45. fi
  46. }
  47. echo ""
  48. echo " ████████╗██████╗ ███████╗██████╗ ██╗ ███████╗"
  49. echo " ╚══██╔══╝██╔══██╗██╔════╝██╔══██╗██║ ██╔════╝"
  50. echo " ██║ ██████╔╝█████╗ ██████╔╝██║ █████╗"
  51. echo " ██║ ██╔══██╗██╔══╝ ██╔══██╗██║ ██╔══╝"
  52. echo " ██║ ██║ ██║███████╗██████╔╝███████╗███████╗"
  53. echo " ╚═╝ ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚══════╝"
  54. echo ""
  55. echo " applying treble patches..."
  56. echo ""
  57. pushd $ANDROOT/kernel/sony/msm-4.9/kernel
  58. # dtsi: tone: conjure oem into /vendor
  59. git am < $PATCHES_PATH/dtsi-tone-conjure-oem-into-vendor.patch
  60. # dtsi: loire: conjure oem into /vendor
  61. git am < $PATCHES_PATH/dtsi-loire-conjure-oem-into-vendor.patch
  62. popd
  63. pushd $ANDROOT/build/make
  64. # releasetools: Skip adding compatiblity.zip
  65. git am < $PATCHES_PATH/build-releasetools-skip-compatiblity-zip.patch
  66. popd
  67. pushd $ANDROOT/device/sony/common
  68. LINK=$HTTP && LINK+="://git.ix5.org/felix/device-sony-common"
  69. (git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
  70. # Revert: Switch selinux to enforcing
  71. # (needed because there might be problems with misbehaving GSI sepolicies)
  72. git revert --no-edit selinux-enforcing-temp-tag
  73. # git checkout 'treble-odm'
  74. # Use oem as /vendor and add treble quirks
  75. apply_commit 2ba4c51c8952619d4df40ed16ec91f4c16924b6b
  76. # git checkout 'extra-odm-symlinks'
  77. # Add extra odm symlinks
  78. #apply_commit 0204402094868621e7c859d1521d7f5d4fda3259
  79. popd
  80. pushd $ANDROOT/device/sony/tone
  81. LINK=$HTTP && LINK+="://git.ix5.org/felix/device-sony-tone"
  82. (git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
  83. # git checkout 'treble-odm'
  84. # Use oem as /vendor
  85. apply_commit 025f56891b9d6ec3a86f0c84fab534119a3b2006
  86. popd
  87. pushd $ANDROOT/device/sony/loire
  88. LINK=$HTTP && LINK+="://git.ix5.org/felix/device-sony-loire"
  89. (git remote --verbose | grep -q $LINK) || git remote add ix5 $LINK
  90. # git checkout 'treble-odm'
  91. # Use oem as /vendor
  92. apply_commit 1170e85e4567e44314eff0b55566957632c8b2bc
  93. popd
  94. pushd $ANDROOT/system/core
  95. # init: Always allow permissive
  96. # Horrible workaround to get permissive SELinux in user builds
  97. git am < $PATCHES_PATH/system-core-always-allow-permissive.patch
  98. popd
  99. # because "set -e" is used above, when we get to this point, we know
  100. # all patches were applied successfully.
  101. echo ""
  102. echo " ████████╗██████╗ ███████╗██████╗ ██╗ ███████╗"
  103. echo " ╚══██╔══╝██╔══██╗██╔════╝██╔══██╗██║ ██╔════╝"
  104. echo " ██║ ██████╔╝█████╗ ██████╔╝██║ █████╗"
  105. echo " ██║ ██╔══██╗██╔══╝ ██╔══██╗██║ ██╔══╝"
  106. echo " ██║ ██║ ██║███████╗██████╔╝███████╗███████╗"
  107. echo " ╚═╝ ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚══════╝"
  108. echo ""
  109. echo " all treble patches applied successfully!"
  110. echo ""
  111. echo ""
  112. echo ""
  113. echo ""
  114. echo ""
  115. echo ""
  116. echo ""
  117. echo ""
  118. echo ""
  119. echo " DO NOT FORGET TO INCLUDE device/sony/customization!!!"
  120. echo ""
  121. echo " ELSE YOUR DEVICE WILL NOT BOOT!!!!"
  122. echo ""
  123. echo ""
  124. echo " ALSO COPY THE ODM FILES!!!!"
  125. echo ""
  126. set +e