Lanchon / haystack

Signature Spoofing Patcher for Android
GNU General Public License v3.0
233 stars 45 forks source link

Pixel (XL) compatibility: TWRP mounts the system partition in /system/system #12

Closed TheArkive closed 7 years ago

TheArkive commented 7 years ago

Script Suggestion

Just wanted to give some suggestions for modifications.

Firstly in the .global file, shouldn't the array "fs_framework_jars" include more values? Like so:

fs_framework_jars=( ext.jar services.jar core-libart.jar core-oj.jar core.jar )

This would mitigate the need for some of the code in pulling/pushing certain files by name. And actually it seems that framework.jar and framework2.jar should be in there as well. I tested this on a push command and it successfully pushed all jar files.

Pixel (XL) compatibility

Unfortunately the remount command doesn't work the same on the Pixel (XL) phones. ADB isn't the issue, it's the phones themselves. However if you reboot into TWRP and manually mount system then the script works fine except for one thing, the different folder structure.

On the Pixel (XL), when in TWRP recovery, the actual root of "system" is "/system/system/" (not just "/system/"). The pull command works fine when the device is booted to the OS (and properly rooted), but the push command fails when trying to push files after a false indication of a successful remount. Below is a rewritten "push-fileset" script for Pixel (XL) - to be used in TWRP after manually mounting /system.

push-fileset (modified)

#!/bin/bash

set -e

base_suffix=.
source "$(dirname "$(readlink -f "$0")")/$base_suffix/.global"

if [ "$1" == "" ]; then
    usage "push-fileset <fileset-dir> [ <adb-option> ... ]"
fi

fileset_dir="${1%/}"
adb_options=( "${@:2}" )

check_fileset "$fileset_dir"
check_adb

run_adb root || true
#run_adb wait-for-device
run_adb remount || true

run_adb push "$fileset_dir/framework.jar" "/system/system/framework/" ||
echo ""

if [ -f "$fileset_dir/framework2.jar" ]; then
    run_adb push "$fileset_dir/framework2.jar" "/system/system/framework/"
    echo ""
fi

# TODO: Support the two versions of core jars that KK devices have.

for file in "${fs_framework_jars[@]}"; do
    run_adb push "$fileset_dir/$file" "/system/system/framework/" ||
    echo ""
done

for file in "${fs_priv_apps[@]}"; do
    run_adb push "$fileset_dir/$file" "/system/system/priv-app/${file%.apk}/" ||
        run_adb push "$fileset_dir/$file" "/system/priv-app/" ||
        run_adb push "$fileset_dir/$file" "/system/app/"
        echo ""
done

for file in "${fs_non_priv_apps[@]}"; do
    run_adb push "$fileset_dir/$file" "/system/app/${file%.apk}/" ||
        run_adb push "$fileset_dir/$file" "/system/system/app/${file%.apk}/" ||
        run_adb push "$fileset_dir/$file" "/system/app/"
        echo ""
done

echo
echo "*** push-fileset: success"

The will not likely work as expected for all other devices. This modification allows compatibility for the Pixel and Pixel XL as long as you are in TWRP with /system mounted as rw. Note that you will also want to modify the fs_framework_jars array I mentioned above in the .global file. (You'll need to enable hidden files to see it - CTRL+H in Ubuntu with default file browser).

As a side project, I intend to try my skills at learning bash on a deeper level and rewriting the 3 main scripts to better account for different possibilities, and I'll probably rewrite the intent for using TWRP, or add options to choose TWRP or "in-OS" functionality.

I'm hopelessly tied to MicroG and all its awesomeness so I need signature spoofing!! Further developing these scripts to be slightly easier to use will greatly benefit my future "custom ROM fashing" endeavors anyways!

I'll post them once I have a complete set.

Lanchon commented 7 years ago

hi,

Script Suggestion

thanks. note that i carefully made these scripts while analyzing the huge differences between all released AOSP versions from 1.5 to 7.1 inclusive. the scripts are the way they are for good reason.

On the Pixel (XL), when in TWRP recovery, the actual root of "system" is "/system/system/"

i don't know why the hell TWRP would mount it there. i have no plans to support this for now. you can fork the project on github, update the push and pull scripts for the Pixel, and link your fork from here if you want to share your work with others.