Skip to content

Commit

Permalink
**v2021.11.14-beta (202111140)**
Browse files Browse the repository at this point in the history
- `bindfs` binaries (ARM, ARM64, X86 and X86_64) are included and prioritized over `mount -o bind`
- Fixed `umount` issues
- General enhancements
- Updated flashable zip generator
  • Loading branch information
VR-25 committed Nov 14, 2021
1 parent 4121902 commit 55e7959
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 57 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
_builds
_misc
_*
*.zip
8 changes: 8 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ <h2 id="notes">NOTES</h2>
<hr>
<h2 id="links">LINKS</h2>
<ul>
<li><a href="https://app.airtm.com/send-or-request/send">Airtm, username: ivandro863auzqg</a></li>
<li><a href="https://fb.me/vr25xda/">Facebook page</a></li>
<li><a href="https://github.com/vr-25/fbind/">Git repository</a></li>
<li><a href="https://liberapay.com/vr25/">Liberapay</a></li>
Expand Down Expand Up @@ -295,6 +296,13 @@ <h2 id="latest-changes">LATEST CHANGES</h2>
<li>Ability to specify the emulated storage path prefix to use (details in readme &gt; config syntax)</li>
<li>Android 11 testing kit in the flashable zip</li>
<li>General enhancements</li>
</ul>
<p><strong>v2021.11.14-beta (202111140)</strong></p>
<ul>
<li><code>bindfs</code> binaries (ARM, ARM64, X86 and X86_64) are included and prioritized over <code>mount -o bind</code></li>
<li>Fixed <code>umount</code> issues</li>
<li>General enhancements</li>
<li>Updated flashable zip generator</li>
</ul>

</body>
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr2
---
## LINKS

- [Airtm, username: ivandro863auzqg](https://app.airtm.com/send-or-request/send)
- [Facebook page](https://fb.me/vr25xda/)
- [Git repository](https://github.com/vr-25/fbind/)
- [Liberapay](https://liberapay.com/vr25/)
Expand Down Expand Up @@ -300,3 +301,9 @@ If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr2
- Ability to specify the emulated storage path prefix to use (details in readme > config syntax)
- Android 11 testing kit in the flashable zip
- General enhancements

**v2021.11.14-beta (202111140)**
- `bindfs` binaries (ARM, ARM64, X86 and X86_64) are included and prioritized over `mount -o bind`
- Fixed `umount` issues
- General enhancements
- Updated flashable zip generator
45 changes: 1 addition & 44 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Daemon to remount folders periodically
Daemon to remount folders periodically?
Android 11 storage isolation support

~# bindfs -u $(stat -c %u /sdcard/Android/data/com.termux) -g 9997 -p a-rwx,ug+rw,ug+X /mnt/media_rw/[UUID]/Android/data/com.termux /mnt/runtime/write/emulated/0/Android/data/com.termux
Expand All @@ -20,46 +20,3 @@ sdcardfs approach
~# mv /sdcard/WhatsApp/* /mnt/expand/[UUID]/media/0/WhatsApp/
~# restorecon -rv /mnt/expand/[UUID]/media/
~# mount -t sdcardfs -o nosuid,nodev,noexec,noatime,mask=7,gid=9997 /mnt/expand/[UUID]/media/0/WhatsApp /mnt/runtime/write/emulated/0/Whatsapp


#!/data/data/com.termux/files/usr/bin/bash -e

# must be run with root privileges
[ $(id -u) -eq 0 ] || exec su --mount-master -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH HOME=$HOME PATH=$PATH:$HOME/bin $0"

# make sure to be in root mount namespace
[ $(readlink /proc/1/ns/mnt) = $(readlink /proc/self/ns/mnt) ] || nsenter -t 1 -m -- "$0"

Unmount() {
fusermount -u /mnt/runtime/write/emulated/0/GDrive 2>/dev/null || :
}

# make sure it's not already mounted
Unmount

# make sure it's unmounted after rclone is killed
trap 'sleep 1; Unmount' EXIT

# mount remote in /sdcard/
rclone -v mount GDrive: /mnt/runtime/write/emulated/0/GDrive --gid 9997 --dir-perms 0771 --file-perms 0660 --umask=0 --allow-other







for i in /mnt/runtime/*/emulated/0/testdir; do umount $i; done 2>/dev/null; rm -rf /mnt/media_rw/72CA-0EF5/testdir /sdcard/testdir 2>/dev/null; mkdir -p /mnt/media_rw/72CA-0EF5/testdir /sdcard/testdir; touch /mnt/media_rw/72CA-0EF5/testdir/testfile; su -Mc /data/bindfs -o nonempty,nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0 -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 /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/write/emulated/0/testdir; ls /sdcard/testdir/testfile

su -Mc /data/bindfs -o nonempty,nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0 -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 /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/default/emulated/0/testdir; su -Mc /data/bindfs -o nonempty,nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0 -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 /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/read/emulated/0/testdir


for i in /mnt/runtime/*/emulated/0/testdir; do umount $i; done 2>/dev/null; rm -rf /mnt/media_rw/72CA-0EF5/testdir /sdcard/testdir 2>/dev/null; mkdir -p /mnt/media_rw/72CA-0EF5/testdir /sdcard/testdir; touch /mnt/media_rw/72CA-0EF5/testdir/testfile; su -Mc /system/bin/mount -t sdcardfs -o rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/write/emulated/0/testdir; ls /sdcard/testdir/testfile

su -Mc /system/bin/mount -t sdcardfs -o rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/default/emulated/0/testdir; su -Mc /system/bin/mount -t sdcardfs -o rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid /mnt/media_rw/72CA-0EF5/testdir /mnt/runtime/read/emulated/0/testdir


#!/system/bin/sh
while [ ! -b /dev/block/mmcblk1p1 ]; do sleep 2; done
mkdir -p mnt/extsd
su -Mc /system/bin/mount -t vfat -o nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0,uid=0,gid=9997,fmask=0117,dmask=0006 /dev/block/mmcblk1p1 /mnt/extsd
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added bin/bindfs-v1.14.1/bindfs-arm64-v8a
Binary file not shown.
Binary file added bin/bindfs-v1.14.1/bindfs-armeabi-v7a
Binary file not shown.
Binary file added bin/bindfs-v1.14.1/bindfs-x86
Binary file not shown.
Binary file added bin/bindfs-v1.14.1/bindfs-x86_64
Binary file not shown.
29 changes: 26 additions & 3 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
set_perm $MODPATH/system/bin/fbind 0 2000 0755
rm $MODPATH/TODO.txt $MODPATH/License.md

dataDir=/data/adb/vr25/fbind-data
[ -d ${dataDir%-*} ] && [ ! -d $dataDir ] && mv ${dataDir%-*} $dataDir ###
mkdir -p $dataDir
Expand All @@ -22,6 +19,32 @@ mkdir -p $tmpd
ln -fs $executable $tmpd/
ln -fs $executable /sbin/ 2>/dev/null

# Install bindfs binary
oPWD="$PWD"
cd $MODPATH/bin/bindfs-* && {
case $ARCH in
arm) mv bindfs-armeabi-v7a ../bindfs;;
arm64) mv bindfs-arm64-v8a ../bindfs;;
x86) mv bindfs-x86 ../bindfs;;
x64) mv bindfs-x86_64 ../bindfs;;
esac
chmod +x ../bindfs
rm -rf $MODPATH/bin/bindfs-*
# workaround for bindfs < 1.14.2
for i in /system/etc/group /system/etc/passwd; do
[ -f $i ] || {
mkdir -p $MODPATH${i%/*}
touch $MODPATH$i
}
done
}

cd $MODPATH
rm -rf TODO.txt License.md README.html "android 11 test" zip.sh
cd "$oPWD"

set_perm $MODPATH/system/bin/fbind 0 2000 0755

# Print links and changelog
printf '\n\n'
sed -En "\|## LINKS|,\$p" $dataDir/README.md \
Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=vr25.fbind
name=fbind
version=v2021.11.13-beta
versionCode=202111130
version=v2021.11.14-beta
versionCode=202111140
author=VR25 @ xda-developers
description=fbind is a versatile mounting utility for folders, disk images, LUKS/LUKS2 encrypted volumes, regular partitions and more.
25 changes: 20 additions & 5 deletions system/bin/fbind
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ bind_mount() {
wait_storage "$@" || return 1
fi
mkdir -p "$1" "$2"
mount -o bind \""$1"\" \""$2"\"
if [ -x $modDir/bin/bindfs ]; then
su -Mc $modDir/bin/bindfs -o nosuid,nodev,noexec,noatime -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 is_mounted "$2"; then
[ -z "$3" ] && rm -rf "$1/Android" 2>/dev/null
else
Expand Down Expand Up @@ -117,7 +126,7 @@ default_extsd() {
! is_mounted $extsd && exit 1 || {
extsd=$prefix/${extsd##*/}
extobb=$extsd/Android/obb
mount -o remount,mask=0 $extsd 2>/dev/null
mount -o remount,mask=0 $extsd 2>/dev/null ###
}
}

Expand Down Expand Up @@ -483,9 +492,9 @@ troubleshooting() {
unmount() {
local line=
local pattern="$(echo "$1" | sed -e "s|$prefix||" -e "s|$intsd||")"
grep -q "$pattern " /proc/mounts && {
/system/bin/mount | grep "$pattern type " >/dev/null 2>&1 && {
echo "<${pattern#/}>"
tac /proc/mounts | grep "$pattern " | awk '{print $2}' | \
/system/bin/mount | grep "$pattern type " | tac | sed -E -e 's|^.* on /|/|' -e "s|($pattern) type .*|\1|" | \
while IFS= read line; do
umount -f "$line" 2>/dev/null
done
Expand Down Expand Up @@ -672,6 +681,13 @@ e) Exit wizard

# Prepare environment

modDir=/data/adb/modules/vr25.fbind
[ -f $modDir/update ] && {
modDir=${modDir%/*}_update/vr25.fbind
exec=$modDir/system/bin/fbind
[ $0 = $exec ] || exec $exec "$@"
}

echo

if : > /dev/.root_test 2>/dev/null; then
Expand Down Expand Up @@ -704,7 +720,6 @@ config=$dataDir/config.txt
: ${prefix:=/mnt/runtime/write}
intsd=$prefix/emulated/0
obb=$intsd/Android/obb
modDir=/data/adb/modules/vr25.fbind

case "$1" in
-s|--service) service=true;;
Expand Down
2 changes: 1 addition & 1 deletion zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ sh -n system/bin/fbind && {
filename=fbind-$(date +%Y.%m.%d.%H.%M.%S).zip
echo $filename
mkdir -p _builds
zip -r9 _builds/$filename * .git* -x \*.zip -x .git/\* -x _misc/\*
zip -r9 _builds/$filename * .git* -x \*.zip -x .git/\* -x '_*/*'
}

0 comments on commit 55e7959

Please sign in to comment.