[Galaxy S 4 i9505 Android Development] hawkerpaul:
HawkerCore

FINAL Version: 1.28 (25/03/2015)

HawkerCoreV???.zip installs /sdcard/HawkerCore/Scripts/HawkerCore.sh along with all of the above mentioned preset script zip files.

This is the central core of all my scripts. If you update the central core, this will have an affect on all of the preset zips that use it.

Installation

1. Copy the latest version of HawkerCore.zip onto your

2. Reboot into Recovery

3. Install zip from SD card>Run HawkerCoreV???.zip

You do not need to flash the core each time prior to running any of the preset zips.

After the initial installation, the only time you will need to re-flash HawkerCore is if you have fully wiped your internal storage (/sdcard), or if you have downloaded a full core update.

Core Tasks

These core tasks are contained in HawkerCore.sh, and combine to form the the preset zips (ROMNuke, ROMReset etc.)

Any of these core tasks can be called directly by a zip file updater-script if required.

Eg. run_program("/sdcard/HawkerCore/Scripts/HawkerCore.sh","CT_DataWipe")

CT_ADWipe

CT_AlbumArtWipe

CT_BloatWipe

CT_CacheWipe

CT_DalvikWipe

CT_DataWipe

CT_DelTemp

CT_EFSBackup

CT_EFSRestore

CT_FixPerm

CT_KernelWipe

CT_MediaWipe

CT_MyBackup

CT_MyRestore

CT_SystemWipe

​

Files/Folders Created/Used

Folders

The following folders are created to hold options, logs and backups:

/sdcard/HawkerCore/Scripts (holds the core HawkerCore.sh)

/sdcard/HawkerCore/Jobs User-defined jobs

/sdcard/HawkerCore/Options

/sdcard/HawkerCore/Logs

/sdcard/HawkerCore/Backups or /external_sd/HawkerCore/Backups, depending on the specified backup location.

Files

1. /sdcard/HawkerCore/Scripts/HawkerCore.sh. This is the Core script.

2. /sdcard/HawkerCore/Options/HawkerCore.prop. Options file for all my scripts.

3. /sdcard/HawkerCore/Options/MyADDelete.txt Extra files/folders to delete in the CT_ADWipe operation (see Extra user-defined files/folders for removal above)

4. /sdcard/HawkerCore/Options/MyKeepFiles.txt. List of files that you want to keep that would otherwise get removed by the following preset zips:

ROMNuke

ROMReset/SDClean

(see My Files/Folders to Keep) Whether or not the backup/restore is performed is dependant on the if the operation is performing a full wipe (SDCARD_FULL_WIPE=1) See Summary of Options File below for more details.

5. /sdcard/HawkerCore/Options/BloatWipe.txt The default bloatware removal list of files/folders that are removed by a CT_BloatWipe operation. You must manually create and maintain this list of files.

6. /sdcard/HawkerCore/Logs/[script-name].log Shows activity log of what the corresponding script has done. This gets overwritten the next time you run the script.

File/Folder Paths Format

The files above hold paths to files/folders to keep/delete etc. These must contain the full path to the file/folder, one file per line, with forward "/" NOT backward "" slashes. Use either the standard text editor on your handset to amend these files, or if you want to edit via your PC then use NotePad++ and ensure you EOL setting is for UNIX
​

The Options File

/sdcard/HawkerCore/Options/HawkerCore.prop

This options file controls the way all my scripts are run. Currently the following options are allowed:

BKP_LOCATION (default="ext")

Set to int/ext for internal SD Card/external SD Card

BKP_LOCATION=int (backs up to INTERNAL SD Card, ie. /sdcard/HawkerCore/Backups)

BKP_LOCATION=ext (backs up to EXTERNAL SD Card, ie. /external_sd/HawkerCore/Backups)

NOTE: If no external SD card is detected, any backups will be attempted to the internal SD card instead.

See the Changing the backup location section below for more details.

EFS_BKP (default=1)

Set if a backup of efs partition is required (EFS_BKP) automatically

when performing the more severe operations (ROMNuke, ROMReset and SDClean)

To perform in isolation (ignoring setting) use EFSBackup

EFS_BKP=1 to perform automatic backup to BKP_LOCATION/HawkerCore/Backups/efs,

EFS_BKP=0 for no automatic backup

SDCARD_FULL_WIPE (default=0)

Set if a FULL WIPE of the internal SD Card is required in the CT_DataWipe operation.

SDCARD_FULL_WIPE=1 performs a full wipe of internal SD Card (/sdcard). When this is set, any files defined in /sdcard/HawkerCore/Options/MyKeepFiles.txt will get backed up first and subsequently restored after the full wipe.

Note: Where SDCARD_FULL_WIPE=1, you may end up with a sub-directory called "0" on your internal SD card after this operation has completed, which contains the contents of your original internal sd card before the wipe (with the original internal sd card being wiped). I'm not sure as yet as to why this could happen, but this backup could prove to be handy to you. If you do not require this, you should manually delete any previous contents from the "0" sub-directory.

SDCARD_FULL_WIPE=0 keeps the internal SD Card contents (/sdcard, ie. /data/media/0)

See the CT_DataWipe post for more details.

Changing the Backup Location

By default, backups are made to the external SD (if one is found) in /external_sd/HawkerCore/Backups. You can change the backup location to the internal SD card if required. This can be done by editing /sdcard/HawkerCore/Options/HawkerCore.prop. Within this file there is a line that tells the script where the backups are to be stored. Edit the following line as required:

BKP_LOCATION=int (backs up to INTERNAL SD Card, ie. /sdcard/HawkerCore/Backups)

BKP_LOCATION=ext (backs up to EXTERNAL SD Card, ie. /external_sd/HawkerCore/Backups)

Please note, that if you change the location between int/ext in HawkerCore.prop, your backups will not get automatically moved to the new location. You would have to manually move the current backup over to the new location if you do not want to potentially have two copies of the backups.
​

User-Defined Jobs

You can create your own jobs that call any of the above Core Tasks.

You must create a flashable zip for your job, and an associated job task list.

You can use the bundled /sdcard/HawkerCore/Scripts/MyJob.zip as your template.

Job task lists are stored in /sdcard/HawkerCore/Jobs

For example, suppose we want to create a job called ResetMedia that performs the following tasks:

CT_AlbumArtWipe

CT_DelTemp

CT_MediaWipe

CT_CacheWipe

CT_DalvikWipe

1. In /sdcard/HawkerCore/Jobs create a file called ResetMedia and insert the above tasks, one task per line. If you want to create this file on your PC, use NotePad++.

2. Save and exit, and if edited on your PC, copy the job file into /sdcard/HawkerCore/Jobs.

3. In /sdcard/HawkerCore/Scripts, copy MyJob.zip to ResetMedia.zip

4. Open ResetMedia.zip in 7Zip and navigate to the META-INF/com/google/android/updater-script

5. Copy the updater-script file to your desktop and open in NotePad++

6. Change all references to MyJob to ResetMedia

7. Save updater-script

8. Drag the amended updater-script back into ResetMedia.zip

9. Close ResetMedia.zip (will automatically save) and copy it to /sdcard/HawkerCore/Scripts

10. Reboot into recovery and run ResetMedia.zip as normal

Note: Any user-defined jobs you create must be named differently to any of the preset zips or core tasks.
​

Calling HawkerCore.sh

HawkerCore.sh can be called with any of the preset zips or core task identifiers as its parameter, either in Test Mode, or in the updater-script of a flashable .zip.

eg. run_program("/sdcard/HawkerCore/Scripts/HawkerCore.sh","ROMNuke")

run_program("/sdcard/HawkerCore/Scripts/HawkerCore.sh","CT_DataWipe")

Calling User-Defined Jobs:

[parameter] with a matching /sdcard/HawkerCore/Jobs/[parameter] job file. For example:

run_program("/sdcard/HawkerCore/Scripts/HawkerCore.sh","MyWipe")

(See User-Defined Jobs above for details)

Note: Any user-defined jobs you create must be named differently to any of the preset zips or core tasks.

Test Mode

You can call /sdcard/HawkerCore/Scripts/HawkerCore.sh through a script manager type of app, through a terminal emulator, or adb shell. You just need to supply it with any of the valid preset zip/user-defined job file names or core task.

Test Mode goes through all the motions as per a standard Recovery run, but it does not remove any files/folders in any way, and merely shows the commands it would have done. The exceptions to this being the MyBackup preset zip, and the CT_DelTemp, CT_EFSBackup, and CT_MyBackup core tasks, where you will be given the opportunity to perform a genuine run if the Test Mode prompt is declined.
​

Changelog

Work in Progress (V1.29)

Identify more areas for wiping

V1.28 (FINAL) (25/03/2015)

1. Deeper detection of apk-related files for removal

2. Include extra partitions in the CT_EFSBACKUP and CT_EFSRESTORE core tasks

3. /sdcard/HawkerCore/Options/MyKeepFiles.txt was being reset on each run

4. Clear Cyanogenmod Eleven music player areas in CT_MediaWipe

5. Android and data folders are now always wiped on internal and external SD Cards in the CT_ADWipe operation, regardless of the SDCARD_FULL_WIPE setting (previously these folders would only get wiped when SDCARD_FULL_WIPE=1)

6. Clean Hulk Kernel in CT-KernelWipe Core Task

7. Clean Hybridmax Kernel in CT-KernelWipe Core Task

V1.27 (07/01/2015)

1. Deeper device id detection. Should now pick up S4 devices on S5-emulating ROMs

2. Clean Imperium Kernel in CT-KernelWipe Core Task

3. Suppress SKIPPED display for "." and ".." folders when wiping

V1.26 (07/10/2014)

1. Compatibility with latest Philz Recovery

2. Wipe AEL kernel in CT_KernelWipe core task

3. Display tweaks

V1.25 (15/08/2014)

1. Internal SD card contents were being stored in a "0" subfolder by a ROMNuke operation

2. Improved application removal function

3 /cache/dalvik-cache included in CT_DalvikWipe

4. Display tweaks

V1.24 (08/08/2014)

1. Find files method improved

2. Display tweaks

V1.23 (07/08/2014)

1. Improve detection of internal and external sd cards

2. Extended searches to remove .write_test file/folder

3. All kernel modules are now removed from /system/lib/modules in CT_KernelWipe

V1.22 (29/07/2014)

1. Resolved issues on GS2 when using later versions of CWM. This has meant a larger core zip (approx 10Mb) as busybox has had to be bundled in with the individual zips again. The problem seemed to be that later CWM versions are unable to execute programs directly off the internal SD card, and must be copied to an alternative temporary location (ie. /tmp) and run from there. Core-shell-only updates (HawkerCore.sh) will become available in subsequent versions if you don't want to download the suite of zips again. My thanks to [MENTION=3491649]Ganjax[/MENTION] again for his testing.

V1.21 (27/07/2014)

1. Streamlined zips. Busybox now gets installed into /sdcard/HawkerCore instead of having to bundle busybox in each of the zips separately. This has reduced the size of the core zip by 10Mb.

2. Remount of /system in script, as later versions of PhilZ seem not be able to mount initially.

3. Further attempts to resolve GS2 issues regarding internal/external sd card access. Many thanks to [MENTION=3491649]Ganjax[/MENTION] for his help and patience in testing for me for this. The conclusion so far is that for GS2 users, the scripts can only be run on TWRP, or on a version older than CWM 6.0.4.7.

V1.20 (26/07/2014)

1. Attempt to resolve GS2 issues regarding internal/external sd card access

2. Display tweaks

V1.19 (20/07/2014)

NOTE: I am simplifying the options file. This has lead to the removal of certain options, but the functionality is still present, and are all controlled by the setting of SDCARD_FULL_WIPE. This update will therefore reset the /sdcard/HawkerCore/Options/HawkerCore.prop options file back to default settings.

1. Attempt to resolve GS2 issues regarding internal/external sd card access. As i'm working blind on the S2, I've had to make guesses as to what the issue is here, but hopefully this version will resolve it. I recommend S2 users manually remove any folder called HawkerCore on both internal and external sd cards before flashing V1.19

2. CT_ADWipe always wipes nonessential areas of both internal and external SD cards, but now, /Android and /data within these cards are now only wiped depending on if SDCARD_FULL_WIPE=1 (default=0)

3. When MyBackup/MyRestore is called as part of a factory reset job, the backup/restore procedure only occurs when SDCARD_FULL_WIPE=1. This has lead to the PROCESS_KEEP_FILES option to be scrapped.

4. ANDROID_DATA_BKP scrapped. Now a backup of /sdcard/Android and /sdcard/data will always be attempted before being removed in a full wipe operation.

V1.18 (18/07/2014)

1. Issue sync commands prior to unmounting filesystems

2. Common filesystems were not being unmounted on exit

3. Display tweaks

4. Routine that returns getprop values made more robust

V1.16 (superseded by V1.17) (17/07/2014)

1. If the user has specified BKP_LOCATION=int in /sdcard/HawkerCore/Options/HawkerCore.prop the script no longer attempts to see if an external sd card is present. It is assumed the user has specifically set this value because the device has no external SD card fitted.

2. For GS2 only, /sdcard for some reason is mounted to external sdcard, so unmount it and re-mount to internal sd.

V1.15 (13/07/2014)

NOTE: This build has incorporated multiple-device integration. The GS4 and GS2 are currently supported. Because of this, all the preset zips have been renamed (no GS4 prefix) and the default installation location for scripts and backups etc. has changed from GS4HawkerCore to folders called HawkerCore on the root of your internal and external SD cards. This will reset the properties file (which has been renamed to HawkerCore.prop) so if you have any non-default options set in here, then you will have to re-edit HawkerCore.prop after this version is installed.

The old GS4Hawker folders will no longer be used on this, and subsequent builds, so if you no longer need the files/folders contained within HawkerCore folders, you can remove this folder manually from both internal and external SD cards or run GS4HawkerCoreDel.zip (NOT HawkerCoreDel.zip)

1. Multi-device integration. Currently this allows for GS4 and GS2.

2. HawkerCore.zip now contains the core, plus all the preset zips, which all get installed into /sdcard/HawkerCore/Scripts.

3. CT_DataWipe operation improved and speeded up.

4. STweaks and EXTweaks apps are now always removed in the CT_KernelWipe operation, and not just the dalvik-cache areas. If the kernel that is about to be flashed uses either app, then it will be bundled in the zip anyway.

5. CT_MyBackup and CT_MyRestore are now only performed automatically in ROMNuke and ROMReset/SDClean

V1.14 (11/06/2014)

1. CT_MyBackup now performed in AlbumArtWipe, BloatWipe and MediaWipe

2. CT_MyRestore no longer performed in CT_KernelWipe

3. Obtaining build.prop details made more robust.

4. Include Googy-Max3 Kernel in CT_KernelWipe

5. Filesystems mounted by name, and not by specific device.

V1.13 (05/06/2014)

1. Allow for jflte and jfltexx product id recognition (for CM ROMS)

2. Find files speeded up in CT_AlbumArtWipe and CT_DelTemp core tasks.

3. CT_DelTemp now searches for and removes any .write_test file/folder found. The presence of these folders seem to restrict write access to external sd card for certain apps (Eg. Titanium Backup)

V1.12 (06/05/2014)

1. com.android.providers.media no longer removed in CT_MediaWipe as this includes album art. This area will now get removed only in the CT_AlbumArtWipe core task.

2. New parameter in /sdcard/HawkerCore/Options/HawkerCore.prop PROCESS_KEEP_FILES. Default 1. When set, this will process the files/folders you have configured into /sdcard/HawkerCore/Options/MyKeepFiles.txt within the KernelWipe, ROMNuke and ROMReset/SDClean preset zips. Setting this to 1 will backup the user-defined files at the start of the script, restoring them back at the end. Set to 0 will skip this backup/restore. Skipping is handy if you want to completely wipe the affected areas.

3. Include Adam Kernel in CT_KernelWipe

4. CT_KernelWipe now wipes /data/log/*

5. Added MyRestore preset zip

6. Added CT_MyRestore core task

V1.11 (11/04/2014)

1. Removed beta tag from build

2. Identified more areas to wipe in the CT_AlbumArtWipe operation

3. Core was not calling CT_MyBackup as a direct passed parameter

4. CT_MyBackup called in KernelWipe, ROMNuke and ROMReset/SDClean in case any files that are wiped in these operations are included in the user's list of files to keep (/sdcard/HawkerCore/Options/MyKeepFiles.txt)

5. Wipe of .android_secure no longer performed in SDClean

V1 Beta10 (25/03/2014)

1. Added CT_AlbumArtWipe core task

2. Added MyBackup preset zip

3. Added CT_MyBackup core task

4. CT_KernelWipe remove KTmonitor files

5. CT_KernelWipe Added Alucard Kernel

6. Added support for SGH-I337

7. Display tweaks

V1 Beta9 (06/03/2014)

1. CT_MediaWipe not removing internal/external sdcard areas

2. Display tweaks

3. More information output to log file

V1 Beta8 (05/03/2014)

1. Core was not installing correctly on the very first installation

V1 Beta7 (14/02/2014)

1. SGH-M919 now supported

V1 Beta6 (14/01/2014)

1. Display tweaks

2. Not restoring HawkerCore folder and files defined in MyKeepFiles after a full wipe

3. Identified more files to wipe in the CT_KernelWipe operation for KT and Ausdim kernels.

4. GT-I9505G now supported.

V1 Beta5 (21/11/2013)

1. Display tweaks

2. Added .mmsyscache to the Android Data Wipe Folders

3. CT_KernelWipe Added Abyss Kernel

4. CT_KernelWipe Added KT Kernel

5. Device names for /system, /data, /cache and /efs are now detected

V1 Beta4 (12/11/2013)

1. Added the CT_BloatWipe core function

V1 Beta3 (08/11/2013)

1. Take all wipe operations out of individual .zip updater-scripts and into the Core.

2. User-defined jobs in /sdcard/HawkerCore/Jobs/[Job-Name]

3. Display tweaks

V1 Beta2 (05/11/2013)

1. Properties file (/sdcard/HawkerCore/Options/HawkerCore.prop) was being recreated on each run

V1 Beta1 (03/11/2013)

First release

​