[Galaxy S II Themes and Apps] Troubadour666:
toolpack and how to for 2nd ROM ONLY

hope it's the best how too i post for adapt mod and vrtheme for 2nd ROM use !

updater-script details :

ui_print("");
ui_print(" Mounting Filesystems... ");
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p12", "/preload");
ui_print("");
ui_print(" Clearing dalvik-cache... ");
delete_recursive("/data/dalvik-cache");
ui_print("");
ui_print(" Flashing new extra files before vrtheme them... ");
package_extract_dir("system/app", "/system/app");
package_extract_dir("data/sec_data", "/data/sec_data");
package_extract_file("vrtheme/symlink_data-data_sec_to_system_app", "/tmp/symlink_data-data_sec_to_system_app");
set_perm(0, 0, 0777, "/tmp/symlink_data-data_sec_to_system_app");
run_program("/tmp/symlink_data-data_sec_to_system_app");
set_perm_recursive(0, 0, 0755, 0644, "/data/sec_data");
ui_print("......extracting.vrtheme.to.sdcard.....");
package_extract_dir("vrtheme/data/app", "/sdcard/vrtheme/data/app");
package_extract_dir("vrtheme/data/sec_data", "/sdcard/vrtheme/data/sec_data");
package_extract_dir("vrtheme/system/app", "/sdcard/vrtheme/system/app");
package_extract_dir("vrtheme/system/framework", "/sdcard/vrtheme/system/framework");
ui_print("......extracting.files.to.work.....");
package_extract_file("vrtheme/installtheme.sh", "/sdcard/vrtheme/installtheme.sh");
package_extract_file("vrtheme/cleanup.sh", "/sdcard/vrtheme/cleanup.sh");
package_extract_file("vrtheme/zipalign", "/sdcard/vrtheme/zipalign");
package_extract_file("vrtheme/zip", "/sdcard/vrtheme/zip");
set_perm(0, 0, 0755, "/sdcard/vrtheme/installtheme.sh");
set_perm(0, 0, 0755, "/sdcard/vrtheme/cleanup.sh");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zipalign");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zip");
ui_print("..now.patching.with.installthem.sh....");
run_program("/sdcard/vrtheme/installtheme.sh");
ui_print(" Cleaning up... ");
run_program("/sdcard/vrtheme/cleanup.sh");
run_program("/sbin/umount", "/system");
run_program("/sbin/umount", "/data");
run_program("/sbin/umount", "/cache");
run_program("/sbin/umount", "/preload");

Installtheme.sh detail :

#!/sbin/sh
# Copyright VillainROM 2011. All Rights Reserved
# cleanup from last time
[ -d /sdcard/vrtheme-backup ] && rm -r /sdcard/vrtheme-backup

# we need to first go through each file in the "app" folder, and for each one present, apply the modified theme to the APK
# let us copy each original APK here first.
echo "Processing /system/app/"
busybox mkdir -p /sdcard/vrtheme-backup/system/app
busybox mkdir -p /sdcard/vrtheme/apply/system/app
cd /sdcard/vrtheme/system/app/
for f in $(ls)
do
echo "Processing $f"
cp /system/app/$f /sdcard/vrtheme/apply/system/app/
cp /system/app/$f /sdcard/vrtheme-backup/system/app/
done
echo "Backups done for system apps"

# repeat for /preload/symlink/system/app now

[ -d /sdcard/vrtheme/preload/symlink/system/app ] && preload=1 || preload=0
if [ "$preload" -eq "1" ]; then
echo "Processing /preload/symlink/system/app/"
busybox mkdir -p /sdcard/vrtheme-backup/preload/symlink/system/app
busybox mkdir -p /sdcard/vrtheme/apply/preload/symlink/system/app
cd /sdcard/vrtheme/preload/symlink/system/app/
for f in $(ls)
do
echo "Processing $f"
cp /preload/symlink/system/app/$f /sdcard/vrtheme/apply/preload/symlink/system/app/
cp /preload/symlink/system/app/$f /sdcard/vrtheme-backup/preload/symlink/system/app/
done
echo "Backups done for preload apps"
fi
# repeat for /system/framework now

[ -d /sdcard/vrtheme/system/framework ] && framework=1 || framework=0

if [ "$framework" -eq "1" ]; then
echo "Processing /system/framework"
busybox mkdir -p /sdcard/vrtheme-backup/system/framework
busybox mkdir -p /sdcard/vrtheme/apply/system/framework
cd /sdcard/vrtheme/system/framework
for f in $(ls)
do
echo "Processing $f"
cp /system/framework/$f /sdcard/vrtheme/apply/system/framework/
cp /system/framework/$f /sdcard/vrtheme-backup/system/framework/
done
echo "Backups done for frameworks"
fi

# repeat for /data/sec_data now

[ -d /sdcard/vrtheme/data/sec_data ] && datasecapps=1 || datasecapps=0

if [ "$datasecapps" -eq "1" ]; then
echo "Processing /data/sec_data/"
busybox mkdir -p /sdcard/vrtheme-backup/data/sec_data/
busybox mkdir -p /sdcard/vrtheme/apply/data/sec_data/
cd /sdcard/vrtheme/data/sec_data/
for f in $(ls)
do
echo "Processing $f"
cp /data/sec_data/$f /sdcard/vrtheme/apply/data/sec_data/
cp /data/sec_data/$f /sdcard/vrtheme-backup/data/sec_data/
done
echo "Backups done for data sec data"
fi

# repeat for /data/app now

[ -d /sdcard/vrtheme/data/app ] && dataapps=1 || dataapps=0

if [ "$dataapps" -eq "1" ]; then
echo "Processing /data/app/"
busybox mkdir -p /sdcard/vrtheme-backup/data/app/
busybox mkdir -p /sdcard/vrtheme/apply/data/app/
cd /sdcard/vrtheme/data/app/
for f in $(ls)
do
echo "Processing $f"
cp /data/app/$f /sdcard/vrtheme/apply/data/app/
cp /data/app/$f /sdcard/vrtheme-backup/data/app/
done
echo "Backups done for data app"
fi

# for each of the system apps needing processed
cd /sdcard/vrtheme/apply/system/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/system/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/system/app/$f *
done
echo "Patched system files"
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/preload/symlink/system/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/preload/symlink/system/app/$f *
done
echo "Patched preload files"
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/system/framework/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/system/framework/$f *
done
echo "Patched framework files"
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/data/sec_data/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/data/sec_data/$f *

done
echo "Patched sec data files"
fi

if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/
for f in $(ls)
do
echo "Working on $f"
cd /sdcard/vrtheme/data/app/$f/
/sdcard/vrtheme/zip -r /sdcard/vrtheme/apply/data/app/$f *

done
echo "Patched data app files"
fi

# and now time to zipalign
cd /sdcard/vrtheme/apply/system/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi
if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/
busybox mkdir aligned
for f in $(ls)
do
echo "Zipaligning $f"
/sdcard/vrtheme/zipalign -f 4 $f ./aligned/$f
done
fi

# time to now move each new app back to its original location
cd /sdcard/vrtheme/apply/system/app/aligned/
cp * /system/app/
chmod 644 /system/app/*
if [ "$preload" -eq "1" ]; then
cd /sdcard/vrtheme/apply/preload/symlink/system/app/aligned/
cp * /preload/symlink/system/app/
chmod 644 /preload/symlink/system/app/*
fi
if [ "$framework" -eq "1" ]; then
cd /sdcard/vrtheme/apply/system/framework/aligned/
cp * /system/framework/
chmod 644 /system/framework/*
fi
if [ "$datasecapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/sec_data/aligned/
cp * /data/sec_data/
chmod 644 /data/sec_data/*
fi
if [ "$dataapps" -eq "1" ]; then
cd /sdcard/vrtheme/apply/data/app/aligned/
cp * /data/app/
chmod 644 /data/app/*
fi

# Do not remove the credits from this, it's called being a douche
echo "VillainTheme is done"
# we are all done now

Cleanup.sh detail :

#!/sbin/sh

rm -rf /sdcard/vrtheme/

echo "Cleanup complete"