Magisk-Modules-Alt-Repo / chroot-distro

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

Fix install and uninstall #7

Closed jjkola closed 2 months ago

jjkola commented 2 months ago

Fixed distro install when there is a single root directory which contains the real rootfs. Fixes #6

Fixed mount handling for install and uninstall, and added checks for errors with mounting/unmounting to prevent data loss (previous implementation nuked storage spaces, fortunately I had backups). Also, just in case, added unlinking of symbol links before removing the files.

The new implementation prevents uninstall if /data folder is mounted on rootfs as there is circular referencing (chroot-distro installs rootfs under /data/local/chroot-distro folder). Because of circular references unmounting /data during the script is not an option (I have tried and failed miserably).

Fixed indentation and whitespace.

jjkola commented 2 months ago

There is still at least two commits coming:

jjkola commented 2 months ago

There is still issues I would like to address, most notable being restore mangling the restored installation. But I recon that there is already quite much stuff going on in this PR, so unless code review causes some changes, or I find some blocker bug with the implementation, I will not update this PR for now.

Decided to add argument passing to command invocation and also made it possible to provide full path for the command (the original code assumed that commands are always in /bin folder). This will hopefully be the last change for this PR.

jjkola commented 2 months ago

@YasserNull any chances of getting this reviewed in timely manner? I would like to see this merged as soon as possible because of indentation and nesting changes. They will make merging changes from main branch problematic.

Also, this PR and my new fix_backup_and_restore branch (for which I will create PR after this PR is in) makes it possible to use your script without worrying about unintentionally wiping device data, or having to manually fix restored distro (current implementation does not restore distro properly).

By the way, should this PR be against your own repo (https://github.com/YasserNull/chroot-distro)? Or is this current one ok?

YasserNull commented 2 months ago

Merged, thanks brother, I appreciate this.