[Android Software/Hacking General [Developers Only]] ISF:
Updater-script

ui_print("+++++++++++++++++++++++++++++++++++++++++++++++++++");
ui_print("	BHP ROM powered by ISF ");
ui_print(" * * ** ******** * * ** ***** ");
ui_print(" * * * * * * ** * * * * ");
ui_print(" * * * * * * ** * * ***** ");
ui_print(" * * * * * * * * ** * * ");
ui_print(" * * * ******** &&&&&&&&&&&&&&&& ");
ui_print(" * * * * * * ");
ui_print(" * * * * * * * * ** ***** ");
ui_print(" * * * * * * ** * * * * ");
ui_print(" * * ** * * ** * * ***** ");
ui_print(" Thanks to Xda.developers.com * * ** * * ");
ui_print("+++++++++++++++++++++++++++++++++++++++++++++++++++");

set_progress(0.1);
ui_print("@Mounting & Formating Devices");

ui_print("Wiping Preload ...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p27", "/preload");
delete_recursive("/preload");

ui_print("Wiping Cache ...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p18", "/cache");
delete_recursive("/cache");

ui_print("Wiping Dalvik Cache ...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p29", "/data");
delete_recursive("/data/dalvik-cache");

ui_print("Deleting System ...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p16", "/system");
delete_recursive("/system");

mount("ext4", "EMMC", "/dev/block/mmcblk0p21", "/data");
if file_getprop("/tmp/aroma-data/wipe.prop","selected.0") == "2" then
package_extract_file("BHP/wipe.sh", "/tmp/wipe.sh");
package_extract_file("BHP/bash", "/tmp/bash");
set_perm(0, 0, 0777, "/tmp/wipe.sh");
set_perm(0, 0, 0777, "/tmp/bash");
run_program("/tmp/wipe.sh");
delete_recursive("/data/app");
endif;

ui_print("Installing BASE");
package_extract_dir("system", "/system");

if
file_getprop("/tmp/aroma/theme.prop","item.1.1") == "1"
then
ui_print("INSTALLING FULL S5 THEME...");
ui_print("Delete old S4 files...");
delete("/system/app/SamsungIME.apk");
delete("/system/app/KeyguardBackupRestore.apk");
delete("/system/app/KeyguardWidget.apk");
delete("/system/app/AccuweatherPhone2013.apk");
delete("/system/app/WeatherWidgetDaemon.apk");
delete("/system/app/SecCalculator_3d.apk");
delete("/system/app/S_Translator_CSLi.apk");
delete("/system/app/VoiceRecorder.apk");
delete("/system/app/SPlannerAppWidget.apk");
delete("/system/app/Peel.apk");
delete("/system/app/SecCalendar_SPen.apk");
delete("/system/app/SecEmail_J.apk");
delete("/system/app/SecExchange.apk");
delete("/system/app/MusicPlayerWT.apk");
delete("/system/app/MusicCommonUtility.apk");
delete("/system/app/MusicLiveShare2.apk");
delete("/system/app/ActivityZone.apk");
delete("/system/priv-app/SecContacts_OSup.apk");
delete("/system/priv-app/SecPhone.apk");
delete("/system/priv-app/SecWallpaperChooser.apk");
delete("/system/priv-app/SecLauncher3.apk");
delete("/system/priv-app/SecSettings.apk");
delete("/system/priv-app/SystemUI.apk");
delete("/system/priv-app/Keyguard.apk");
delete("/system/priv-app/SecNoteMyFiles.apk");
delete("/system/priv-app/SecMyFiles2.apk");
delete("/system/priv-app/SMemo2.apk");
delete("/system/priv-app/S-Voice_Android_phone.apk");
delete("/system/priv-app/PhotoRetouching_FHD_J.apk");
delete("/system/priv-app/SecGallery2013.apk");
delete("/system/priv-app/SamsungVideo.apk");
delete("/system/priv-app/SecVideoPlayerUpg.apk");
delete("/system/priv-app/SecVideoListUpg.apk");
delete("/system/priv-app/SecMms.apk");
delete("/system/priv-app/GroupPlay_25.apk");
delete("/system/priv-app/SHealth2_5.apk");
delete("/system/priv-app/MusicFX.apk");
delete("/system/priv-app/SecMediaProvider.apk");
delete("/system/priv-app/SoundAlive.apk");
delete("/system/priv-app/ActivityZone.apk");
delete("/system/framework/android.policy.jar");
delete("/system/framework/framework-res.apk");
delete("/system/lib/libXIVGallery2013.so");
set_perm_recursive(0, 0, 0755, 0644, "/system/app");
set_perm_recursive(0, 0, 0755, 0644, "/system/csc");
set_perm_recursive(0, 0, 0755, 0644, "/system/lib");
set_perm_recursive(0, 0, 0755, 0644, "/system/fonts");
set_perm_recursive(0, 0, 0755, 0644, "/system/finder_cp");
set_perm_recursive(0, 0, 0755, 0644, "/system/priv-app");
set_perm_recursive(0, 0, 0755, 0644, "/system/framework");
ui_print("Installing S5 apps...");
package_extract_dir("BHP/S5/system", "/system");
package_extract_dir("BHP/S5/data", "/data");
ui_print("Installing S5 theme...");
package_extract_dir("BHP/S5/vrtheme", "/sdcard/vrtheme");
set_perm(0, 0, 0755, "/sdcard/vrtheme/installtheme.sh");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zip");
set_perm(0, 0, 0755, "/sdcard/vrtheme/zipalign");
run_program("/sdcard/vrtheme/installtheme.sh");
delete_recursive("/sdcard/vrtheme");

if
file_getprop("/tmp/aroma/tweaks.prop","item.1.1") == "1"
then
ui_print("Debloating as you selected...");
delete("/system/app/AirMotionTryActually.apk");
delete("/system/app/AllShareCastPlayer.apk");
delete("/system/app/AllshareControlShare.apk");
delete("/system/app/AllshareFileShare.apk");
delete("/system/app/AllshareFileShareClient.apk");
delete("/system/app/AllshareFileShareServer.apk");
delete("/system/app/AllshareMediaServer.apk");
delete("/system/app/AllshareMediaShare.apk");
delete("/system/app/AntHalService.apk");
delete("/system/app/ANTPlusPlugins.apk");
delete("/system/app/ANTRadioService.apk");
delete("/system/priv-app/AutoPreconfig.apk");
delete("/system/priv-app/AutomationTest_FB.apk");
delete("/system/app/Blurb.apk");
delete("/system/app/ChatONV_J.apk");
delete("/system/app/ChatON_feature.apk");
delete("/system/lib/libChatOnAMSImageFilterLibs-1.0.2.so");
delete("/system/priv-app/CloudAgent.apk");
delete("/system/priv-app/COS_Romdetection.apk");
delete("/system/app/DioDict3Service.apk");
delete("/system/lib/libDioDict3EngineNativeService.so");
delete("/system/lib/libDioDict4EngineNativeService.so");
delete("/system/lib/libDioOcrEngine.so");
delete("/system/priv-app/discoveree_v2_1_0.apk");
delete("/system/priv-app/DSMForwarding.apk");
delete("/system/priv-app/DSMLawmo.apk");
delete("/system/app/EasyFavoritesContactsWidget.apk");
delete("/system/priv-app/EasyLauncher.apk");
delete("/system/app/EasySettings.apk");
delete("/system/app/Flipboard.apk");
delete("/system/priv-app/FmmDM.apk");
delete("/system/priv-app/FmmDS.apk");
delete("/system/app/GearManagerStub.apk");
delete("/system/priv-app/GroupPlay_25.apk");
delete("/system/app/InteractiveKeyguardTutorial.apk");
delete("/system/app/InteractiveTutorial.apk");
delete("/system/priv-app/Kies.apk");
delete("/system/priv-app/KLMSAgent.apk");
delete("/system/app/MobilePrint3.apk");
delete("/system/app/MobilePrintSvc_CUPS.apk");
delete("/system/app/MobilePrintSvc_CUPS_Backend.apk");
delete("/system/app/MobilePrintSvc_Epson.apk");
delete("/system/app/MobilePrintSvc_HP.apk");
delete("/system/app/MobilePrintSvc_Samsung.apk");
delete("/system/app/MobilePrintSvc_WFDS.apk");
delete("/system/app/MobileTrackerEngineTwo.apk");
delete("/system/app/MusicLiveShare2.apk");
delete("/system/app/PageBuddyNotiSvc2.apk");
delete("/system/app/Peel.apk");
delete("/system/app/PhotoTable.apk");
delete("/system/app/PolarisViewer5.apk");
delete("/system/lib/libpolarisexternel.so");
delete("/system/lib/libpolarisexternel3.so");
delete("/system/lib/libpolarisexternel3SDK.so");
delete("/system/lib/libpolarisexternelSDK.so");
delete("/system/lib/libpolaristextprint5v.so");
delete("/system/lib/libpolarisviewer5.so");
delete("/system/lib/libpolarisviewerSDK.so");
delete("/system/app/S_Translator_CSLi.apk");
delete("/system/priv-app/SamsungApps.apk");
delete("/system/app/SamsungAppsWidget.apk");
delete("/system/app/SamsungBooks.apk");
delete("/system/app/SamsungContentsAgent.apk");
delete("/system/app/SamsungGames_H.apk");
delete("/system/app/SamsungHub.apk");
delete("/system/app/SamsungHubUpdater.apk");
delete("/system/app/SamsungLearning.apk");
delete("/system/priv-app/SamsungLink18.apk");
delete("/system/app/SamsungMusic10.apk");
delete("/system/app/SamsungOCR2.apk");
delete("/system/priv-app/Samsungservice.apk");
delete("/system/app/SamsungTTS.apk");
delete("/system/priv-app/SamsungWallet_Stub.apk");
delete("/system/app/SamsungWatchON.apk");
delete("/system/app/sCloudBackupApp.apk");
delete("/system/priv-app/sCloudBackupProvider.apk");
delete("/system/app/sCloudDataRelay.apk");
delete("/system/app/sCloudDataSync.apk");
delete("/system/app/sCloudQuotaApp.apk");
delete("/system/app/sCloudSyncCalendar.apk");
delete("/system/app/sCloudSyncContacts.apk");
delete("/system/app/sCloudSyncSBrowser.apk");
delete("/system/app/sCloudSyncSNote.apk");
delete("/system/app/SCONE_Android_ProxyService.apk");
delete("/system/priv-app/SecSafetyAssurance.apk");
delete("/system/app/SecSetupWizard2013.apk");
delete("/system/app/SecurityProviderSEC.apk");
delete("/system/priv-app/SensorService2_5.apk");
delete("/system/priv-app/ShareVideo.apk");
delete("/system/priv-app/SHealth2_5.apk");
delete("/system/lib/libhealth_jni.so");
delete("/system/priv-app/SimpleWidget.apk");
delete("/system/app/SmartBriefing4x2.apk");
delete("/system/priv-app/SMemo2.apk");
delete("/system/priv-app/SNoteProvider.apk");
delete("/system/lib/libsnote_core.so");
delete("/system/priv-app/SNS.apk");
delete("/system/priv-app/SPPPushClient_Prod.apk");
delete("/system/priv-app/StoryAlbumWidget.apk");
delete("/system/priv-app/StoryAlbum2013.apk");
delete("/system/priv-app/SyncmlDM.apk");
delete("/system/priv-app/SyncmlDS.apk");
delete("/system/app/TravelService.apk");
delete("/system/app/TravelWidget.apk");
delete("/system/app/TripAdvisor.apk");
delete("/system/app/YahoostockPhone2013.apk");
delete("/system/app/YahoonewsPhone2013.apk");
delete("/system/app/WebManual.apk");
delete("/system/app/AirMotionTryActually.apk");
delete("/system/priv-app/AutomationTest_FB.apk");
delete("/system/app/BluetoothTest.apk");
delete("/system/priv-app/HwModuleTest.apk");
delete("/system/app/NfcTest.apk");
delete("/system/app/SecFactoryPhoneTest.apk");
delete("/system/app/WlanTest.apk");
delete("/system/app/ELMAgent.apk");
delete("/system/app/univesalMDMClient.apk");
delete("/system/priv-app/wssyncmlnps.apk");
endif;

set_progress(0.4);

ui_print("Copying Selected Files ...");

if
file_getprop("/tmp/aroma/apps.prop","item.1.1") == "1"
then
ui_print("Installing Gravity Box");
package_extract_dir("BHP/apps/gravity", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.2") == "1"
then
ui_print("Installing Coloured Status Bar");
package_extract_dir("BHP/apps/color", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.3") == "1"
then
ui_print("Smooth System Progress");
package_extract_dir("BHP/apps/smooth", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.4") == "1"
then
ui_print("Instagram Photo/Video Downloader");
package_extract_dir("BHP/apps/instagram", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.5") == "1"
then
ui_print("Installing DVFS Disabler");
package_extract_dir("BHP/apps/dvfs", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.6") == "1"
then
ui_print("Installing App Settings");
package_extract_dir("BHP/apps/settings", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.7") == "1"
then
ui_print("Installing Wanam Xposed");
package_extract_dir("BHP/apps/wanam", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.1.8") == "1"
then
ui_print("Installing S5 UI Module");
package_extract_dir("BHP/apps/s5", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.1") == "1"
then
ui_print("Installing Pixlr Express");
package_extract_dir("BHP/apps/pixlr", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.2") == "1"
then
ui_print("Installing Nova Launcher");
package_extract_dir("BHP/apps/nova", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.3") == "1"
then
ui_print("Installing DPI Changer");
package_extract_dir("BHP/apps/dpi", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.4") == "1"
then
ui_print("Installing AdAway");
package_extract_dir("BHP/apps/adaway", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.5") == "1"
then
ui_print("Installing Active GPS");
package_extract_dir("BHP/apps/gps", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.6") == "1"
then
ui_print("Installing ExDialer");
package_extract_dir("BHP/apps/exdialer", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.7") == "1"
then
ui_print("Installing Hi-Q Voice Recorder");
package_extract_dir("BHP/apps/voice", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.8") == "1"
then
ui_print("Installing AccuWheater S4 Transparent Widget");
package_extract_dir("BHP/apps/accu", "/system");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.9") == "1"
then
ui_print("Installing S4 E-Mail");
package_extract_dir("BHP/apps/email", "/system");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.10") == "1"
then
ui_print("Installing KIDS Mode");
package_extract_dir("BHP/apps/kids", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.11") == "1"
then
ui_print("Installing Google Keyboard");
package_extract_dir("BHP/apps/keyboard", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.2.12") == "1"
then
ui_print("Installing Smart Launcher 2");
package_extract_dir("BHP/apps/smart", "/data");
endif;

if
file_getprop("/tmp/aroma/apps.prop","item.3.1") == "1"
then
ui_print("Installing ViPer4Android");
package_extract_dir("BHP/apps/viper", "/data");
endif;

if
file_getprop("/tmp/aroma/tweaks.prop","item.1.2") == "1"
then
ui_print("Installing INIT.D Tweaks");
package_extract_dir("BHP/tweaks/etc", "/system/etc");
endif;

if
file_getprop("/tmp/aroma/camera.prop","selected.1.1") == "1"
then
ui_print("Installing S5 9.6 MP Camera");
package_extract_dir("BHP/camera9/system", "/system");
endif;

if
file_getprop("/tmp/aroma/camera.prop","selected.1.2") == "1"
then
ui_print("Installing S5 13 MP Camera");
package_extract_dir("BHP/camera13/system", "/system");
endif;

if
file_getprop("/tmp/aroma/theme.prop","item.1.2") == "1"
then
ui_print("Installing S5 Camera Modes");
package_extract_dir("BHP/modes", "/data");
endif;

ui_print("Deleting previous KTweaker Folder");
delete("/sdcard/KTweaker");

ui_print("Installing BHP Kernel Profile");
package_extract_dir("BHP/tweaks/module", "/sdcard");

ui_print("Flashing kernel ...");
assert(package_extract_file("BHP/boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "/dev/block/mmcblk0p20"),
delete("/tmp/boot.img"));

set_progress(0.8);

ui_print("Symlinking ...");
ui_print("+++++++++++++++++++++++++");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/chcon");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/cp");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/du");
symlink("toolbox", "/system/bin/getenforce");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/getsebool");
symlink("toolbox", "/system/bin/grep");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/load_policy");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/md5");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/playback");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/restorecon");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/runcon");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setenforce");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/setsebool");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/touchinput");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/wipe");
symlink("dumpstate", "/system/bin/dumpcrash");
symlink("mksh", "/system/bin/sh");
symlink("debuggerd", "/system/bin/csview");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("/system/xbin/su", "/system/bin/su");

ui_print("Permissions...SET");
set_perm_recursive(0, 0, 0755, 0644, "/system");

set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 1000, 04750, "/system/bin/diag_mdlog");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(0, 3003, 06755, "/system/bin/ip");

set_perm_recursive(0, 0, 0755, 0755, "/system/etc/init.d");
set_perm(0, 2000, 0755, "/system/etc/install-recovery.sh");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pair_devlist.conf");

set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib/hw");
set_perm(0, 2000, 0755, "/system/vendor");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm(0, 2000, 0755, "/system/vendor/lib/egl");
set_perm(0, 2000, 0755, "/system/vendor/lib/hw");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/pittpatt");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(0, 0, 06755, "/system/xbin/daemonsu");

run_program("/sbin/busybox", "chmod", "0771", "/data/data");
run_program("/sbin/busybox", "chmod", "0771", "/data/app");

set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
ui_print("Flashing Busybox ...");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");

mount("ext4", "EMMC", "/dev/block/mmcblk0p18", "/cache");
delete_recursive("/cache");
mount("ext4", "EMMC", "/dev/block/mmcblk0p29", "/data");
delete_recursive("/data/dalvik-cache");

ui_print("FINALLY!");
ui_print("You have been supercharged! Drive carefully!");
ui_print("In Memoriam of Paul Walker");
ui_print("Ride or Die!");

unmount("/system");
unmount("/cache");
unmount("/data");
unmount("/preload");

set_progress(1);