Last active
December 16, 2015 20:49
-
-
Save ma34s/5495491 to your computer and use it in GitHub Desktop.
まぁ、一撃と呼ばれているものを作ろうとしてみた・・・ (途中で力尽きる・・・
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------ | |
// Config for XXX | |
var ro_product_model ="SC-02E"; | |
var ro_product_brand ="samsung"; | |
var ro_product_name ="SC-02E"; | |
var ro_product_device ="sc02e"; | |
var ro_product ="sc02e"; | |
var ro_build_description ="t0ltedcm-user 4.1.1 JRO03C SC02EOMALJF release-keys"; | |
var ro_build_fingerprint ="samsung/SC-02E/SC-02E:4.1.1/JRO03C/SC02EOMALJF:user/release-keys"; | |
var ro_factory_model ="SGH-N025"; | |
var UpdateScriptConf =new Array( | |
"GT-N7105" ,"SC-02", | |
"t0lte" ,"sc02e", | |
"SGH-I317" ,"SC-02", | |
"t0lteatt" ,"sc02e", | |
"SGH-T889" ,"SC-02", | |
"t0ltetmo" ,"sc02e"); | |
//================================================================== | |
// Internal use only (do not edit here) | |
var objFso; | |
var mScriptPath; | |
objFso = WScript.CreateObject("Scripting.FileSystemObject") ; | |
//スクリプト名を含まないフルパスを編集する | |
mScriptPath = String(WScript.ScriptFullName).replace(WScript.ScriptName,""); | |
// オープンモード | |
var FORREADING = 1; // 読み取り専用 | |
var FORWRITING = 2; // 書き込み専用 | |
var FORAPPENDING = 8; // 追加書き込み | |
// 開くファイルの形式 | |
var TRISTATE_TRUE = -1; // Unicode | |
var TRISTATE_FALSE = 0; // ASCII | |
var TRISTATE_USEDEFAULT = -2; // システムデフォルト | |
//================================================================== | |
/*================================================================== | |
Memo: | |
<any_place> | |
+ diff | |
| + system | |
| | + xxxx | |
| + boot.img | |
+ tool | |
| +7z.exe | |
| +appt.exe | |
| + etc... | |
+ out | |
| + work (temporaly use) | |
| | +temp | |
| | | +META-INF | |
| | | +system | |
| | +temp.zip (copy from user) | |
| + complete.zip | |
+ test.js (this file) | |
*/ | |
function getTextFile( fileName ) | |
{ | |
var ret; | |
var objTxt; | |
// MyDebugPrint("getTemplateString():"+fileName); | |
objTxt = objFso.OpenTextFile(fileName, FORREADING, false, TRISTATE_USEDEFAULT); | |
ret = objTxt.ReadAll(); | |
objTxt.Close(); | |
return ret; | |
} | |
function outputTextFile( path , val ) | |
{ | |
//改行コード変換 | |
val =String(val).replace("\r",""); | |
var file = objFso.OpenTextFile( path, FORWRITING, true, TRISTATE_FALSE ); | |
file.Write(val); | |
file.Close(); | |
} | |
//------------------------------------------------------------------ | |
function replaceProp(src,dst) | |
{ | |
var val = getTextFile( src ); | |
val =String(val).replace(/ *= / ,"="); //prop定義の整形 | |
val =val.replace(/ro.product.model=.*/ ,"ro.product.model="+ro_product_model); | |
val =val.replace(/ro.product.brand=.*/ ,"ro.product.brand="+ro_product_brand); | |
val =val.replace(/ro.product.name=.*/ ,"ro.product.name="+ro_product_name); | |
val =val.replace(/ro.product.device=.*/ ,"ro.product.device="+ro_product_device); | |
val =val.replace(/ro.product=.*/ ,"ro.product="+ro_product); | |
val =val.replace(/ro.build.description=.*/ ,"ro.build.description="+ro_build_description); | |
val =val.replace(/ro.build.fingerprint=.*/ ,"ro.build.fingerprint="+ro_build_fingerprint); | |
val =val.replace(/ro.factory.model=.*/ ,"ro.factory.model="+ro_factory_model); | |
val =val.replace(/ro.config.*=.*/ ,""); | |
val += "\n# Add \n"; | |
val += "ro.config.libemoji=libemoji_docomo.so\n"; | |
outputTextFile(dst,val); | |
} | |
//------------------------------------------------------------------ | |
function replaceUpdateScript(src,dst) | |
{ | |
var val = getTextFile( src ); | |
for(i=0;i<(UpdateScriptConf.lenght/2);i++) | |
{ | |
val =String(val).replace(UpdateScriptConf[i*2] ,UpdateScriptConf[(i*2)+1]); | |
} | |
/* | |
val =String(val).replace("GT-N7105" ,"SC-02"); | |
val =String(val).replace("t0lte" ,"sc02e"); | |
val =String(val).replace("SGH-I317" ,"SC-02"); | |
val =String(val).replace("t0lteatt" ,"sc02e"); | |
val =String(val).replace("SGH-T889" ,"SC-02"); | |
val =String(val).replace("t0ltetmo" ,"sc02e"); | |
*/ | |
outputTextFile(dst,val); | |
} | |
//------------------------------------------------------------------ | |
function replaceResouceItem(src,dst) | |
{ | |
var val = getTextFile( src ); | |
val =String(val).replace(/<item>clock</,"<item>clock</item>\n<item>felica_lock</item>"); | |
outputTextFile(dst,val); | |
} | |
//------------------------------------------------------------------ | |
function AddFileToZip(zip,src) | |
{ | |
/*zipへファイル追加処理*/ | |
} | |
//------------------------------------------------------------------ | |
function getFileFromZip(src,dst,path) | |
{ | |
/*zipを指定して、指定パスのファイルのみ取り出す処理*/ | |
} | |
//------------------------------------------------------------------ | |
function getBuildProp(src,dst) | |
{ | |
/*zipを指定して、build.propのみ取り出す処理*/ | |
getFileFromZip(src,dst,"system/build.prop"); | |
} | |
//------------------------------------------------------------------ | |
function getUpdaterScript(src,dst) | |
{ | |
/*zipを指定して、updater-scriptのみ取り出す処理*/ | |
getFileFromZip(src,dst,"META-INF/com\google/android/updater-script"); | |
} | |
//------------------------------------------------------------------ | |
function getFramworkResApk(src,dst) | |
{ | |
/*zipを指定して、framework-res.apkのみ取り出す処理*/ | |
getFileFromZip(src,dst,"system/framework/framework-res.apk"); | |
} | |
function decodeFramworkResApk(src,dst) | |
{ | |
/*framework-resをデコード処理*/ | |
} | |
function buildFramworkResApk(src,dst) | |
{ | |
/*framework-resをデコード処理*/ | |
} | |
function signZip(src,dst) | |
{ | |
/*signed zip処理*/ | |
} | |
//------------------------------------------------------------------ | |
//Test | |
var prop = mScriptPath + "build.prop" | |
var update = mScriptPath + "updater-script" | |
var xml = mScriptPath + "arrays.xml" | |
//copy to work from user seleced zip here | |
//getBuildProp(src,dst); | |
replaceProp(prop,prop+"2"); | |
//AddFileToZip(zip,src) | |
//getUpdaterScript(src,dst); | |
//replaceUpdateScript(update,update+"2") | |
//AddFileToZip(zip,src) | |
//getFramworkResApk(src,dst); | |
//replaceResouceItem(xml,xml+"2") | |
//buildFramworkResApk(src,dst) | |
//AddFileToZip(zip,src) | |
//AddFileToZip(zip,src); //diff/system | |
//AddFileToZip(zip,src); //boot.img | |
//signZip(src,dst) | |
WScript.Echo( "終了" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
アップする時に整理したのが原因で文法エラーなど出てたんで直した。
ついでにupdater-scriptの置換設定を配列で持つようにして
configだけで仕向けを変更可能にしてみた。