diff options
author | Arian <arian.kulmer@web.de> | 2021-09-09 15:24:25 +0200 |
---|---|---|
committer | Arian <arian.kulmer@web.de> | 2021-09-09 15:40:02 +0200 |
commit | 8b335032f49a2a9bbd6ea7ff76a91a91d83a7006 (patch) | |
tree | f546f60aba6b2681b843943fba8d886f7e4e250d /extract_utils.sh | |
parent | 302226bb77fbe1c93a2dc519bcda4cdab30d2f69 (diff) |
extract_utils: Don't fixup pinned files when they are supposed to be kept
Change-Id: I6f38bf5928061b0f09eda04f85e00b11912d0227
Diffstat (limited to 'extract_utils.sh')
-rw-r--r-- | extract_utils.sh | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/extract_utils.sh b/extract_utils.sh index a30be45..5504d03 100644 --- a/extract_utils.sh +++ b/extract_utils.sh @@ -1611,50 +1611,50 @@ function extract() { colored_echo red " !! ${BLOB_DISPLAY_NAME}: file not found in source" continue fi - fi - # Blob fixup pipeline has 2 parts: one that is fixed and - # one that is user-configurable - local PRE_FIXUP_HASH=$(get_hash ${VENDOR_REPO_FILE}) - # Deodex apk|jar if that's the case - if [[ "$FULLY_DEODEXED" -ne "1" && "${VENDOR_REPO_FILE}" =~ .(apk|jar)$ ]]; then - oat2dex "${VENDOR_REPO_FILE}" "${SRC_FILE}" "$SRC" - if [ -f "$TMPDIR/classes.dex" ]; then - touch -t 200901010000 "$TMPDIR/classes"* - zip -gjq "${VENDOR_REPO_FILE}" "$TMPDIR/classes"* - rm "$TMPDIR/classes"* - printf ' (updated %s from odex files)\n' "${SRC_FILE}" + # Blob fixup pipeline has 2 parts: one that is fixed and + # one that is user-configurable + local PRE_FIXUP_HASH=$(get_hash ${VENDOR_REPO_FILE}) + # Deodex apk|jar if that's the case + if [[ "$FULLY_DEODEXED" -ne "1" && "${VENDOR_REPO_FILE}" =~ .(apk|jar)$ ]]; then + oat2dex "${VENDOR_REPO_FILE}" "${SRC_FILE}" "$SRC" + if [ -f "$TMPDIR/classes.dex" ]; then + touch -t 200901010000 "$TMPDIR/classes"* + zip -gjq "${VENDOR_REPO_FILE}" "$TMPDIR/classes"* + rm "$TMPDIR/classes"* + printf ' (updated %s from odex files)\n' "${SRC_FILE}" + fi + elif [[ "${VENDOR_REPO_FILE}" =~ .xml$ ]]; then + fix_xml "${VENDOR_REPO_FILE}" fi - elif [[ "${VENDOR_REPO_FILE}" =~ .xml$ ]]; then - fix_xml "${VENDOR_REPO_FILE}" - fi - # Now run user-supplied fixup function - blob_fixup "${BLOB_DISPLAY_NAME}" "${VENDOR_REPO_FILE}" - local POST_FIXUP_HASH=$(get_hash ${VENDOR_REPO_FILE}) - - if [ -f "${VENDOR_REPO_FILE}" ]; then - local DIR=$(dirname "${VENDOR_REPO_FILE}") - local TYPE="${DIR##*/}" - if [ "$TYPE" = "bin" -o "$TYPE" = "sbin" ]; then - chmod 755 "${VENDOR_REPO_FILE}" - else - chmod 644 "${VENDOR_REPO_FILE}" + # Now run user-supplied fixup function + blob_fixup "${BLOB_DISPLAY_NAME}" "${VENDOR_REPO_FILE}" + local POST_FIXUP_HASH=$(get_hash ${VENDOR_REPO_FILE}) + + if [ -f "${VENDOR_REPO_FILE}" ]; then + local DIR=$(dirname "${VENDOR_REPO_FILE}") + local TYPE="${DIR##*/}" + if [ "$TYPE" = "bin" -o "$TYPE" = "sbin" ]; then + chmod 755 "${VENDOR_REPO_FILE}" + else + chmod 644 "${VENDOR_REPO_FILE}" + fi fi - fi - if [ "${KANG}" = true ]; then - print_spec "${IS_PRODUCT_PACKAGE}" "${SPEC_SRC_FILE}" "${SPEC_DST_FILE}" "${SPEC_ARGS}" "${PRE_FIXUP_HASH}" "${POST_FIXUP_HASH}" - fi + if [ "${KANG}" = true ]; then + print_spec "${IS_PRODUCT_PACKAGE}" "${SPEC_SRC_FILE}" "${SPEC_DST_FILE}" "${SPEC_ARGS}" "${PRE_FIXUP_HASH}" "${POST_FIXUP_HASH}" + fi - # Check and print whether the fixup pipeline actually did anything. - # This isn't done right after the fixup pipeline because we want this print - # to come after print_spec above, when in kang mode. - if [ "${PRE_FIXUP_HASH}" != "${POST_FIXUP_HASH}" ]; then - printf " + Fixed up %s\n" "${BLOB_DISPLAY_NAME}" - # Now sanity-check the spec for this blob. - if [ "${KANG}" = false ] && [ "${FIXUP_HASH}" = "x" ] && [ "${HASH}" != "x" ]; then - colored_echo yellow "WARNING: The ${BLOB_DISPLAY_NAME} file was fixed up, but it is pinned." - colored_echo yellow "This is a mistake and you want to either remove the hash completely, or add an extra one." + # Check and print whether the fixup pipeline actually did anything. + # This isn't done right after the fixup pipeline because we want this print + # to come after print_spec above, when in kang mode. + if [ "${PRE_FIXUP_HASH}" != "${POST_FIXUP_HASH}" ]; then + printf " + Fixed up %s\n" "${BLOB_DISPLAY_NAME}" + # Now sanity-check the spec for this blob. + if [ "${KANG}" = false ] && [ "${FIXUP_HASH}" = "x" ] && [ "${HASH}" != "x" ]; then + colored_echo yellow "WARNING: The ${BLOB_DISPLAY_NAME} file was fixed up, but it is pinned." + colored_echo yellow "This is a mistake and you want to either remove the hash completely, or add an extra one." + fi fi fi |