diff --git a/bin/aarch64/fuse.erofs b/bin/aarch64/fuse.erofs new file mode 100755 index 0000000..462f9b4 Binary files /dev/null and b/bin/aarch64/fuse.erofs differ diff --git a/bin/aarch64/mkfs.erofs b/bin/aarch64/mkfs.erofs new file mode 100755 index 0000000..7ac3170 Binary files /dev/null and b/bin/aarch64/mkfs.erofs differ diff --git a/bin/x86_64/fuse.erofs b/bin/x86_64/fuse.erofs new file mode 100755 index 0000000..472f926 Binary files /dev/null and b/bin/x86_64/fuse.erofs differ diff --git a/bin/x86_64/mkfs.erofs b/bin/x86_64/mkfs.erofs new file mode 100755 index 0000000..e23b767 Binary files /dev/null and b/bin/x86_64/mkfs.erofs differ diff --git a/docs/README.md b/docs/README.md index 2edc202..e65d817 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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._ diff --git a/scripts/build.sh b/scripts/build.sh index c008542..00866a1 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -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 diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh index 6171de6..a8ad62a 100755 --- a/scripts/install_deps.sh +++ b/scripts/install_deps.sh @@ -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)