[Android Software/Hacking General [Developers Only]] osm0sis:
ADBsync sdcard Backup v1.1 is up in the OP!

- Updated adbsync.exe to the latest from @Renate NST's thread, which fixes a few recently discovered issues (huge filelists and Linux socket files).

- Minor touch-ups to the batch script based on my ongoing learning with Android Image Kitchen.

396 downloads of v1.0, so I guess there are at least a few people out there having fun with backing up their entire sdcard. :)

sdcard Fix Permissions Script zip update is now uploaded in the OP as well!

- Switched from EDIFY to shell script to be more robust with directory checking, etc. so that I could..

- Add support for both CWM directories, TWRP, and MultiROM permissions, and..

- Potentially fix KitKat -> L sdcard migration compatibility.

Note: You will need to reflash your secondary ROMs in MultiROM to ensure their permissions are correct, but everything else with MultiROM should be fine.

2012 downloads of the previous version. :D

Comparison of the two versions as follows.. ;)

EDIFY version:

ui_print("");
ui_print("sdcard Fix Permissions Script");
ui_print("by osm0sis @ xda-developers");
show_progress(1.34, 0);

ui_print("");
ui_print("Mounting...");
run_program("/sbin/busybox", "mount", "/data");
set_progress(0.2);

ui_print("");
ui_print("Setting /data/media to media_rw and fixing...");
set_perm_recursive(1023, 1023, 0775, 0664, "/data/media");
set_perm(1023, 1023, 0770, "/data/media");
set_progress(0.8);

ui_print("");
ui_print("Setting /data/media/clockworkmod perms...");
set_perm_recursive(0, 0, 0775, 0777, "/data/media/clockworkmod");
set_progress(1.0);

ui_print("");
ui_print("Unmounting...");
unmount("/data");
set_progress(1.2);

ui_print("");
ui_print("Done!");
set_progress(1.34);

Shell version:

#!/sbin/sh
# sdcard Fix Permissions: Recovery Flashable Zip
# osm0sis @ xda-developers

OUTFD=/proc/self/fd/$2;
ui_print() {
echo -ne "ui_print $1\n" > $OUTFD;
echo -ne "ui_print\n" > $OUTFD;
}
set_perm() {
files=$(echo $* | awk '{ print substr($0, index($0,$4)) }');
for i in $files; do
chown $1.$2 $i; chown $1:$2 $i;
chmod $3 $i;
done;
}
set_perm_recursive() {
dirs=$(echo $* | awk '{ print substr($0, index($0,$5)) }');
for i in $dirs; do
chown -R $1.$2 $i; chown -R $1:$2 $i;
find "$i" -type d -exec chmod $3 {} +;
find "$i" -type f -exec chmod $4 {} +;
done;
}
show_progress() { echo "progress $1 $2" > $OUTFD; }
set_progress() { echo "set_progress $1" > $OUTFD; }
restore_con() { test -e /sbin/restorecon && restorecon -R $* || /system/bin/toolbox restorecon -R $*; }

ui_print " ";
ui_print "sdcard Fix Permissions Script";
ui_print "by osm0sis @ xda-developers";
show_progress 1.34 0;

ui_print " ";
ui_print "Mounting...";
busybox mount /data;
busybox mount /system;
set_progress 0.2;

ui_print " ";
ui_print "Setting /data/media to media_rw and fixing...";
set_perm_recursive 1023 1023 0775 0664 "/data/media";
set_perm 1023 1023 0770 "/data/media" "/data/media/0" "/data/media/obb";
restore_con /data/media/0;
set_progress 0.6;

if [ -d /data/media/clockworkmod -o -d /data/media/0/clockworkmod ]; then
ui_print " ";
ui_print "Setting CWM directory perms...";
set_perm_recursive 0 0 0777 0777 "/data/media/clockworkmod";
set_perm_recursive 0 0 0777 0666 "/data/media/0/clockworkmod";
fi;
set_progress 0.7;

if [ -d /data/media/0/TWRP ]; then
ui_print " ";
ui_print "Setting TWRP directory perms...";
set_perm_recursive 0 0 0777 0666 "/data/media/0/TWRP";
fi;
set_progress 0.8;

if [ -d /data/media/multirom -o -d /data/media/0/multirom ]; then
ui_print " ";
ui_print "Setting MultiROM directory perms...";
set_perm_recursive 0 0 0755 0755 "/data/media/multirom" "/data/media/0/multirom";
set_perm 0 0 0770 "/data/media/multirom" "/data/media/0/multirom";
set_perm 1023 1023 0777 "/data/media/multirom/roms" "/data/media/0/multirom/roms";
set_perm 1023 1023 0666 "/data/media/multirom/.nomedia" "/data/media/0/multirom/.nomedia";
set_perm 0 0 0750 "/data/media/multirom/trampoline" "/data/media/0/multirom/trampoline";
set_perm 0 0 0666 "/data/media/multirom/multirom.ini" "/data/media/0/multirom/multirom.ini";
set_perm 0 0 0644 "/data/media/multirom/adbd" "/data/media/0/multirom/adbd" \
"/data/media/multirom/mrom.fstab" "/data/media/0/multirom/mrom.fstab" \
"/data/media/multirom/ubuntu-init/local" "/data/media/0/multirom/ubuntu-init/local" \
"/data/media/multirom/ubuntu-touch-init/scripts/touch" "/data/media/0/multirom/ubuntu-touch-init/scripts/touch" \
"/data/media/multirom/ubuntu-touch-sysimage-init/scripts/touch" "/data/media/0/multirom/ubuntu-touch-sysimage-init/scripts/touch";
ui_print "Note: You will need to dirty flash your secondary ROMs to ensure their permissions are correct";
fi;
set_progress 1.1;

ui_print " ";
ui_print "Unmounting...";
umount /data;
umount /system;
set_progress 1.2;

ui_print " ";
ui_print "Done!";
set_progress 1.34;
exit 0;

Please remember to thank the first post of this thread if you find any of my tools/scripts useful, helpful or interesting! :good: