[Samsung Galaxy Nexus] osm0sis:
Copying it to my device to test it now, but if all goes well it wasn't too too difficult. I looked into the init.rc script reference again and found exactly what we needed. :)

Just added 2 commands before the "mount_all fstab.tuna" in init.tuna.rc:

chmod 750 /fscheck
exec /fscheck mkfstab

Which calls my script /fscheck then waits for fstab.tuna to be created:

#!/sbin/bb/busybox ash
# osm0sis @ xda-developers

bb=/sbin/bb/busybox;
cache=/dev/block/platform/*/*/by-name/cache;
data=/dev/block/platform/*/*/by-name/userdata;
system=/dev/block/platform/*/*/by-name/system;
device=tuna;

# check partition filesystem
getfs() { $bb blkid $1 | $bb cut -d\" -f4; }

case $1 in
mkfstab)
# copy in base if using included Minimal fstab - not required with AnyKernel2
if [ "$($bb grep Minimal /fstab.$device)" ]; then
# use base matching cache fstype to accomodate encryption users - no effect otherwise
fsbase=`getfs $cache`;
$bb cp -f /fstab-$fsbase.$device /fstab.$device;
fi;
# swap out entries for filesystems as detected
for i in $system $cache $data; do
fstype=`getfs $i`;
fsentry=`$bb grep $i /fstab-$fstype.$device`;
if [ "$fsentry" ]; then
$bb sed -i "s|^$i.*|$fsentry|" /fstab.$device;
fi;
done;
$bb rm -f /fstab-*;
;;
setprops)
# set filesystem type properties for external use - system mount (toolbox) required
setprop ro.fs.cache `getfs $cache`;
setprop ro.fs.data `getfs $data`;
setprop ro.fs.system `getfs $system`;
;;
esac;

Then this service at the bottom of init.tuna.rc writes the filesystem types as properties a little later in the boot:

service fsprops /fscheck setprops
class core
oneshot

For the less integral, DirtyV-specific stuff, I moved my ext4 fstab workarounds from after the "mount_all fstab.tuna" in init.tuna.rc to dvbootscript.sh (also a great example of how the fsprops can be used):

# workaround for hung boots with nodiratime+noatime or barrier=0+data=writeback
# which occur when used as ext4 mount options for userdata via the tuna fstab
$bb [ `getprop ro.fs.data` == "ext4" ] && $bb mount -o remount,nosuid,nodev,noatime,nodiratime,barrier=0 -t auto /data;

Tried to make my script as universal as possible, so people could more easily adapt it to other devices.. [MENTION=2838735]aosp[/MENTION] :good: :D

There's only one trick for working encryption, which is that cache must be formatted to the same filesystem as data so that the script knows which entry to swap in for the fallback decryption.

Edit: Not quite booting yet, but I must be close.. edits to continue as I work it out. :cowboy:

Edit2: Got it! The included busybox didn't have the sh applet, and some type of shell is required to run any scripts before /system gets mounted (set per the .sh header). :good:

Edit3: Can't set the props via script without /system being mounted (toolbox), trying to work around it by splitting it into commands before and after mount_all. Everything works except for that part (for now), which isn't really necessary, but would be really useful/cool to have. :cool:

Edit4: Switched to ash since all busybox builds seem to have it. Apparently init doesn't allow setprop from the console that early in the boot, but if I add a service with class main then it works perfectly. 100% working now. :highfive:

Edit 5: Some cleanup to make it all pretty and wait isn't required in init.tuna.rc since it doesn't proceed until the exec has completed. Make service class core to move it slightly earlier in the boot.

Edit 6: Lower the overhead by turning the check into a function. Final edit. Done! :victory:

Edit 7: Updated with Unified v2, now allowing mix-and-match partition fstypes! ;)

Edit 8: Make more flexible in AnyKernel2 situations, and fix all types of encryption.​

Requires busybox v1.22.1+ static binary with the volume_id patch for f2fs (added in v1.22.0) and FEATURE_BLKID_TYPE enabled. Stripped since smaller is better for boot times. Thanks [MENTION=2765426]styr[/MENTION] for providing a working binary!

GitHub commits:

https://github.com/bsmitty83/DirtyV_tuna/commit/a81183371f7fc95fd1724936107784ac49b77654

https://github.com/bsmitty83/DirtyV_tuna/commit/9a6d086a6a93401f72feaed32af05debca18893a

https://github.com/bsmitty83/DirtyV_tuna/commit/2b20dfaac40d275d9e53ef758087143ad35ab7e8

https://github.com/bsmitty83/DirtyV_tuna/commit/c1b776dfc3d0f360e432db67e5782c7cd2ad5796

https://github.com/bsmitty83/DirtyV_tuna/commit/2f2ab2e7c72c1e9f57caed6b6940009c5cf857c6

https://github.com/bsmitty83/DirtyV_tuna/commit/7427a9d66388b298026e733a7bcd8e78036d50b3

AnyKernel2-specific (additional) commits:

https://github.com/bsmitty83/DirtyV_tuna/commit/c578c6124bc5d9b769fc4b4126f4268acd4bf907

https://github.com/bsmitty83/DirtyV_tuna/commit/4beb0b0b18471ce815709058d5643aa15cb07a00

https://github.com/bsmitty83/DirtyV_tuna/commit/ebdc76117d8571a7b80e33e4a188fe78b121e7f1

https://github.com/bsmitty83/DirtyV_tuna/commit/4204718c0340cfa15b1bfde91a9b8aad7e859d43

And the ROM updater-script changes to give them Unified ext4/f2fs support:

http://xdaforums.com/showpost.php?p=53312320&postcount=10192