Skip to content

Commit

Permalink
**v2021.11.11-beta (202111110)**
Browse files Browse the repository at this point in the history
- Experimental support for recent Android versions
- General fixes
- Major optimizations
  • Loading branch information
VR-25 committed Nov 11, 2021
1 parent 3a6bfa5 commit 0f418f0
Show file tree
Hide file tree
Showing 13 changed files with 487 additions and 250 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
** text eol=lf

# Denote all files that are truly binary and should not be modified.
system/** binary
*.zip binary
bin/** binary
Empty file modified .gitignore
100755 → 100644
Empty file.
Empty file modified License.md
100755 → 100644
Empty file.
Empty file modified META-INF/com/google/android/update-binary
100755 → 100644
Empty file.
Empty file modified META-INF/com/google/android/updater-script
100755 → 100644
Empty file.
303 changes: 303 additions & 0 deletions README.html

Large diffs are not rendered by default.

44 changes: 12 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fbind is a versatile mounting utility for folders, disk images, LUKS/LUKS2 encry
---
## LICENSE

Copyright 2017-present, VR25 @ xda-developers
Copyright (C) 2017-2021, VR25 @ xda-developers

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -51,7 +51,7 @@ By choosing to use/misuse it, you agree to do so at your own risk!
- [cryptsetup](https://forum.xda-developers.com/showpost.php?p=82561353&postcount=207/) (for encryption, optional)
- Terminal emulator (or adb shell) and/or text editor

Note: executables such as `cryptsetup` can be placed in `/data/adb/bin/` (with proper permissions) instead of being installed system-wide.
Note: executables such as `cryptsetup` can be placed in `/data/adb/vr25/bin/` (with proper permissions) instead of being installed system-wide.


---
Expand Down Expand Up @@ -180,9 +180,6 @@ Toggle FUSE usage for emulated storage (default: off).
-h|--help
List all commands.
-i|--info
Print debugging info.
-l|--log [editor] [option...]
Open service.log w/ [editor] [option...] (default: more|vim|vi|nano).
e.g., fbind -l
Expand Down Expand Up @@ -241,15 +238,15 @@ NEVER use Windows Notepad for that!
- If you stumble upon inaccessible folders or read-only access, try forcing FUSE (fbind -f) usage for emulated storage.
If your system does not support FUSE, it may get into a bootloop.
If that happens, fbind will revert the change automatically on the next boot attempt.
To revert it manually, either run `fbind -f` again or remove `/data/adb/modules/fbind/system.prop` to `FUSE.prop` and remove `/data/adb/vr25/fbind/.FUSE`.
To revert it manually, either run `fbind -f` again or remove `/data/adb/modules/fbind/system.prop` to `FUSE.prop` and remove `/data/adb/vr25/fbind-data/.FUSE`.

- Logs are stored at `/data/adb/vr25/fbind/logs/`.
- Logs are stored at `/data/adb/vr25/fbind-data/logs/`.

- [SDcardFS] Remounting /mnt/runtime/write/... may cause a system reboot.
When this happens, fbind learns to skip it.
However, if the system reboots for a reason other than this, fbind will mistakenly create `/data/adb/vr25/fbind/.noWriteRemount`.
However, if the system reboots for a reason other than this, fbind will mistakenly create `/data/adb/vr25/fbind-data/.noWriteRemount`.
If you stumble across broken bind mounts, remove that file and remount all folders.
To do that in one shot, run `rm /data/adb/vr25/fbind/.noWriteRemount; fbind -um`.
To do that in one shot, run `rm /data/adb/vr25/fbind-data/.noWriteRemount; fbind -um`.

- Rebooting is not required after installing/upgrading.
If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr25/fbind/fbind` executable until you reboot - e.g., `/dev/.vr25/fbind/fbind -m`.
Expand All @@ -272,17 +269,7 @@ If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr2
---
## LATEST CHANGES


**v2019.1.23 (201901230)**

- General optimizations
- More accurate SDcardFS and encrypted data detection
- New command: fbind --remount
- Note on SDcardFS: remounting /mnt/runtime/write/... may cause a system reboot. If this happens, fbind remembers to skip that next times. There's a catch, though! If your system reboots for a reason other than this, fbind will mistakenly add `noWriteRemount` to config. If you stumble across broken bind mounts, remove that line and remount all folders (fbind -um).


**v2020.8.5 (202008050)**

- Better compatibility with different root solutions and init methods
- Built upon fbind's framework and Hooin Kyoma's fixes
- Enhanced `mount` wrapper
Expand All @@ -293,29 +280,22 @@ If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr2
- Upgrader (fbind -U)
- Uninstaller (fbind -x)


**v2021.3.4 (202103040)**

- Better logs

- Cryptsetup is no longer bundled, but it's still supported.
Download link and very simple installation instructions are provided.

- Cryptsetup is no longer bundled, but it's still supported. Download link and very simple installation instructions are provided.
- Enhanced wizard.
- fbind --move shows progress.

- Fixed auto-mount
- Fixed unmount issues

- For now, Magisk is a strict requirement.

- Other major fixes & optimizations

- Rebooting is not required after installing/upgrading.
If`/sbin` is missing (many Android 11 based systems lack it), use the `/dev/.vr25/fbind/fbind` executable until you reboot - e.g., `/dev/.vr25/fbind/fbind -m`.

- Simplified down to the core to minimize overheard, compatibility and ease maintenance.

- The order of default text editors is now vim|vi|nano.

- Updated documentation

**v2021.11.11-beta (202111110)**
- Experimental support for recent Android versions
- General fixes
- Major optimizations
63 changes: 63 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,65 @@
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

bindfs approach
~# DIR=/mnt/media_rw/[UUID] # for Portable Storage
~# DIR=/mnt/expand/[UUID] # for Adoptable Storage
~# mkdir $DIR/WhatsApp
~# mv /sdcard/WhatsApp/* $DIR/WhatsApp/
~# bindfs -o 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 $DIR/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

mount sdcard manually
~# mount -t exfat -o nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0,uid=0,gid=9997,fmask=0117,dmask=0006 /dev/block/sda1 /mnt/runtime/write/emulated/0/WhatsApp
~# mv /data/media/0/WhatsApp/* /sdcard/WhatsApp/
~# mount -o bind /mnt/my_sdcard/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

sdcardfs approach
~# mkdir /mnt/expand/[UUID]/media/0/WhatsApp
~# 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
19 changes: 10 additions & 9 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
set_perm $MODPATH/system/bin/fbind 0 2000 0755
rm $MODPATH/TODO.txt $MODPATH/License.md

dataDir=/data/adb/vr25/fbind
dataDir=/data/adb/vr25/fbind-data
[ -d ${dataDir%-*} ] && [ ! -d $dataDir ] && mv ${dataDir%-*} $dataDir ###
mkdir -p $dataDir
unzip -o "$ZIPFILE" README.md -d $dataDir/ >&2

# Preserve FUSE state
if [ -f $dataDir/.FUSE ] || [ /data/adb/modules/fbind/system.prop ]; then
if [ -f $dataDir/.FUSE ] || [ -f /data/adb/modules/fbind/system.prop ]; then
mv $MODPATH/FUSE.prop $MODPATH/system.prop
fi

# Migrate old config and remove legacy fbind
[ -f $dataDir/config.txt ] || cp /data/adb/fbind*/config.txt $dataDir/ 2>/dev/null
rm -rf /data/adb/fbind* /data/adb/modules/fbind /sdcard/Download/fbind /sdcard/*fbind*.txt 2>/dev/null

# Print links and changelog
printf '\n\n'
sed -En "\|## LINKS|,\$p" $dataDir/README.md \
| grep -v '^---' | sed 's/^## //'
printf '\n\n'
rm -rf ${dataDir%-*} /data/adb/fbind* /sdcard/Download/fbind /sdcard/*fbind*.txt 2>/dev/null

# Make executable readily available
executable=$MODPATH/system/bin/fbind
tmpd=/dev/.vr25/fbind
mkdir -p $tmpd
ln -fs $executable $tmpd/
ln -fs $executable /sbin/ 2>/dev/null

# Print links and changelog
printf '\n\n'
sed -En "\|## LINKS|,\$p" $dataDir/README.md \
| grep -v '^---' | sed 's/^## //'
printf '\n\n'
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.3.4
versionCode=202103040
version=v2021.11.11-beta
versionCode=202111110
author=VR25 @ xda-developers
description=fbind is a versatile mounting utility for folders, disk images, LUKS/LUKS2 encrypted volumes, regular partitions and more.
Loading

0 comments on commit 0f418f0

Please sign in to comment.