[Android Software Development] enkidu70:
[SCRIPT][ROOT] Flashable foldermount.sh v1.3 (13.02.2016)

Hi all,

currently FM does not work on MM. I do not know why... But shell command "mount -o bind" still works as expected (see also note below!). So I have written a small script that will do the job!

foldermount.sh v1.3

:laugh:

Changelog

## 14.01.2016 v1.0 Initial version
## 15.01.2016 v1.1 + added possibility to process only one entry
## + added possibility to disable an entry
## o misc. fixes and improvements
## 29.01.2016 v1.2 o fixed messed up revisioning... :)
## 13.02.2016 v1.3 + added option 'movemount' to previously move files of non
## empty dirs to /sdcard/Foldermount/NonEmptyBackup
## + archiv is now flashable with TWRP or compatibe recovery!

Note: this does NOT solve external sd issue! Therefore please refer to e.g. http://www.xda-developers.com/fix-external-storage-handling-with-xposed-module/

It will read FMs database and mount all defined folder pairs. This means, you can use FM app to define your mount point and this script to activate it. :cowboy:

Easy install due to flashable archive! :D Therefore it is designed for experienced users only!!!

Disclaimer:

As usual, you use it on your own risk and I am not responsible for any damage that may happen to your device! :D

Make a Nandroid backup of your system before you flash/execute this script!!!

Prerequisit:

FolderMount :cool:

TWRP recovery or similar

Chainfire's SuperSU or at least a rom that supports /etc/init.d

I strongly recommend using Chainfire's SuperSU!!!

Installation:

Download foldermount.sh

Flash it with TWRP-recovery or compatible

Carefully read flashing output if all went ok! :)

Reboot, wait ~2min and check for the files

- /data/local/log/userinit.log

- /sdcard/FolderMount/foldermount.log

and their content.

Check if you mounts are done! :D

Usage:

If everything went fine until here, you might not read further. But if you are really an experienced user you might know how it works!? :confused: :laugh:

So here we go!

Open a root shell and try

# /data/locale/bin/foldermount.sh # without any option will show

Usage: foldermount.sh [ mount | movemount | unmount | export | show ] [ <name> ]

mount

Will mount all folder pairs you have defined in FolderMount app.

movemount

Same as mount but will move accidentally placed files in source dirs ro /sdcard/FolderMount/NonEmptyBackup so that you can access them.

unmount or umount

Will unmount all folder pairs you have defined in FolderMount app.

export

Will just print definitions as they are stored in FolderMount's database. You may copy them from there...

show

Will print more details about your definitions and do some error checks. It is thought for troubleshooting.

Adding name argument to one of the options above will just process this entry.

Name is the name in FolderMount app you have given the folder pair.

Important note: all output, except really hard errors preventing foldermount.sh from running will be written to /sdcard/FolderMount/foldermount.log !!!

Disabling an entry

You can disable an entry by adding a leading '#' to its name in FolderMount app.

How does it work?

In addition to foldermount.sh, my userinit.sh-environment will be installed. It consists of

/data/local/userinit.sh

/data/local/etc/userinit.conf

/system/su.d/90userinit -> /data/local/userinit.sh

- or -

/system/etc/init.d/90userinit -> /data/local/userinit.sh

For customizing foldermount.sh, edit userinit.conf!

Many roms (like Cyanogen) support /system/etc/init.d. All scripts in this directory will be executed at boot time. But also many do not support it. So best practice is to use Chainfire's SuperSU! Because it will execute all scripts present in /system/su.d! :D

Or you may use an app like Script Manager to auto execute /local/data/userinit.sh. But I really really really recommend using SuperSU!! :highfive:

Feel free to ask, if you have any questions.

Have fun,

Enkidu