mirror of
https://github.com/LSPosed/MagiskOnWSALocal.git
synced 2025-04-17 22:19:08 +00:00
EROFS mount using fuse (#553)
Get rid of kernel support of EROFS Pre-build `erofs-utils` from https://github.com/sekaiacg/erofs-utils/releases/tag/v1.6-230502 Since it is statically linked, so binary build for Android also works for other platforms. x86_64 using [erofs-utils-v1.6-g689372cd-Linux_x86_64-2305022024.zip](https://github.com/sekaiacg/erofs-utils/releases/download/v1.6-230502/erofs-utils-v1.6-g689372cd-Linux_x86_64-2305022024.zip) aarch64 using [erofs-utils-v1.6-g689372cd-Android_arm64-v8a-2305022023.zip](https://github.com/sekaiacg/erofs-utils/releases/download/v1.6-230502/erofs-utils-v1.6-g689372cd-Android_arm64-v8a-2305022023.zip) Fix #535 Close #552
This commit is contained in:
parent
969d2b2fa6
commit
d8e875a4ae
7 changed files with 23 additions and 12 deletions
BIN
bin/aarch64/fuse.erofs
Executable file
BIN
bin/aarch64/fuse.erofs
Executable file
Binary file not shown.
BIN
bin/aarch64/mkfs.erofs
Executable file
BIN
bin/aarch64/mkfs.erofs
Executable file
Binary file not shown.
BIN
bin/x86_64/fuse.erofs
Executable file
BIN
bin/x86_64/fuse.erofs
Executable file
Binary file not shown.
BIN
bin/x86_64/mkfs.erofs
Executable file
BIN
bin/x86_64/mkfs.erofs
Executable file
Binary file not shown.
|
@ -8,10 +8,10 @@
|
|||
|
||||
The following dependencies are required:
|
||||
|
||||
| DistrOS | | | | |
|
||||
|:-------------------:|--------------------------------------------------------------------------------------------|------------|--------------|--------------------|
|
||||
| Debian | `lzip patchelf e2fsprogs python3 python3-pip aria2 p7zip-full attr unzip sudo erofs-utils` | `whiptail` | `qemu-utils` | `python3-venv` |
|
||||
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` | `python3-venvctrl` |
|
||||
| DistrOS | | | | |
|
||||
|:-------------------:|--------------------------------------------------------------------------------|------------|--------------|--------------------|
|
||||
| Debian | `lzip patchelf e2fsprogs python3 python3-pip aria2 p7zip-full attr unzip sudo` | `whiptail` | `qemu-utils` | `python3-venv` |
|
||||
| openSUSE Tumbleweed | Same as above | `dialog` | `qemu-tools` | `python3-venvctrl` |
|
||||
|
||||
The python3 library `requests` is used.
|
||||
|
||||
|
@ -176,6 +176,7 @@
|
|||
- [The Open GApps Project](https://opengapps.org): One of the most famous Google Apps packages solution
|
||||
- [WSA-Kernel-SU](https://github.com/LSPosed/WSA-Kernel-SU) and [kernel-assisted-superuser](https://git.zx2c4.com/kernel-assisted-superuser/): The kernel `su` for debugging Magisk Integration
|
||||
- [WSAGAScript](https://github.com/ADeltaX/WSAGAScript): The first GApps integration script for WSA
|
||||
- [erofs-utils](https://github.com/sekaiacg/erofs-utils): Pre-build `erofs-utils` with erofsfuse enabled
|
||||
|
||||
_The repository is provided as a utility._
|
||||
|
||||
|
|
|
@ -52,14 +52,15 @@ declare -A MERGED_PARTITION=(["zsystem"]="$ROOT_MNT" ["vendor"]="$VENDOR_MNT" ["
|
|||
DOWNLOAD_DIR=../download
|
||||
DOWNLOAD_CONF_NAME=download.list
|
||||
PYTHON_VENV_DIR="$(dirname "$PWD")/python3-env"
|
||||
EROFS_USE_FUSE=1
|
||||
umount_clean() {
|
||||
if [ -d "$ROOT_MNT" ] || [ -d "$ROOT_MNT_RO" ]; then
|
||||
echo "Cleanup Mount Directory"
|
||||
for PART in "${LOWER_PARTITION[@]}"; do
|
||||
[ -d "$PART" ] && sudo umount -v "$PART"
|
||||
sudo umount -v "$PART"
|
||||
done
|
||||
for PART in "${MERGED_PARTITION[@]}"; do
|
||||
[ -d "$PART" ] && sudo umount -v "$PART"
|
||||
sudo umount -v "$PART"
|
||||
done
|
||||
sudo rm -rf "${WORK_DIR:?}"
|
||||
else
|
||||
|
@ -188,7 +189,7 @@ mk_overlayfs() {
|
|||
}
|
||||
|
||||
mk_erofs_umount() {
|
||||
sudo mkfs.erofs -zlz4hc -T1230768000 --chunksize=4096 --exclude-regex="lost+found" "$2".erofs "$1" || abort "Failed to make erofs image from $1"
|
||||
sudo "../bin/$HOST_ARCH/mkfs.erofs" -zlz4hc -T1230768000 --chunksize=4096 --exclude-regex="lost+found" "$2".erofs "$1" || abort "Failed to make erofs image from $1"
|
||||
sudo umount -v "$1"
|
||||
sudo rm -f "$2"
|
||||
sudo mv "$2".erofs "$2"
|
||||
|
@ -201,6 +202,14 @@ ro_ext4_img_to_rw() {
|
|||
return 0
|
||||
}
|
||||
|
||||
mount_erofs() {
|
||||
if [ "$EROFS_USE_FUSE" ]; then
|
||||
sudo "../bin/$HOST_ARCH/fuse.erofs" "$1" "$2" || return 1
|
||||
else
|
||||
sudo mount -v -t erofs -o ro,loop "$1" "$2" || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# workaround for Debian
|
||||
# In Debian /usr/sbin is not in PATH and some utilities in there are in use
|
||||
[ -d /usr/sbin ] && export PATH="/usr/sbin:$PATH"
|
||||
|
@ -631,15 +640,16 @@ if [[ "$WSA_MAIN_VER" -ge 2302 ]]; then
|
|||
vhdx_to_raw_img "$WORK_DIR/wsa/$ARCH/vendor.vhdx" "$WORK_DIR/wsa/$ARCH/vendor.img" || abort
|
||||
echo -e "Convert vhdx to RAW image done\n"
|
||||
fi
|
||||
|
||||
if [[ "$WSA_MAIN_VER" -ge 2304 ]]; then
|
||||
echo "Mount images"
|
||||
sudo mkdir -p -m 755 "$ROOT_MNT_RO" || abort
|
||||
sudo chown "0:0" "$ROOT_MNT_RO" || abort
|
||||
sudo setfattr -n security.selinux -v "u:object_r:rootfs:s0" "$ROOT_MNT_RO" || abort
|
||||
sudo mount -v -t erofs -o loop "$WORK_DIR/wsa/$ARCH/system.img" "$ROOT_MNT_RO" || abort
|
||||
sudo mount -v -t erofs -o loop "$WORK_DIR/wsa/$ARCH/vendor.img" "$VENDOR_MNT_RO" || abort
|
||||
sudo mount -v -t erofs -o loop "$WORK_DIR/wsa/$ARCH/product.img" "$PRODUCT_MNT_RO" || abort
|
||||
sudo mount -v -t erofs -o loop "$WORK_DIR/wsa/$ARCH/system_ext.img" "$SYSTEM_EXT_MNT_RO" || abort
|
||||
mount_erofs "$WORK_DIR/wsa/$ARCH/system.img" "$ROOT_MNT_RO" || abort
|
||||
mount_erofs "$WORK_DIR/wsa/$ARCH/vendor.img" "$VENDOR_MNT_RO" || abort
|
||||
mount_erofs "$WORK_DIR/wsa/$ARCH/product.img" "$PRODUCT_MNT_RO" || abort
|
||||
mount_erofs "$WORK_DIR/wsa/$ARCH/system_ext.img" "$SYSTEM_EXT_MNT_RO" || abort
|
||||
echo -e "done\n"
|
||||
echo "Create overlayfs for EROFS"
|
||||
mk_overlayfs "$ROOT_MNT_RO" system "$ROOT_MNT" || abort
|
||||
|
|
|
@ -37,6 +37,7 @@ require_su() {
|
|||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Checking and ensuring dependencies"
|
||||
check_dependencies() {
|
||||
command -v whiptail >/dev/null 2>&1 || command -v dialog >/dev/null 2>&1 || NEED_INSTALL+=("whiptail")
|
||||
|
@ -50,7 +51,6 @@ check_dependencies() {
|
|||
command -v unzip >/dev/null 2>&1 || NEED_INSTALL+=("unzip")
|
||||
command -v qemu-img >/dev/null 2>&1 || NEED_INSTALL+=("qemu-utils")
|
||||
command -v sudo >/dev/null 2>&1 || NEED_INSTALL+=("sudo")
|
||||
command -v mkfs.erofs >/dev/null 2>&1 || NEED_INSTALL+=("erofs-utils")
|
||||
}
|
||||
check_dependencies
|
||||
osrel=$(sed -n '/^ID_LIKE=/s/^.*=//p' /etc/os-release)
|
||||
|
|
Loading…
Add table
Reference in a new issue