NicolasWebDev / reinstall-magisk-on-lineageos

Small bash script to reinstall magisk after each LineageOS update
75 stars 16 forks source link

cmder support #10

Closed mattdale77 closed 2 years ago

mattdale77 commented 2 years ago

These changes are a bit hacky and there may be a better way but cmder looks at each argument and if it begins with / then it maps this to the local windows filesystem regardless of whether the argument is referring to the local filesystem. I changed the following functions so compensate for this

enable_adb_root_access() {
adb -s "$PHONE_ADB_SERIAL_NUMBER" root &&
adb -s "$PHONE_ADB_SERIAL_NUMBER" shell "ls /" # ADDED DOUBLE QUOTES HERE
}

transfer_unpatched_boot_image_to_phone() {
adb -s "$PHONE_ADB_SERIAL_NUMBER" push /tmp/boot.img "./sdcard/Download/boot.img" # Added ./ to the argument which works as adb starts in the root directory
}

patch_boot_image_on_phone() {
adb -s "$PHONE_ADB_SERIAL_NUMBER" shell ./data/adb/magisk/boot_patch.sh ../../../sdcard/Download/boot.img # Added ./ to the path for the command and made the path to the boot.img relative to the patch script rather than absolute adb -s "$PHONE_ADB_SERIAL_NUMBER" shell mv ./data/adb/magisk/new-boot.img ./sdcard/Download/patched-boot.img # Again just added ./ to make it relative to the root directory where adb starts }

transfer_patched_boot_image_to_pc() {
adb -s "$PHONE_ADB_SERIAL_NUMBER" pull ./sdcard/Download/patched-boot.img /tmp # Added ./ to the remote file location to make it relative to the root directory where adb starts }

NicolasWebDev commented 2 years ago

@mattdale77 , now that I am reviewing the issues you created in more details, I don't quite understand what shell you are using. I see the list of shells supported by cmder here, which one of these are you using? Would it be cmd.exe?

mattdale77 commented 2 years ago

Hi, I was using bash. Sorry, I forgot this wasn't the default shell

NicolasWebDev commented 2 years ago

@mattdale77 , it seems that the default bash in cmder is actually git-for-windows behind the scenes. Git for windows provides what they call a bash emulation, so there are many differences and many things will not work.

Here are the corresponding lines from the README of cmder that talks about bash:

warning NOTE: Only the full edition of Cmder comes with a pre-installed bash, using a vendored git-for-windows installation. The pre-configured Bash tabs may not work on Cmder mini edition without additional configuration.

See the corresponding part in the readme for more context.

I recommend you to try bash using WSL instead, which can be used by cmder itself if you feel the need for it.

You may however, choose to use an external installation of bash, such as Microsoft's Subsystem for Linux (called WSL) or the Cygwin project which provides POSIX support on windows.

WSL provides a fully functional linux distribution in your windows machine, as a command-line, with its own filesystem and tools.

If you are able to try it out with WSL, please update the issues accordingly so that we may focus on the possible other problems you may have.

mattdale77 commented 2 years ago

I've not used WSL, it seems like it might be a better way to get a bash shell. I'll look into it (or maybe just sack off windows entirely 😃). It seems like this issue will not be an issue with real bash so going to close

NicolasWebDev commented 2 years ago

Indeed, going all-linux could be a good play as well hahaha. But actually now with WSL, you have a real Linux Distribution under the hood, so at least command-line wise everything is possible.

Do you think that this version of bash may have an impact on both the other issues you raised, or not?

mattdale77 commented 2 years ago

The two other issues I raised are not related to cmder. I don't think there are any intricacies in either affect by the pseudo bash of cmder On 7 Jun 2022, 15:46 +0100, NicolasWebDev @.***>, wrote:

Indeed, going all-linux could be a good play as well hahaha. But actually now with WSL, you have a real Linux Distribution under the hood, so at least command-line wise everything is possible. Do you think that this version of bash may have an impact on both the other issues you raised, or not? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>