From 27aff0a24fea6368d0247eba560c733d0a4ab3be Mon Sep 17 00:00:00 2001
From: VR-25 <28943176+VR-25@users.noreply.github.com>
Date: Mon, 6 Dec 2021 17:55:03 +0100
Subject: [PATCH] v2021.12.6 (202112060) - Added TOC to readme; - General
optimizations; - Improved Android 11+ support.
---
README.html | 26 ++++++++++++++++++++------
README.md | 24 +++++++++++++++++++-----
module.prop | 4 ++--
system/bin/fbind | 42 +++++++++++++++++++++++++-----------------
4 files changed, 66 insertions(+), 30 deletions(-)
diff --git a/README.html b/README.html
index 3957656..f64770b 100644
--- a/README.html
+++ b/README.html
@@ -38,6 +38,20 @@
fbind
+
+
DESCRIPTION
fbind is a versatile mounting utility for folders, disk images, LUKS/LUKS2 encrypted volumes, regular partitions and more.
@@ -275,12 +289,6 @@ LINKS
LATEST CHANGES
-v2021.11.22-beta (202111220)
-
--t|--test-prefixes
: test internal storage prefixes (views) and automatically update the config.
-- Changed the priorities of emulated storage views to better accommodate Android 11+.
-- General optimizations
-
v2021.12.2 (202112020)
- Enhanced flashable zip generator;
@@ -292,6 +300,12 @@ LATEST CHANGES
v2021.12.2.1 (202112021)
+v2021.12.6 (202112060)
+
+- Added TOC to readme;
+- General optimizations;
+- Improved Android 11+ support.
diff --git a/README.md b/README.md
index 67444cf..8419e41 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,20 @@
# fbind
+---
+- [DESCRIPTION](#description)
+- [LICENSE](#license)
+- [DISCLAIMER](#disclaimer)
+- [WARNING](#warning)
+- [PRE-REQUISITES](#pre-requisites)
+- [CONFIG SYNTAX](#config-syntax)
+- [CONFIG EXAMPLES](#config-examples)
+- [TERMINAL COMMANDS](#terminal-commands)
+- [NOTES](#notes)
+- [LINKS](#links)
+- [LATEST CHANGES](#latest-changes)
+
+
---
## DESCRIPTION
@@ -283,11 +297,6 @@ If `/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr
---
## LATEST CHANGES
-v2021.11.22-beta (202111220)
-- `-t|--test-prefixes`: test internal storage prefixes (views) and automatically update the config.
-- Changed the priorities of emulated storage views to better accommodate Android 11+.
-- General optimizations
-
v2021.12.2 (202112020)
- Enhanced flashable zip generator;
- Implemented `losetup` wrapper for greater compatibility;
@@ -297,3 +306,8 @@ v2021.12.2 (202112020)
v2021.12.2.1 (202112021)
- Auto-mount hotfix
+
+v2021.12.6 (202112060)
+- Added TOC to readme;
+- General optimizations;
+- Improved Android 11+ support.
diff --git a/module.prop b/module.prop
index f7ab8b5..f1d18a2 100644
--- a/module.prop
+++ b/module.prop
@@ -1,6 +1,6 @@
id=vr25.fbind
name=fbind
-version=v2021.12.2.1
-versionCode=202112021
+version=v2021.12.6
+versionCode=202112060
author=VR25 @ xda-developers
description=fbind is a versatile mounting utility for folders, disk images, LUKS/LUKS2 encrypted volumes, regular partitions and more.
diff --git a/system/bin/fbind b/system/bin/fbind
index db6d8ce..61657be 100644
--- a/system/bin/fbind
+++ b/system/bin/fbind
@@ -29,7 +29,7 @@ apply_config() {
grep -q '^extsd_path ' $config || default_extsd
# storage paths fallbacks
- for i in $prefix /mnt/runtime/write /mnt/user/0; do
+ for i in $prefix /mnt/user/0 /mnt/runtime/write; do
is_mounted $i/emulated && prefix=$i && break || prefix=
done
[ -n "$prefix" ] && intsd=$prefix/emulated/0 || intsd=/data/media/0
@@ -44,6 +44,7 @@ apply_config() {
bind_mount() {
+ local i=
if ! is_mounted "$2"; then
if $interactiveMode; then
echo
@@ -52,26 +53,33 @@ bind_mount() {
wait_storage "$@" || return 1
fi
mkdir -p "$1" "$2"
- if which bindfs >/dev/null; then
- su -Mc bindfs -o nosuid,nodev,noexec,noatime,nonempty -u 0 -g 9997 -p a-rwx,ug+rw,ugo+X \
- --create-with-perms=a-rwx,ug+rw,ugo+X --xattr-none --chown-ignore \
- --chgrp-ignore --chmod-ignore \""$1"\" \""$2"\" || {
- echo "(i) Trying \"mount -o bind\"..."
- mount -o bind \""$1"\" \""$2"\"
- }
- else
- mount -o bind \""$1"\" \""$2"\"
- fi
+ for i in 1 2; do
+ if which bindfs >/dev/null; then
+ su -Mc bindfs -o nosuid,nodev,noexec,noatime,nonempty -u 0 -g 9997 -p a-rwx,ug+rw,ugo+X \
+ --create-with-perms=a-rwx,ug+rw,ugo+X --xattr-none --chown-ignore \
+ --chgrp-ignore --chmod-ignore \""$1"\" \""$2"\" || {
+ echo "(i) Trying \"mount -o bind\"..."
+ mount -o bind \""$1"\" \""$2"\"
+ }
+ else
+ mount -o bind \""$1"\" \""$2"\"
+ fi
+ if [ "$prefix" = /mnt/user/0 ] && is_mounted /mnt/runtime/write/emulated; then
+ set -- "$1" "$(echo "$2" | sed "s|$prefix|/mnt/user/0|")"
+ is_mounted "$2" && break
+ fi
+ done
if is_mounted "$2"; then
- [ -z "$3" ] && rm -rf "$1/Android" 2>/dev/null
+ [ -z "$3" ] && rm -rf "$1/Android"
else
- rmdir "$2" 2>/dev/null
- fi
+ rmdir "$2"
+ fi 2>/dev/null
fi
}
bind_mount_wrapper() {
+
$interactiveMode && echo "Bind-mounting..."
# $extobb <--> $obb
@@ -533,7 +541,7 @@ troubleshooting() {
unmount() {
local line=
- local pattern="$(echo "$1" | sed "s|$prefix||")"
+ local pattern="$(echo "$1" | sed -E "s#$prefix|/mnt/runtime/write|/mnt/user/0##")"
/system/bin/mount | grep "$pattern type " >/dev/null 2>&1 && {
echo "<...${pattern#/}>"
/system/bin/mount | grep "$pattern type " | sed -E -e 's|^.* on /|/|' -e "s|($pattern) type .*|\1|" | \
@@ -767,7 +775,7 @@ interactiveMode=true
dataDir=/data/adb/vr25/fbind-data
config=$dataDir/config.txt
: ${prefix:=$(sed -n 's/^prefix=//p' $config 2>/dev/null)}
-: ${prefix:=/mnt/runtime/write}
+: ${prefix:=/mnt/user/0}
intsd=$prefix/emulated/0
obb=$intsd/Android/obb
@@ -806,7 +814,7 @@ $service || apply_config # & handle LUKS/2
case $1 in
-a|--auto-mount) toggle_auto_mount;;
- -b|--bind-mount) bind_mount "$2" "$3" > /dev/null;;
+ -b|--bind-mount) bind_mount "$2" "$3";;
-c|--config) shift; edit $config "$@";;
-C|--cryptsetup) shift; cryptsetup "$@";;
-f|--fuse) force_fuse;;