FerryAr / lhroot

Linux Chroot Installer & Bootscript Magisk Module.
GNU General Public License v3.0
195 stars 21 forks source link

storage suggestions #9

Open Efreak opened 2 years ago

Efreak commented 2 years ago

This is just a suggestion, not a request: prompt the user for the location of the chroot. This could be an image located on the sdcard, a directory in the filesystem, etc. I have an sdcard that I intend to partition, and I'll be mounting one of the partitions into /data/debian to use for the chroot.

Secondly, it may be worthwhile to have an option for extra mount points. For example, bootlinux termux/home/.local/bin:/root/.local/bin /storage/????-????/cargo-registry:/root/.cargo/registry. This would be useful for things like keeping large data directories on the external sdcard instead of eating internal storage. My device only has 16gb internally, so I'm using bind mounts for .cargo/registry, system man pages, and a few other areas. I should note that there's something odd about the external sdcard, I had to mount it separately to do this, as bind mounting /storage/????-???? resulted in an empty directory. I haven't debugged this, I just mounted it to /data/debian/mnt/external instead.

FerryAr commented 2 years ago

@Efreak

  1. I choose /data, because other partition have noexec mount flag. So I make mount_image and make_image scripts for users that want to use custom path.
  2. external sdcard have completely random path. I can't detect it, plus as I mentioned before, it has mounted with noexec flag
Efreak commented 2 years ago

I meant the location of a file or device backing the chroot, not for the directory the chroot is mounted into.

Noexec on a mount point is irrelevant mounted files stored there. /storage/????-???? is mounted noexec, but /storage/????-????/disk.img mounted at /data/debian/mnt/image is not; I just double checked this with the BusyBox binary and it works fine. (The loop device is still in use even after it's umounted, you need to use losetup -D after unmounting).

As for finding where the sdcard is located, this can actually be done with the storage manager command sm list-volumes (sm is also what you would use if you wanted to partition the sdcard as partially adoptable storage, iirc). I'm not sure if there's any guarantee that there's only one public device as in the example below, but would assume not:

~ $ su -c 'sm list-volumes'
private mounted null
emulated;0 mounted null
public:179,65 mounted EE3A-8875

~ $ su -c 'sm list-volumes'|fgrep public|cut -d' ' -f3
EE3A-8875

I was unaware there's a mount_image and make_image script because I'm a dummy who didn't read the complete readme, so that makes sense. I don't have any objections to using /data/debian as a default, either. I'm really just looking for a way to make using custom locations more automated.

As far as extra point points goes, I mean for directories to be bind-mounted inside the chroot, to make them more readily available (like my static termux user bins, or /sdcard/Downloads, etc).