﻿### LICENSE:
#
# Copyright (C) 2011 Ahmad Amarullah ( http://amarullz.com/ )
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
### FILE INFO:
#
# AROMA Installer 2.00 - AROMA Installer Test Script Configuration
#       (c) 2011-2012 by Ahmad Amarullah
#           amarullz - xda-developers
#           http://www.amarullz.com/
#
#       Binary Version  : 2.50
#       Binary Codename : Edelweis
#
### INFO:
#
# * AROMA Resource Dir  = META-INF/com/google/android/aroma
#
# * AROMA Temporary Dir = /tmp/aroma/
#
# * About Icon          = @alert - show <AROMA Resource Dir>/icons/alert.png
#                         or if theme used it will find <themedir>/icon.alert.png
#                         you can still access it via "icons/alert"
#
# * dp                  = Device Pixelate. WVGA/QHD = 3, HVGA = 2.
#                         dp calculated with = round(min(width,height) / 160)
#
###

##
# Fix Colorspace Issue
#
# For device which have a problem with color ( not display the correct color )
# try to set "force_colorspace" with ini_set. It may caused by wrong framebuffer
# information that passed by kernel into framebuffer device.
#
# You can use one of following values:
#   "rgba", "abgr", "argb", "bgra"
#
# NOTE: It must be in top most script, or you will got the color flicker
#
# ini_set("force_colorspace","rgba");
#

##
# Set device pixel density
#
ini_set("dp","2");

##
# Initializing Kernel Information
#
ini_set("rom_name",             "Yank555.lu Kernel");
ini_set("rom_version",          "v1.2");
ini_set("rom_author",           "Yank555.lu");
ini_set("rom_device",           "ASUS TF101(G)");
ini_set("rom_date",             "12/11/2012");

##
# Show Simple Splash
#
splash(
  #-- Duration 2000ms / 2 seconds
    5000,
  
  #-- <AROMA Resource Dir>/yank555.lu.png
    "yank555.lu"
);

#
# Set Small Font to Support all fonts
#
fontresload( "0", "ttf/Roboto-Regular.ttf;ttf/DroidSansArabic.ttf;ttf/DroidSansFallback.ttf;", "12" ); #-- Use sets of font (Font Family)

###################################################################################################################
#
# LANGUAGE SELECTION
#
loadlang("langs/en.lang");
fontresload( "0", "ttf/Roboto-Regular.ttf", "12" ); #-- "0" = Small Font ( Look at Fonts & UNICODE Demo Below )
fontresload( "1", "ttf/Roboto-Regular.ttf", "18" ); #-- "1" = Big Font

###################################################################################################################
#
# STEP 3 - LICENSE
#
agreebox(
  #-- Title
    "<~terms.title>",
  
  #-- Subtitle / Description
    "<~terms.desc>",
  
  #-- Icon
    "@license",
  
  #-- Text Content ( Read from <AROMA Resource Dir>/license.txt )
    resread("license.txt"),
  
  #-- Checkbox Text
    "<~terms.check>",
  
  #-- Unchecked Alert Message
    "<~terms.confirm>"
);

###################################################################################################################
#
# DISPLAY CHANGELOG
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" <~changelog.title>",
  
  #-- Subtitle
    "<~changelog.desc>",
  
  #-- Icon
    "@update",
  
  #-- Arg 4
    resread("changelog.txt")
);

###################################################################################################################
#
# CPU Frequencies
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "CPU frequency settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "cpu.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "CPU maximum frequency", 			"",																								2, #-- selected.1
    "1.0GHz",				"Stock ASUS",																									1, #-- 1
	  "1.1GHz",				"not supported yet",																					0, #-- 2
    "1.2GHz",				"not supported yet",																					0, #-- 3
    "1.3GHz",				"not supported yet",																					0, #-- 4
    "1.4GHz",				"not supported yet",																					0, #-- 5
    "1.5GHz",				"not supported yet",																					0, #-- 6
    "1.6GHz",				"not supported yet",																					0, #-- 7
  "Governor choice",		"",																												2, #-- selected.2
    "interactive",	"",																														1, #-- 1
    "ondemand",			"Standard ondemand",																					0, #-- 2
    "ondemand io",	"when I/Os take place, CPU frequency will throttle up",				0  #-- 3
);

###################################################################################################################
#
# I/O settings
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "MMC I/O Settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "io.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "MMC ReadAhead buffer size\n(more is not always better !)", 	"",								2, #-- selected.1
    "128kB", 					"",																													0, #-- 1
    "256kB", 					"",																													0, #-- 2
    "512kB", 					"",																													0, #-- 3
    "1024kB", 				"",																													0, #-- 4
    "2048kB", 				"",																													1, #-- 5
    "3072kB", 				"",																													0, #-- 6
    "4096kB", 				"",																													0, #-- 7
  "MMC I/O scheduler", 													"",																2, #-- selected.2
    "noop", 					"",																													0, #-- 1
    "dealine", 				"",																													0, #-- 2
    "cfq", 						"",																													1  #-- 3
);

###################################################################################################################
#
# Android Low Memory Killer settings
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Android Low Memory Killer settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "lmk.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "Low Memory Killer Presets", 								"",																	2, #-- selected.1
    "Stock TF101(G)", 	"32/40/48/56/64/80 Mb",																		0, #-- 1
    "Very light", 			"2/4/5/8/12/16 Mb (least free RAM)",											0, #-- 2
    "Light", 						"4/8/10/16/24/32 Mb (less free RAM)",											0, #-- 3
    "Medium", 					"4/8/16/32/48/64 Mb (medium free RAM)",										0, #-- 4
    "Aggressive", 			"8/16/32/64/96/128 Mb (more free RAM)",										0, #-- 5
    "Very aggressive", 	"16/32/64/128/192/256 Mb (most free RAM)",								0, #-- 6
    "Don't set here", 	"Leave LMK settings untouched",														1  #-- 7
);

###################################################################################################################
#
# Virtual memory
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Virtual memory",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "swap.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "Hardswap by Yank555.lu\n(swap partition on SD card needed !)", "",							2, #-- selected.1
    "no", 						"Stock TF101(G)",																						1, #-- 1
    "yes",					 	"",																													0, #-- 2
  "zRam support", 															"",																2, #-- selected.2
    "no", 						"Stock TF101(G)",																						1, #-- 1
    "100Mb",				 	"",																													0, #-- 2
    "150Mb",				 	"",																													0, #-- 3
    "200Mb",				 	"",																													0, #-- 4
    "250Mb",				 	"",																													0, #-- 5
  "Swappiness", 																"",																2, #-- selected.2
    "60", 						"Standard Linux",																						0, #-- 1
    "70",						 	"",																													0, #-- 2
    "80",						 	"",																													0, #-- 3
    "90",						 	"",																													0, #-- 4
    "100",					 	"Stock hardswap",																						1, #-- 5
    "Don't set here",	"Leave swappiness untouched",																0  #-- 6
);

###################################################################################################################
#
# Dynamic fsync
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "Dynamic fsync settings",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "fsync.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "Dynamic fsync by faux123", 						"",																						2, #-- selected.1
    "enabled",	"screen on = fsync deferred, screen off = flush outstanding writes",		1, #-- 1
    "disabled", "synchronises writes normally (slower, but safer) - Stock TF101(G)",		0  #-- 2
);

###################################################################################################################
#
# init.d script support out of ramdisk
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "init.d script support",
  
  #-- Icon
    "@customize",
    
  #-- Will be saved in /tmp/aroma/
    "initd.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  "init.d script execution support from ramdisk", 						"",									2, #-- selected.1
    "no",				 			"ROM needs to take care of this",														1, #-- 1
    "yes", 						"only use this if you know what you're doing !!",						0  #-- 2
);

###################################################################################################################
#
# DISPLAY WARNING
#
textbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version"),
  
  #-- Subtitle
    "Warning !!",
  
  #-- Icon
    "@alert",
  
  #-- Arg 4
    resread("warning.txt")
);

###################################################################################################################
#
# What to do now ?
#
selectbox(
  #-- Title
    ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
  
  #-- Sub Title
    "What do you want to do now ?",
  
  #-- Icon
    "@confirm",
    
  #-- Will be saved in /tmp/aroma/
    "flash.prop",
    
  #---------------------------------[ Selectbox Without Group ]----------------------------------#
  #--------[ Initial Value = 0: Unselected, 1: Selected, 2: Group Item, 3: Not Visible ]---------#
  #----------------------------------------------------------------------------------------------#
  # TITLE            |  SUBTITLE                                                 | Initial Value #
  #----------------------------------------------------------------------------------------------#

  																																									 #-- selected.0
    "Kernel & Config","Flash the kernel & generate config scripts",								1, #-- 1
    "Config only", 		"Regenerate config scripts only (don't reflash the kernel",	0  #-- 2
);

###################################################################################################################
#
# Kernel flashing
#
setvar("retstatus",
  install(
	#-- Title
      ini_get("rom_name")+" "+ini_get("rom_version")+" Installer",
	
	#-- Installation Process message
	  "Please wait while flashing <b>"+ini_get("rom_name")+
	  "</b>. This should be done quickly.",
	
	#-- Installation Icon
      "@install",
	
	#-- Installation Finish Message
    "The installation wizard has successfully installed <b>"+ini_get("rom_name")+
	  "</b>. Press Next to continue."
  )
);

##
#
# Next Button is "Finish"
#
ini_set("text_next", "Finish");

###################################################################################################################
#
# FINISH MESSAGE, Add Checkbox to Reboot or No. Save in "reboot_it" variable
#
# You can use return value or "reboot_it" variable to retrive checkbox value
# Example:
# if (checkviewbox(....)=="1" then
#    ... checked ...
# endif;
#
checkviewbox(
  #-- Title
    "Installation Completed",
  
  #-- Text
    "<#selectbg_g><b>Congratulation...</b></#>\n\n"+
    "<b>"+ini_get("rom_name")+"</b> has been flashed onto your device.\n\n"+
    "Installer Status: "+getvar("retstatus")+"\n\n",
	
  #-- Icon
    "@welcome",

  #-- Checkbox Text
    "Reboot your device now.",

  #-- Initial Checkbox value ( 0=unchecked, 1=checked ) -  (Optional, default:0)
    "0",

  #-- Save checked value in variable "reboot_it" (Optional)
    "reboot_it"
);

###
#
# Check if reboot checkbox was checked
if
  getvar("reboot_it")=="1"
then
  #
  # reboot("onfinish");   - Reboot if anything finished
  # reboot("now");        - Reboot Directly
  # reboot("disable");    - If you set reboot("onfinish") before, use this command to revert it.
  #
  reboot("onfinish");
endif;

#---- FINISH
