[Galaxy S II Themes and Apps] Troubadour666:
Hi All,

You all know my interest to port rom and mod cwm flasher we all find and test in both XDA Galaxy S II Android Developmentand AND Galaxy S II Themes and Apps threads for 2nd rom with Dorimanx kernel v8.xx embedded :)

so some dualbooters want to use some mods and themes they find and they cant because most (for not sayinf all) are script for 1rst rom usage.

I see a great mod that i can purpose here for your 2nd rom, depends what you have in your 2nd rom, see end of this unique post dedicated to [MENTION=5067299]Jeetu[/MENTION] NEATROM-AROMA GREAT MOD :)

So let's have a see about existensZ :)

Most MODS are based on VRTHEME script, which original is :

#!/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.
[COLOR="Navy"]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 system apps"

# 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/app now

[ -d /sdcard/vrtheme/data ] && 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 apps"
fi[/COLOR]

[COLOR="DarkGreen"]# for each of the system apps needing processed
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 system files"

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 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[/COLOR]

[COLOR="DarkRed"]# and now time to zipalign
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

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

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[/COLOR]

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

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

- in this script, there are 4 parts :

1 - making a backup of all original APKs to be modded by flasher (a simple cp command for each APK).

by order : preload/symlink/system/app, system/framework and data/app

2 - moding process with a zip command to merge vrtheme folder copyied before during updater-script execution in original APK (copyied before too) to need to be modded.

by order : preload/symlink/system/app, data/app and system/framework.

3 - zipalign process of the APKs freshly modded.

by order : preload/symlink/system/app, data/app and system/framework.

4 - copy of the news modded APKs in their original folder respectively.

by order : preload/symlink/system/app, data/app and system/framework.

To mod an APK, installtheme uses zip command to merge a folder copyied in sdcard during flash process, in it. ,Fortunaly and we know that, all APKs files are structured like ZIP files :) .

Its the updater-script that copy each structure APKs folder of all apks to be modded in the rom in the external SDCARD. In the past , i change these few lines in updater-script but now, it's not necessary with this NEW METHOD.

The only line we have to modify in the updater-script from a VRTHEME MOD ZIP file we want to see run in 2nd rom are the lines relative to the destination folder of the copy of real apks that have to been changed or added by DEV on you rom during its flash. As for a flash a modded ZIP ROM for 2nd rom, updater-script from MODs need to be modified to copy /preload/symlink/system/app from ZIP MOD to /data/sec_data/ folder of 2nd rom, that's all. Its the same if the MOD have an AROMA installer embedded (+ vrtheme folder, like last [MENTION=5067299]Jeetu[/MENTION] great mods).

So, according you have your good updater-script of your new mod for 2nd rom usage you want, you can replace installtheme.sh in ZIP MOD by those in attachment "new-installtheme_For2ndRomONLY.sh", and for all mod you will find in future and you want to use in your 2nd rom, use this.

the 3 images below show you what i have done :

To make this run in 2nd ROM, we have to make some little changes, exactly 4 lines in the installtheme.sh script, according we know how to mod updater-script in an another thread or as i explain in this post....but it's not the purpose here.

above, backup of apks to be modded, i correct 2 lines from original, copy (cp) each apk to be merged by zip command adding a folder in it, from /data/sec_data/ instead of /preload/symlink/system/app/ if we were in 1rst rom. 2nd rom uses /data/sec_data/ instead of /preload/ partition folder.

Above,no changes in these two processes in one image : zip command on each apk to be modded and zipalign process for each of them after.

Above again, just 2 lines touched, copy back the new zipalinged apks in original folder of rom, instead of /preload/symlink/system/app , we put them in /data/sec_data/ folder of 2nd rom.

in attachment, FOR TEST, find 3 files for the very great AROMA MOD for NeatROM from [MENTION=5067299]Jeetu[/MENTION].

if you havent NeatROM in 2nd rom you could find one shared here (thanks to [MENTION=4704050]nik60[/MENTION]), with kernel [MENTION=2376110]dorimanx[/MENTION] v8.xx runing here

Special thanks to [MENTION=3690986]_Sale_[/MENTION] for his great NEATROM.

Donwload "1-For2ndRomONLY-NEATROM_AROMA-updater-script.pdf", rename it "updater-script" and put it in \NEATROM_AROMA\META-INF\com\google\android\ folder of NEATROM-AROMA.ZIP from [MENTION=5067299]Jeetu[/MENTION], here.

Download "2-For2ndRomONLY-NEATROM_AROMA-installtheme.sh.pdf", rename it "installtheme.sh" and put it in \NEATROM_AROMA\vrtheme\ folder of NEATROM-AROMA.ZIP from Jeetu too.

Download "3-For2ndRomONLY-create_preload_symlinks.pdf" , rename it "create_preload_symlinks" and to put in \NEATROM_AROMA.zip\Jeetu\ folder of NEATROM-AROMA.ZIP from Jeetu too.

thanks.

test and report :)