[Android General] 7awliet:
Instant Porting & Patching Scripts [RELEASE]!

I've created a small package for beginners to get started in porting ROMs themselves. My script saves you a ton of time and a whole lot of Internet bandwidth & usage.

First, here's Ajit's method (for most ROMs) that I discussed in post #994 and here's a quick recap of that:

Now here's what my provided S030 contains and its explanation (pay close attention)

:

Here's how my script ports this to CM 13 and its explanation

:

robocopy /s /xx "S030" "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com"
md REMOVED
move /y "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com\system\etc\permissions\android.hardware.camera.flash-autofocus.xml" "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com\system\etc\permissions\android.hardware.camera.autofocus-flash.xml"
move /y "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com\system\etc\permissions\android.hardware.camera.autofocus.xml" "REMOVED\android.hardware.camera.autofocus.xml"
move /y "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com\system\etc\permissions\android.hardware.touchscreen.multitouch.distinct.xml" "REMOVED\android.hardware.touchscreen.multitouch.distinct.xml"
move /y "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com\system\etc\permissions\android.hardware.touchscreen.multitouch.xml" "REMOVED\android.hardware.touchscreen.multitouch.xml"
@echo off
echo.
echo.
echo.
echo.
echo =======================================================
echo Done! Press any key to exit -- script by 7awliet @ xda
pause > nul
cls
exit

What the porting batch script (RUN_ME.bat) does

:

Line 1 recursively copies everything in the provided folder "S030" to your downloaded and extracted folder "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com". As the port folder is specifically named, this script will only work for "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com" unless you change all mentions of that to something else. /s flag copies subfolders. /xx flag excludes showing extra files and directories (present in destination but not source) in the window.

Line 2 creates a folder called "REMOVED".

Line 3 renames the file "android.hardware.camera.flash-autofocus.xml" to "android.hardware.camera.autofocus-flash.xml"

Line 4 - 6 move the files "android.hardware.camera.autofocus.xml", "android.hardware.touchscreen.multitouch.distinct.xml", and "android.hardware.touchscreen.multitouch.xml" to the folder called "REMOVED" that was created in line 2. This was justified in post #1128.

Line 7 turns off showing "echo" in commenting.

Line 8 - 11 are just blank lines as a spacer.

Line 12 is just a separator made up of =.

Line 13 is the complete message and my credit.

Line 14 stops all operations without displaying "pause".

Line 15 closes the window (for pre-Windows 7 machines)

Line 16 closes the window after the user pressing any button.

Line 17 is a End Of File (EOF) blank End Of Line (EOL).

Here's how my script patches this to CM 13 and its explanation

:

robocopy /s /xx "Patch\RR 5.6.8 cam & OTG fix by Wac Pereng (Files Used)" "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com"
@echo off
echo.
echo.
echo.
echo.
echo =======================================================
echo Done! Press any key to exit -- script by 7awliet @ xda
pause > nul
cls
exit

What the patching batch script (RUN_ME_PATCH.bat) does

:

Line 1 recursively copies everything in the provided folder "Patch\RR 5.6.8 cam & OTG fix by Wac Pereng (Files Used)" to your downloaded and extracted folder "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com". As the port folder is specifically named, this script will only work for "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com" unless you change all mentions of that to something else. /s flag copies subfolders. /xx flag excludes showing extra files and directories (present in destination but not source) in the window.

Line 2 - 12 are the exact same as lines 7 - 17 in the porting script above.

How to port with my simple method (screenshots are from an earlier version but still illustrate the point)

:

Download and extract the contents of "Port_A5000.zip" (attached) so that you have the folder "Port_A5000" just like the screenshot. Now move or copy your downloaded ROM "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com.zip" into the folder that you just extracted called "Port_A5000".

[IMG="Port_A5000"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/0/3/porta5000.png?key=mKIq5HyuaxnRb-BTX7Aebw&ts=1469504262[/IMG]

Open the folder "Port_A5000". Extract the ROM zip to a folder called "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com" as shown in step of the following screenshot. You can you 7-Zip or WinZip as well if you don't have WinRAR. Once the folder is created as shown by the arrow in the screenshot, you're now ready to port.

[IMG="Port_A5000 Extracted"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/1/6/porta5000extracted.png?key=7WI6tAD6OZ0waIq6BD5DHA&ts=1469504878[/IMG]

Simply double-click on the "RUN_ME.bat" (might need to right-click and 'Run as administrator' depending on your setup) as shown in step 2 of the screenshot above). Congratulations, you've just ported a ROM for Lenovo A5000 IN LESS THAN A SECOND and here's proof

[IMG="Porting in less than a second"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/4/3/rapidporting.PNG?key=Oh2Lce4e51ypabyib9qynw&ts=1469506130[/IMG]

If you want to apply the "RR5.6.8 CAMERA & OTG FIX by wac pereng.zip" patch to the ROM then double-click on the "RUN_ME_PATCH.bat" (might need to right-click and 'Run as administrator' depending on your setup) as shown in step 3 of the screenshot earlier). Congratulations, you've just patched a ROM for Lenovo A5000 IN LESS THAN A SECOND and here's proof

[IMG="Patching in less than a second"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/4/2/rapidpatching.png?key=9AGLLdX7vQSi72wEczRUjw&ts=1469506019[/IMG]

NOTE: This will only replace the boot.img in the ROM with the one from the patch as all other files from the patch have already been applied in the provided "S030". You can decide not to patch now and just use the flashable zip patch later in recovery if you prefer.

Now you have to zip the ROM you just ported. Open the folder "ResurrectionRemix-M-v5.7.1-20160714-mtkroms.com" and select everything inside it ([Ctrl]+[A]), right-click on it and move the mouse to [WinRAR]/[7-Zip]/[WinZip], then click [Add to archive...] as shown in step 1 of the following screenshot. If you don't have WinRAR, 7-Zip, nor WinZip, then you could alternatively try [Send to] > [Compressed (zipped) folder], though I have no idea if the end product will work.

[IMG="Zip with WinRAR"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/5/6/zipwithwinrar.png?key=Ofr2_EfzcyfcPqMaRIXA-A&ts=1469507432[/IMG]

A window will then pop-up. First, name the archive (or leave it as it is) as shown in step 2 of the following screenshot, select [ZIP] in step 3, then finally click [OK] (step 4). NOTE: Your ROM will start to zip and the finished product (see no. 5 in above screenshot) will be placed IN the folder that you selected all the files to zip with [WinRAR] or whatever program.

[IMG="WinRAR zipping"]http://dl-1.va.us.xda-developers.com/3/8/2/4/0/6/3/winrarzipping.PNG?key=rhwILY7Mhh2Z7PgSSCMigw&ts=1469508183[/IMG]

DONE.

REMEMBER: the build.prop is specific to this ROM so be careful about the files you replace if you use this script for porting other ROMs.

I hope this is useful to someone. Please don't plaster the thread now hahaha.

Finally, do not share any of this without linking this post and crediting the author. Thank You.

P.S.: Remove the .txt from the .md5 file. MD5 Checksum: 7daab7152a6143d2ddcf2b48ca145f80