Magisk-Modules-Alt-Repo / chroot-distro

install linux distributions on android
GNU General Public License v3.0
129 stars 9 forks source link

Adb shell: installing a distro fails #26

Closed jjkola closed 2 months ago

jjkola commented 2 months ago

Fixes #23.

Some versions of tar used in android environment does not support xz compression natively. Added xz piping to tar for these cases, or if gzip compression is good enough then used that.

Added checks for tar (de)compression failing.

Fixed chroot-distro calls without parameters and fixed some shellcheck warnings.

jjkola commented 2 months ago

Unfortunately the check for the type of the archive had to use -t (integrity test) for both gunzip and xz. Originally I just wanted to add a check for magic bytes, which would have been very quick to check but unfortunately the version of head which I had on my tablet did not support characters, only lines. And using shell script or dd would not have been any better as they had problems of their own. Then I thought using -l (general information about contents) but unfortunately that was also unsupported. Thus this left me with the only option of using -t which also is not without its problems, namely the whole archive will be checked for correctness. This wouldn't be a problem if there already wasn't going through the archive two times (once for getting the directory structure and once for the extract), thus causing the archive being processed three times. This is not a problem for small archives but for the bigger once it starts to slow down the process considerably.

If this problem needs to be addressed then the most likely change would be to switch to native code where it would be easier to prevent unnecessary processing. But then again, the install procedure is not used that often, at least for the most use cases, so it should not be a major problem.