1. #!/system/bin/sh
  2. # V6 SuperCharger, OOM Grouping & Priority Fixes created by zeppelinrox.
  3. echo " REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!"
  4. #set -o errexit
  5. cat > /sdcard/SuperCharger.html <<EOF
  6. Hi! I hope that the V6 SuperCharger script is working well for you!<br>
  7. <br>
  8. First be sure to have <a href="http://market.android.com/details?id=com.jrummy.busybox.installer">BusyBox</a> installed or else the scripts won't work!<br>
  9. Also, only install <b>BusyBox v1.18.2 or lower!</b> v1.18.3 and above sometimes give errors on some ROMs!<br>
  10. <br>
  11. A nice app for running the script is <a href="http://market.android.com/details?id=os.tools.scriptmanager">Script Manager</a><br>
  12. It can even load scripts on boot - on ANY ROM!<br>
  13. Plus, it even has WIDGETS!<br>
  14. So you can actually put a V6 SuperCharger shortcut on your desktop, launch it, and have a quick peek at your current status!<br>
  15. <br>
  16. But first, you need to set up Script Manager properly!<br>
  17. In the "Config" settings, enable "Browse as Root."<br>
  18. Then browse to where you saved the V6 SuperCharger script, select it, and in the script's properties box, be sure to select "Run as Root."<br>
  19. <b>Do NOT run this file at boot!</b> (You don't want to run the install on every boot, do you?)<br>
  20. Run the V6 SuperCharger script, touch the screen to access the soft keyboard, and enter your choice :)<br>
  21. <br>
  22. <b>Stock ROMs</b>: After running the script, have Script Manager load the newly created <b>/data/99SuperCharger.sh</b> on boot<br>
  23. In the "Config" settings, be sure that "Browse as Root" is enabled.<br>
  24. Press the menu key and then Browser. Navigate up to the root, then click on the "data" folder.<br>
  25. Click on 99SuperCharger.sh and select "Script" from the "Open As" menu.<br>
  26. In the properties dialogue box, check "Run as root" and "Run at boot" and "Save".<br>
  27. And that's it!<br>
  28. Script Manager will load your most recent settings on boot!<br>
  29. If you run the script later and with different settings, you don't have to reconfigure anything.<br>
  30. Script Manager will just load the new /data/99SuperCharger.sh on boot automagically :)<br>
  31. <br>
  32. <b>Custom ROMs</b>: If you have a custom rom that loads /system/etc/init.d boot scripts,<br>
  33. You DON'T need to use Script Manager to load a boot script. It will all be automatic!<br>
  34. Also, if you can run boot scripts from the /system/etc/init.d folder, there are other options.<br>
  35. For example you can use an app like Terminal Emulator to run the script.<br>
  36. I've even made a special version for Terminal Emulator which has 60 colums :)<br>
  37. If your ROM has the option, <b>DISABLE "Lock Home In Memory.</b> This takes effect immediately.<br>
  38. Alternately, <u>if you need to free up extra ram</u>, you can use "Lock Home in Memory" as a "Saftey Lock".<br>
  39. ie. Use it to toggle your launcher from "Bulletproof" (0) or Hard To Kill (1) to "Weak" (2) in the event that you want to make the launcher an easy kill and free up extra ram ;)<br>
  40. <br>
  41. <b>If Settings Don't Stick:</b> If you have Auto Memory Manager, DISABLE SuperUser permissions and if you have AutoKiller Memory Optimizer, DISABLE the apply settings at boot option!<br>
  42. Also, if you have a <b>Custom ROM</b>, there might be something in the init.d folder that interferes with priorities and minfrees.<br>
  43. If you can't find the problem, a quick fix is to have Script Manager run <b>/system/etc/init.d/99SuperCharger</b> "at boot" and "as root."<br>
  44. <br>
  45. For those with a <b>Milestone</b>, I made a version for <b>Androidiani Open Recovery</b> too :D<br>
  46. Just extract the zip to the root of the sdcard (it contains the directory structure), load AOR, and there will be a SuperCharger Menu on the main screen! <br>
  47. <br>
  48. For more SuperCharging help and info,<br>
  49. See the <a href="http://forum.xda-developers.com/showthread.php?t=991276">V6 SuperCharger Thread</a><br>
  50. Feedback is Welcome!<br>
  51. <br>
  52. -=zeppelinrox=- @ <a href="http://forum.xda-developers.com/showthread.php?t=991276">XDA</a> & <a href="http://www.droidforums.net/forum/droid-hacks/148268-script-v6-supercharger-htk-bulletproof-launchers-fix-memory-all-androids.html">Droid</a> Forums<br>
  53. EOF
  54. line=================================================
  55. speed=2
  56. sleep="sleep $speed"
  57. unknown=0
  58. ran=0
  59. scminfree=
  60. sccminfree=
  61. smrun=`pgrep scriptmanager`
  62. froyo=0
  63. gb=0
  64. launcheradj=$(cat /proc/`pidof com.android.launcher`/oom_adj);homeadj=`getprop ro.HOME_APP_ADJ`;FA=`getprop ro.FOREGROUND_APP_ADJ`;PA=`getprop ro.PERCEPTIBLE_APP_ADJ`;VA=`getprop ro.VISIBLE_APP_ADJ`
  65. if [[ -z "$PA" ]]; then
  66. froyo=1
  67. else
  68. gb=1
  69. fi
  70. while :
  71. do
  72. clear
  73. echo " REMINDER: ONLY USE BUSYBOX v1.18.2 OR LOWER!!"
  74. echo ""
  75. if [[ -n "$smrun" ]]; then
  76. echo " Touch the screen to bring up soft keyboard."
  77. else
  78. echo " Try Script Manager... it's easier!"
  79. fi
  80. echo ""
  81. echo " Scrolling speed options..."
  82. echo ""
  83. echo " 0(no waiting), 1(fast), 2(normal), 3(slow)"
  84. echo ""
  85. echo -n " Please select scrolling speed (0 - 3): "
  86. read cspeed
  87. case $cspeed in
  88. 0)sleep="sleep $cspeed";break;;
  89. 1)sleep="sleep $cspeed";break;;
  90. 2)sleep="sleep $cspeed";break;;
  91. 3)sleep="sleep $cspeed";break;;
  92. *)echo ""
  93. echo " Invalid entry... Please try again :)"
  94. $sleep;;
  95. esac
  96. done
  97. if [[ -n "$launcheradj" ]] && [ "$launcheradj" -gt -20 ] 2>/dev/null; then
  98. HL="$launcheradj"
  99. else
  100. HL="$homeadj"
  101. unknown=1
  102. echo ""
  103. echo $line
  104. echo ""
  105. $sleep
  106. echo " If Home is Locked in Memory..."
  107. echo ""
  108. $sleep
  109. echo " ..confirm status via Status Checker!(Option 1)"
  110. fi
  111. $sleep
  112. if [ -f "/data/SuperChargerMinfree" ]; then
  113. cp -fr /data/SuperChargerMinfree /data/SuperChargerMinfreeOld
  114. scminfree=`cat /data/SuperChargerMinfree`
  115. fi
  116. while :
  117. echo ""
  118. do
  119. MB0=4;MB1=0;MB2=0;MB3=0;MB4=0;MB5=0;MB6=0
  120. SP1=0;SL1=0;SL2=0;SL3=0;SL4=0;SL5=0;SL6=0
  121. error=0;restore=0;rc=0;rcbu=0;UnSuperCharged=0;UnSuperChargerError=0;SuperChargerScriptManagerHelp=0;SuperChargerHelp=0
  122. rcpath="/system/etc/rootfs/init.mapphone_umts.rc"
  123. rcfile=${rcpath##*/}
  124. rcbackup="$rcpath.unsuper"
  125. if [ -e "$rcpath" ]; then
  126. rc=1
  127. fi
  128. if [ -e "$rcbackup" ]; then
  129. rcbu=1
  130. fi
  131. currentminfree=`cat /sys/module/lowmemorykiller/parameters/minfree`
  132. if [ -f "/data/SuperChargerCustomMinfree" ]; then
  133. sccminfree=`cat /data/SuperChargerCustomMinfree`
  134. fi
  135. echo $line
  136. echo "For help and info, see /sdcard/SuperCharger.html"
  137. echo $line
  138. $sleep
  139. echo "\\\\\\\\ V 6 S U P E R C H A R G E R - M E N U ////"
  140. echo " =============================================="
  141. echo " 1. SuperCharger & Launcher Status for Update 8"
  142. echo " 2. Aggressive 1 Settings {6,8,24,30,40,50 mb}"
  143. echo " 3. Aggressive 2 Settings {6,8,25,30,35,35 mb}"
  144. echo " 4. Balanced 1 Settings {6,8,24,26,28,30 mb}"
  145. echo " 5. Balanced 2 Settings {6,8,26,27,28,28 mb}"
  146. echo " 6. Balanced 3 Settings {6,8,26,28,30,32 mb}"
  147. echo " 7. MultiTasking Settings {6,8,22,24,26,26 mb}"
  148. echo " 8. MegaRAM 1 w/512mb {6,12,40,60,80,100 mb}"
  149. echo " 9. MegaRAM 2 w/512mb {6,12,75,100,125,150 mb}"
  150. echo -n "10. Cust-OOMizer"
  151. if [ -f "/data/SuperChargerCustomMinfree" ]; then
  152. awk -F , '{print " {"$1/256","$2/256","$3/256","$4/256","$5/256","$6/256 " mb}"}' /data/SuperChargerCustomMinfree
  153. else
  154. echo " Settings {Create Or Restore!}"
  155. fi
  156. echo "11. OOM Grouping Fixes + Hard To Kill Launcher"
  157. echo "12. OOM Grouping Fixes + BulletProof Launcher"
  158. echo "13. UnKernelizer - UnDo Kernel/Memory Tweaks"
  159. echo "14. UnSuperCharger"
  160. echo "15. Use V6 SuperCharger with Terminal Emulator!"
  161. echo "16. REBOOT! (WARNING - There is NO Warning!)"
  162. echo "17. Exit"
  163. echo ""
  164. echo -n " Launcher is";
  165. if [ "$HL" -gt "$VA" ]; then
  166. echo ".... so.... weak.... :("
  167. status=4
  168. elif [ "$HL" -eq "$VA" ]; then
  169. echo " Locked In Memory ie. Very Weak!"
  170. status=3
  171. elif [ "$froyo" -eq 1 ]; then
  172. if [ "$HL" -eq "$FA" ]; then
  173. echo -n " BULLETPROOF!"
  174. status=1
  175. else
  176. echo -n " HARD TO KILL!"
  177. status=2
  178. fi
  179. echo " ie. SUPERCHARGED!"
  180. else
  181. if [ "$HL" -ge "$FA" ] && [ "$HL" -lt "$PA" ]; then
  182. echo -n " BULLETPROOF!"
  183. status=1
  184. else
  185. echo -n " HARD TO KILL!"
  186. status=2
  187. fi
  188. echo " ie. SUPERCHARGED!"
  189. fi
  190. if [ "$ran" -eq 0 ]; then
  191. if [[ -n "$scminfree" ]] && [ "$currentminfree" != "$scminfree" ]; then
  192. echo " Current Values DON'T MATCH Prior SuperCharge!"
  193. elif [[ -n "$scminfree" ]] && [ "$currentminfree" == "$scminfree" ];then
  194. echo " Current Values MATCH Prior SuperCharge!"
  195. fi
  196. fi
  197. if [[ -z "$scminfree" ]]; then
  198. echo " SuperCharger Minfrees NOT FOUND! Have Fun!"
  199. fi
  200. echo ""
  201. awk -F , '{print " Current minfrees = "$1/256","$2/256","$3/256","$4/256","$5/256","$6/256 " mb"}' /sys/module/lowmemorykiller/parameters/minfree
  202. if [ -f "/data/SuperChargerMinfreeOld" ]; then
  203. awk -F , '{print " Prior V6 minfrees = "$1/256","$2/256","$3/256","$4/256","$5/256","$6/256 " mb"}' /data/SuperChargerMinfreeOld
  204. fi
  205. echo ""
  206. echo " Slot 3 Sets Free RAM & is your New Task Killer!"
  207. echo " Lag? Disable Lock Home in Memory & Compcache!"
  208. echo ""
  209. if [[ -n "$smrun" ]]; then
  210. echo " In Config, select Run as Root & Browse as Root!"
  211. echo " But DO NOT run this script at boot!"
  212. echo " For a quick status check..."
  213. echo " ...put a V6 SuperCharger WIDGET on the desktop!"
  214. else
  215. echo " Optimized for display with Script Manager."
  216. echo ""
  217. echo " SM can give you a quick status check..."
  218. echo " ...Put a V6 SuperCharger WIDGET on the desktop!"
  219. echo " ...Try it! :)"
  220. echo ""
  221. fi
  222. echo ""
  223. echo -n " Please enter option [1 - 17]: "
  224. read opt
  225. echo ""
  226. $sleep
  227. if [ "$opt" -ne 17 ] 2>/dev/null; then
  228. mount -o remount,rw /system 2>/dev/null
  229. for m in /dev/block/mtdblock*
  230. do
  231. mount -o remount,rw $m /system 2>/dev/null
  232. done
  233. fi
  234. echo $line
  235. echo " \\\\\\\\ V6 SUPERCHARGER ////"
  236. echo " ======================="
  237. echo ""
  238. $sleep
  239. case $opt in
  240. 1) echo " V6 SUPERCHARGER AND LAUNCHER STATUS!";;
  241. 2) echo " AGGRESSIVE 1 + HARD TO KILL LAUNCHER!"
  242. CONFIG="Aggressive 1"
  243. MB1=6;MB2=8;MB3=24;MB4=30;MB5=40;MB6=50;;
  244. 3) echo " AGGRESSIVE 2 + HARD TO KILL LAUNCHER!"
  245. CONFIG="Aggressive 2"
  246. MB1=6;MB2=8;MB3=25;MB4=30;MB5=35;MB6=35;;
  247. 4) echo " BALANCED 1 + HARD TO KILL LAUNCHER!"
  248. CONFIG="Balanced 1"
  249. MB1=6;MB2=8;MB3=24;MB4=26;MB5=28;MB6=30;;
  250. 5) echo " BALANCED 2 + HARD TO KILL LAUNCHER!"
  251. CONFIG="Balanced 2"
  252. MB1=6;MB2=8;MB3=26;MB4=27;MB5=28;MB6=28;;
  253. 6) echo " BALANCED 3 + HARD TO KILL LAUNCHER!"
  254. CONFIG="Balanced 3"
  255. MB1=6;MB2=8;MB3=26;MB4=28;MB5=30;MB6=32;;
  256. 7) echo " MULTITASKING + HARD TO KILL LAUNCHER!"
  257. CONFIG="MultiTasking"
  258. MB1=6;MB2=8;MB3=22;MB4=24;MB5=26;MB6=26;;
  259. 8) echo " MEGA RAM 1 + HARD TO KILL LAUNCHER!"
  260. CONFIG="MegaRAM 1"
  261. MB1=6;MB2=12;MB3=40;MB4=60;MB5=80;MB6=100;;
  262. 9) echo " MEGA RAM 2 + HARD TO KILL LAUNCHER!"
  263. CONFIG="MegaRAM 2"
  264. MB1=6;MB2=12;MB3=75;MB4=100;MB5=125;MB6=150;;
  265. 10)echo " CUST-OOMIZER + HARD TO KILL LAUNCHER!"
  266. CONFIG="CUST-OOMIZED"
  267. if [ -f "/data/SuperChargerCustomMinfree" ]; then
  268. echo $line
  269. echo ""
  270. $sleep
  271. echo " Your Prior CUST-OOMIZED values are..."
  272. echo ""
  273. $sleep
  274. awk -F , '{print " "$1/256",",$2/256",",$3/256",",$4/256",",$5/256",",$6/256 " mb"}' /data/SuperChargerCustomMinfree
  275. echo ""
  276. $sleep
  277. echo " Your Current Minfree values are..."
  278. echo ""
  279. $sleep
  280. awk -F , '{print " "$1/256",",$2/256",",$3/256",",$4/256",",$5/256",",$6/256 " mb"}' /sys/module/lowmemorykiller/parameters/minfree
  281. echo ""
  282. $sleep
  283. if [ "$currentminfree" == "$sccminfree" ]; then
  284. echo " Even though they are the same..."
  285. echo ""
  286. $sleep
  287. fi
  288. echo -n " Restore Previous CUST-OOMIZED settings"
  289. if [ "$currentminfree" == "$sccminfree" ]; then
  290. echo " anyway?"
  291. else
  292. echo "?"
  293. fi
  294. echo ""
  295. $sleep
  296. echo -n " Enter Y for Yes, any key for No: "
  297. read crestore
  298. echo ""
  299. echo $line
  300. case $crestore in
  301. y|Y)restore=1
  302. MB1=`awk -F , '{print $1/256}' /data/SuperChargerCustomMinfree`;MB2=`awk -F , '{print $2/256}' /data/SuperChargerCustomMinfree`;MB3=`awk -F , '{print $3/256}' /data/SuperChargerCustomMinfree`;MB4=`awk -F , '{print $4/256}' /data/SuperChargerCustomMinfree`;MB5=`awk -F , '{print $5/256}' /data/SuperChargerCustomMinfree`;MB6=`awk -F , '{print $6/256}' /data/SuperChargerCustomMinfree`;
  303. echo " Cust-OOMized Settings will be Restored!";;
  304. *)echo " Running CUST-OOMIZER...";;
  305. esac
  306. fi
  307. if [ "$restore" -eq 0 ] 2>/dev/null; then
  308. echo $line
  309. echo ""
  310. $sleep
  311. echo " Enter your desired lowmemorykiller OOM levels!"
  312. echo ""
  313. $sleep
  314. echo " Slot 3 determines your fee ram the most!!"
  315. echo ""
  316. $sleep
  317. echo " To restart, enter a letter to go to main menu."
  318. echo ""
  319. $sleep
  320. echo -n " Slot 1: ";read MB1
  321. if [ "$MB1" -gt 0 ] 2>/dev/null; then
  322. echo -n " Slot 2: ";read MB2
  323. if [ "$MB2" -gt 0 ] 2>/dev/null; then
  324. echo -n " Slot 3: ";read MB3
  325. if [ "$MB3" -gt 0 ] 2>/dev/null; then
  326. echo -n " Slot 4: ";read MB4
  327. if [ "$MB4" -gt 0 ] 2>/dev/null; then
  328. echo -n " Slot 5: ";read MB5
  329. if [ "$MB5" -gt 0 ] 2>/dev/null; then
  330. echo -n " Slot 6: ";read MB6
  331. if [ "$MB6" -gt 0 ] 2>/dev/null; then
  332. echo ""
  333. echo $line
  334. echo " Cust-OOMized Settings Accepted!"
  335. else
  336. error=1
  337. fi
  338. else
  339. error=1
  340. fi
  341. else
  342. error=1
  343. fi
  344. else
  345. error=1
  346. fi
  347. else
  348. error=1
  349. fi
  350. else
  351. error=1
  352. fi
  353. fi;;
  354. 11)echo " OOM GROUPING FIXES PLUS..."
  355. echo ""
  356. echo " ...HARD TO KILL LAUNCHER!";;
  357. 12)echo " OOM GROUPING FIXES PLUS..."
  358. echo ""
  359. echo " ...BULLETPROOF LAUNCHER!";;
  360. 13)echo " ===================="
  361. echo " //// UNKERNELIZER \\\\\\\\"
  362. if [ ! -f "/system/etc/init.d/99SuperCharger" ] && [ ! -f "/data/99SuperCharger.sh" ] && [ "$rc" -ne 1 ]; then
  363. echo $line
  364. echo ""
  365. $sleep
  366. echo " There's Nothing to UnKernelize!"
  367. echo ""
  368. opt=0
  369. fi;;
  370. 14)echo " ======================"
  371. echo " //// UNSUPERCHARGER \\\\\\\\"
  372. echo $line
  373. echo ""
  374. $sleep
  375. echo " WHAT? UnSuperCharge? Are you sure?"
  376. echo ""
  377. $sleep
  378. echo -n " Enter Y for Yes, any key for No: "
  379. read unsuper
  380. echo ""
  381. echo $line
  382. case $unsuper in
  383. y|Y)echo " Well... okay then... be like that! :p";;
  384. *)echo " False alarm... *whew*"
  385. opt=0;;
  386. esac;;
  387. 15)echo " ======================"
  388. echo " //// SYSTEM INSTALL \\\\\\\\";;
  389. 16)echo " !!POOF!!"
  390. $sleep
  391. reboot;;
  392. 17)echo " Did you find this useful? Feedback is welcome!";;
  393. *) echo " #!*@%$*?%@&)&*#!*?(*)(*)&(!)%#!&?@#$*%&?&$%$*#?!"
  394. echo ""
  395. sleep 2
  396. echo " oops.. typo?! $opt is an Invalid Option!"
  397. echo ""
  398. sleep 2
  399. echo " 1 <= Valid Option => 17 !!";
  400. echo ""
  401. sleep 2
  402. echo -n " hehe... Press Enter key to continue... ;) ";
  403. read enterKey
  404. echo ""
  405. opt=0;;
  406. esac
  407. echo $line
  408. echo ""
  409. $sleep
  410. if [ "$error" -eq 1 ]; then
  411. echo " Input Error! Try again :)"
  412. sleep 2
  413. elif [ "$opt" -eq 1 ]; then
  414. echo " Out Of Memory (OOM) / lowmemorykiller values:"
  415. echo ""
  416. $sleep
  417. echo " "$currentminfree pages
  418. echo ""
  419. $sleep
  420. awk -F , '{print " Which means: "$1/256",",$2/256",",$3/256",",$4/256",",$5/256",",$6/256 " mb"}' /sys/module/lowmemorykiller/parameters/minfree
  421. echo ""
  422. echo $line
  423. echo ""
  424. $sleep
  425. if [ "$unknown" -eq 1 ]; then
  426. echo " Is Home is Locked in Memory?"
  427. echo ""
  428. $sleep
  429. echo -n " If it is, Enter Y for Yes, any key for No: "
  430. read homelocked
  431. echo ""
  432. echo $line
  433. echo ""
  434. $sleep
  435. case $homelocked in
  436. y|Y)unknown=0
  437. HL="$VA"
  438. if [ "$HL" -gt "$VA" ]; then
  439. status=4
  440. elif [ "$HL" -eq "$VA" ]; then
  441. status=3
  442. elif [ "$froyo" -eq 1 ]; then
  443. if [ "$HL" -eq "$FA" ]; then
  444. status=1
  445. else
  446. status=2
  447. fi
  448. else
  449. if [ "$HL" -ge "$FA" ] && [ "$HL" -lt "$PA" ]; then
  450. status=1
  451. else
  452. status=2
  453. fi
  454. fi;;
  455. *)unknown=0;;
  456. esac
  457. fi
  458. echo " Home Launcher Priority is: $HL"
  459. echo ""
  460. $sleep
  461. echo " Foreground App Priority is: $FA"
  462. echo ""
  463. $sleep
  464. if [ "$gb" -eq 1 ]; then
  465. echo " Perceptible App Priority is: $PA"
  466. echo ""
  467. $sleep
  468. fi
  469. echo " Visible App Priority is: $VA"
  470. echo ""
  471. echo $line
  472. echo ""
  473. $sleep
  474. if [ "$status" -eq 4 ]; then
  475. echo " Launcher is greater than Visible App..."
  476. echo ""
  477. $sleep
  478. echo $line
  479. echo " Wow, that's one weak ass launcher! :("
  480. elif [ "$status" -eq 3 ]; then
  481. echo " Launcher is equal to Visible App..."
  482. echo ""
  483. $sleep
  484. echo " ...Home Launcher is Locked In Memory!"
  485. echo ""
  486. $sleep
  487. echo $line
  488. echo " meh... that's still pretty weak! :P"
  489. elif [ "$status" -eq 1 ]; then
  490. if [ "$froyo" -eq 1 ]; then
  491. echo " Launcher is equal to Foreground App..."
  492. else
  493. echo " Launcher is greater than Foreground App..."
  494. echo ""
  495. $sleep
  496. echo " ...is less than Perceptible App..."
  497. fi
  498. echo ""
  499. $sleep
  500. echo " ...and is less than Visible App..."
  501. echo ""
  502. $sleep
  503. echo $line
  504. echo " Home Launcher is BULLETPROOF!"
  505. else
  506. echo " Launcher is greater than Foreground App..."
  507. echo ""
  508. $sleep
  509. if [ "$gb" -eq 1 ]; then
  510. echo " ...is equal to Perceptible App..."
  511. echo ""
  512. $sleep
  513. fi
  514. echo " ...and is less than Visible App..."
  515. echo ""
  516. $sleep
  517. echo $line
  518. echo " Home Launcher is very HARD TO KILL!"
  519. fi
  520. echo $line
  521. echo ""
  522. $sleep
  523. echo " SuperCharger and Launcher Status..."
  524. echo ""
  525. $sleep
  526. echo " ...by -=zeppelinrox=- @ XDA & Droid Forums"
  527. sleep 2
  528. else
  529. if [ "$opt" -ge 2 ] && [ "$opt" -le 14 ]; then
  530. if [ "$opt" -le 10 ]; then
  531. SP1=$(($MB0*256));SL1=$(($MB1*256));SL2=$(($MB2*256));SL3=$(($MB3*256));SL4=$(($MB4*256));SL5=$(($MB5*256));SL6=$(($MB6*256))
  532. echo " zoom... zoom..."
  533. echo ""
  534. $sleep
  535. fi
  536. if [ "$opt" -le 12 ]; then
  537. echo "============= Information Section ============"
  538. echo " ======================="
  539. echo ""
  540. $sleep
  541. fi
  542. if [ "$opt" -ne 13 ]; then
  543. if [ -f "/sdcard/UnSuperCharged.html" ]; then
  544. rm /sdcard/UnSuperCharged.html
  545. fi
  546. if [ -f "/sdcard/UnSuperChargerError.html" ]; then
  547. rm /sdcard/UnSuperChargerError.html
  548. fi
  549. if [ -f "/sdcard/SuperChargerScriptManagerHelp.html" ]; then
  550. rm /sdcard/SuperChargerScriptManagerHelp.html
  551. fi
  552. if [ -f "/sdcard/SuperChargerHelp.html" ]; then
  553. rm /sdcard/SuperChargerHelp.html
  554. fi
  555. if [ -f "/data/local/userinit.sh" ]; then
  556. sed -i '/.*99SuperCharger/d' /data/local/userinit.sh
  557. fi
  558. if [ -f "/data/local.prop" ]; then
  559. sed -i '/.*_ADJ/d' /data/local.prop
  560. fi
  561. fi
  562. if [ "$opt" -le 13 ] && [ "$rc" -eq 1 ]; then
  563. echo " Found "$rcpath
  564. echo ""
  565. $sleep
  566. if [ "$opt" -eq 11 ] || [ "$opt" -eq 12 ]; then
  567. echo " $rcfile will be OOM Fixed!"
  568. elif [ "$opt" -eq 13 ]; then
  569. echo " $rcfile to be UnKernelized!"
  570. else
  571. echo " $rcfile to be SuperCharged!"
  572. fi
  573. echo ""
  574. $sleep
  575. if [ "$rcbu" -eq 1 ]; then
  576. echo " Backup already exists... leaving backup intact"
  577. else
  578. cp -r $rcpath $rcbackup
  579. echo " Backing up ORIGINAL settings..."
  580. fi
  581. echo ""
  582. $sleep
  583. fi
  584. if [ "$opt" -eq 14 ]; then
  585. echo " UNSUPERCHARGE..."
  586. echo ""
  587. sleep 1
  588. echo " ...UNFIX OOM GROUPINGS..."
  589. echo ""
  590. sleep 1
  591. echo " ...RESTORE WEAK ASS LAUNCHER"
  592. echo ""
  593. echo $line
  594. echo ""
  595. $sleep
  596. echo " UnSuperCharging Performance...."
  597. echo ""
  598. $sleep
  599. scminfree=
  600. sccminfree=
  601. if [ ! -f "/system/etc/init.d/99SuperCharger" ] && [ ! -f "/data/99SuperCharger.sh" ] && [ "$rc" -ne 1 ] && [ "$rcbu" -ne 1 ]; then
  602. echo " I Got Nothing To Do! Try SuperCharging first!"
  603. echo ""
  604. $sleep
  605. UnSuperCharged=1
  606. cat > /sdcard/UnSuperCharged.html <<EOF
  607. There was nothing to uninstall!<br>
  608. <br>
  609. For more SuperCharging help and info,<br>
  610. See the <a href="http://forum.xda-developers.com/showthread.php?t=991276">V6 SuperCharger Thread</a><br>
  611. Feedback is Welcome!<br>
  612. <br>
  613. -=zeppelinrox=- @ <a href="http://forum.xda-developers.com/showthread.php?t=991276">XDA</a> & <a href="http://www.droidforums.net/forum/droid-hacks/148268-script-v6-supercharger-htk-bulletproof-launchers-fix-memory-all-androids.html">Droid</a> Forums<br>
  614. EOF
  615. echo $line
  616. echo " See /sdcard/UnSuperCharged.html for assistance!"
  617. echo $line
  618. echo ""
  619. $sleep
  620. fi
  621. if [ "$rcbu" -eq 1 ]; then
  622. echo " BACKUP FOUND!"
  623. echo ""
  624. $sleep
  625. echo " Restore"$rcpath
  626. echo ""
  627. $sleep
  628. cp -fr $rcbackup $rcpath
  629. rm $rcbackup
  630. elif [ "$rc" -eq 1 ]; then
  631. echo " ERROR... ERROR... ERROR... ERROR..."
  632. echo ""
  633. $sleep
  634. echo " BACKUP NOT FOUND!"
  635. echo ""
  636. $sleep
  637. echo "CAN'T restore your ROM's default minfree values!"
  638. echo ""
  639. sleep 3
  640. UnSuperChargerError=1
  641. cat > /sdcard/UnSuperChargerError.html <<EOF
  642. The backup file, $rcbackup, WAS NOT found!<br>
  643. Please do a manual restore of $rcfile from your ROM's update file!<br>
  644. <br>
  645. For more SuperCharging help and info,<br>
  646. See the <a href="http://forum.xda-developers.com/showthread.php?t=991276">V6 SuperCharger Thread</a><br>
  647. Feedback is Welcome!<br>
  648. <br>
  649. -=zeppelinrox=- @ <a href="http://forum.xda-developers.com/showthread.php?t=991276">XDA</a> & <a href="http://www.droidforums.net/forum/droid-hacks/148268-script-v6-supercharger-htk-bulletproof-launchers-fix-memory-all-androids.html">Droid</a> Forums<br>
  650. EOF
  651. echo $line
  652. echo " See /sdcard/UnSuperChargerError.html for help!"
  653. echo $line
  654. echo ""
  655. sleep 4
  656. echo " Clean "$rcpath
  657. echo ""
  658. sed -i '/.*_ADJ/d' $rcpath
  659. sed -i '/parameters\/adj/d' $rcpath
  660. sed -i '/vm\/.*oom.*/d' $rcpath
  661. sed -i '/kernel\/panic.*/d' $rcpath
  662. $sleep
  663. fi
  664. fi
  665. if [ "$opt" -le 10 ] || [ "$opt" -eq 14 ]; then
  666. if [ -f "/data/local.prop" ]; then
  667. sed -i '/.*_MEM/d' /data/local.prop
  668. fi
  669. fi
  670. if [ "$opt" -ne 13 ]; then
  671. if [ -f "/system/etc/init.d/99SuperCharger" ]; then
  672. if [ "$opt" -ne 11 ] && [ "$opt" -ne 12 ]; then
  673. echo " Cleaning Up SuperCharge from /init.d folder"
  674. echo ""
  675. $sleep
  676. fi
  677. echo " Cleaning Up Grouping Fixes from /init.d folder"
  678. echo ""
  679. rm /system/etc/init.d/99SuperCharger
  680. $sleep
  681. fi
  682. if [ -f "/data/99SuperCharger.sh" ]; then
  683. if [ "$opt" -ne 11 ] && [ "$opt" -ne 12 ]; then
  684. echo " Cleaning Up SuperCharge from /data folder"
  685. echo ""
  686. $sleep
  687. fi
  688. echo " Cleaning Up Grouping Fixes from /data folder"
  689. echo ""
  690. rm /data/99SuperCharger.sh
  691. $sleep
  692. fi
  693. fi
  694. if [ "$opt" -eq 14 ]; then
  695. if [ -f "/data/SuperChargerAdj" ]; then
  696. rm /data/SuperChargerAdj
  697. fi
  698. if [ -f "/data/SuperChargerMinfree" ]; then
  699. rm /data/SuperChargerMinfree
  700. fi
  701. if [ -f "/data/SuperChargerMinfreeOld" ]; then
  702. rm /data/SuperChargerMinfreeOld
  703. fi
  704. if [ -f "/data/SuperChargerCustomMinfree" ]; then
  705. rm /data/SuperChargerCustomMinfree
  706. fi
  707. if [ "$UnSuperCharged" -ne 1 ]; then
  708. echo " Removed Kernel/Memory Tweaks..."
  709. echo ""
  710. $sleep
  711. if [ "$UnSuperChargerError" -ne 1 ]; then
  712. echo " Your ROM's default minfree values are restored!"
  713. echo ""
  714. $sleep
  715. fi
  716. echo " Out Of Memory (OOM) Groupings UnFixed..."
  717. echo ""
  718. $sleep
  719. echo " ...OOM Priorities UnFixed..."
  720. echo ""
  721. $sleep
  722. echo " Weak Ass Launcher Restored :("
  723. echo ""
  724. $sleep
  725. echo " UnSuperCharging Complete..."
  726. echo ""
  727. echo $line
  728. echo ""
  729. $sleep
  730. echo " REBOOT NOW..."
  731. echo ""
  732. $sleep
  733. echo " ...FOR UNSUPERCHARGE TO TAKE EFFECT!"
  734. echo ""
  735. echo $line
  736. echo ""
  737. $sleep
  738. fi
  739. echo " UnSuperCharging..."
  740. echo ""
  741. $sleep
  742. echo " ...by -=zeppelinrox=- @ XDA & Droid Forums"
  743. sleep 2
  744. fi
  745. if [ "$opt" -le 13 ]; then
  746. if [ "$opt" -eq 13 ]; then
  747. echo " Removing Kernel/Memory Tweaks..."
  748. echo ""
  749. $sleep
  750. fi
  751. if [ "$rc" -eq 1 ]; then
  752. if [ "$opt" -ne 13 ]; then
  753. sed -i '/.*_ADJ/d' $rcpath
  754. fi
  755. if [ "$opt" -eq 11 ] || [ "$opt" -eq 12 ]; then
  756. sed -i '/parameters\/adj/d' $rcpath
  757. fi
  758. if [ "$opt" -le 10 ]; then
  759. sed -i '/.*_MEM/d' $rcpath
  760. sed -i '/lowmemorykiller/d' $rcpath
  761. fi
  762. sed -i '/vm\/.*oom.*/d' $rcpath
  763. sed -i '/kernel\/panic.*/d' $rcpath
  764. fi
  765. if [ -f "/system/etc/init.d/99SuperCharger" ]; then
  766. sed -i '/.*oom.*/d' /system/etc/init.d/99SuperCharger
  767. sed -i '/.*panic.*/d' /system/etc/init.d/99SuperCharger
  768. fi
  769. if [ -f "/data/99SuperCharger.sh" ]; then
  770. sed -i '/.*oom.*/d' /data/99SuperCharger.sh
  771. sed -i '/.*panic.*/d' /data/99SuperCharger.sh
  772. fi
  773. if [ "$opt" -eq 13 ]; then
  774. echo " ...Kernel/Memory Tweaks Removed!"
  775. $sleep
  776. fi
  777. fi
  778. if [ "$opt" -le 12 ]; then
  779. echo "0,3,5,7,14,15" > /data/SuperChargerAdj
  780. scadj=`cat /data/SuperChargerAdj`
  781. adj1=`awk -F , '{print $1}' /data/SuperChargerAdj`;adj2=`awk -F , '{print $2}' /data/SuperChargerAdj`;adj3=`awk -F , '{print $3}' /data/SuperChargerAdj`;adj4=`awk -F , '{print $4}' /data/SuperChargerAdj`;adj5=`awk -F , '{print $5}' /data/SuperChargerAdj`;adj6=`awk -F , '{print $6}' /data/SuperChargerAdj`
  782. if [ "$opt" -le 10 ]; then
  783. if [ -f "/data/SuperChargerMinfree" ]; then
  784. cp -fr /data/SuperChargerMinfree /data/SuperChargerMinfreeOld
  785. fi
  786. echo "$SL1,$SL2,$SL3,$SL4,$SL5,$SL6" > /data/SuperChargerMinfree
  787. scminfree=`cat /data/SuperChargerMinfree`
  788. if [ "$opt" -eq 10 ]; then
  789. if [ "$restore" -eq 1 ]; then
  790. echo " Restoring Prior CUST-OOMIZED Settings!"
  791. else
  792. if [ -f "/data/SuperChargerCustomMinfree" ]; then
  793. echo " Removing Prior Cust-OOMized Settings..."
  794. echo ""
  795. $sleep
  796. fi
  797. echo " Backing Up Your New CUST-OOMIZED Settings!"
  798. fi
  799. cp -fr /data/SuperChargerMinfree /data/SuperChargerCustomMinfree
  800. echo ""
  801. $sleep
  802. fi
  803. fi
  804. echo $line
  805. if [ "$opt" -le 10 ]; then
  806. echo " SuperCharging Performance: $CONFIG!"
  807. echo $line
  808. echo ""
  809. $sleep
  810. echo " Out Of Memory (OOM) / lowmemorykiller values:"
  811. echo ""
  812. $sleep
  813. awk -F , '{print " Old MB = "$1/256",",$2/256",",$3/256",",$4/256",",$5/256",",$6/256 " mb"}' /sys/module/lowmemorykiller/parameters/minfree
  814. echo " New MB = $MB1, $MB2, $MB3, $MB4, $MB5, $MB6 mb"
  815. echo ""
  816. $sleep
  817. echo " Old Pages = "$currentminfree
  818. echo " New Pages = $scminfree"
  819. fi
  820. echo ""
  821. $sleep
  822. echo " Fixing Out Of Memory (OOM) Groupings..."
  823. echo ""
  824. $sleep
  825. if [ "$rc" -eq 1 ]; then
  826. sed -i '/on boot/ a\
  827. write /sys/module/lowmemorykiller/parameters/adj '$scadj $rcpath
  828. echo " ...Fixing OOM Priorities..."
  829. echo ""
  830. $sleep
  831. sed -i '/on early/ a\
  832. setprop ro.FOREGROUND_APP_ADJ '$adj1 $rcpath
  833. sed -i '/ro.FOREGROUND_APP_ADJ/ a\
  834. setprop ro.VISIBLE_APP_ADJ '$adj2 $rcpath
  835. sed -i '/ro.VISIBLE_APP_ADJ/ a\
  836. setprop ro.SECONDARY_SERVER_ADJ '$adj3 $rcpath
  837. sed -i '/ro.SECONDARY_SERVER_ADJ/ a\
  838. setprop ro.BACKUP_APP_ADJ '$(($adj4-1)) $rcpath
  839. sed -i '/ro.BACKUP_APP_ADJ/ a\
  840. setprop ro.HOME_APP_ADJ '$adj2 $rcpath
  841. sed -i '/ro.HOME_APP_ADJ/ a\
  842. setprop ro.HIDDEN_APP_MIN_ADJ '$adj4 $rcpath
  843. sed -i '/ro.HIDDEN_APP_MIN_ADJ/ a\
  844. setprop ro.EMPTY_APP_ADJ '$adj6 $rcpath
  845. if [ "$gb" -eq 1 ]; then
  846. sed -i '/ro.VISIBLE_APP_ADJ/ a\
  847. setprop ro.PERCEPTIBLE_APP_ADJ '$(($adj2-1)) $rcpath
  848. sed -i '/ro.PERCEPTIBLE_APP_ADJ/ a\
  849. setprop ro.HEAVY_WEIGHT_APP_ADJ '$(($adj3-1)) $rcpath
  850. else
  851. sed -i '/ro.HIDDEN_APP_MIN_ADJ/ a\
  852. setprop ro.CONTENT_PROVIDER_ADJ '$(($adj5-6)) $rcpath
  853. fi
  854. echo " ...OOM Groupings and Priorities are now fixed!"
  855. echo ""
  856. $sleep
  857. if [ "$opt" -eq 12 ]; then
  858. echo " Applying BulletProof Launcher..."
  859. echo ""
  860. $sleep
  861. if [ "$froyo" -eq 1 ]; then
  862. sed -i 's/.* ro.HOME_APP_ADJ .*/ setprop ro.HOME_APP_ADJ '$adj1/ $rcpath
  863. else
  864. sed -i 's/.* ro.HOME_APP_ADJ .*/ setprop ro.HOME_APP_ADJ '$(($adj2-2))/ $rcpath
  865. fi
  866. echo " Launcher is no Longer Hard To Kill..."
  867. echo ""
  868. $sleep
  869. echo " ...It's BULLETPROOF!"
  870. else
  871. echo " Applying Hard To Kill Launcher..."
  872. echo ""
  873. $sleep
  874. if [ "$froyo" -eq 1 ]; then
  875. sed -i 's/.* ro.HOME_APP_ADJ .*/ setprop ro.HOME_APP_ADJ '$(($adj2-2))/ $rcpath
  876. else
  877. sed -i 's/.* ro.HOME_APP_ADJ .*/ setprop ro.HOME_APP_ADJ '$(($adj2-1))/ $rcpath
  878. fi
  879. echo " ...Hard To Kill Launcher APPLIED!"
  880. fi
  881. echo ""
  882. $sleep
  883. if [ "$opt" -le 10 ]; then
  884. sed -i '/lowmemorykiller/ a\
  885. write /sys/module/lowmemorykiller/parameters/minfree '$scminfree $rcpath
  886. sed -i '/ro.EMPTY_APP_ADJ/ a\
  887. setprop ro.FOREGROUND_APP_MEM '$SL1 $rcpath
  888. sed -i '/ro.FOREGROUND_APP_MEM/ a\
  889. setprop ro.VISIBLE_APP_MEM '$SL2 $rcpath
  890. sed -i '/ro.VISIBLE_APP_MEM/ a\
  891. setprop ro.SECONDARY_SERVER_MEM '$SL3 $rcpath
  892. sed -i '/ro.SECONDARY_SERVER_MEM/ a\
  893. setprop ro.BACKUP_APP_MEM '$SL4 $rcpath
  894. sed -i '/ro.BACKUP_APP_MEM/ a\
  895. setprop ro.HOME_APP_MEM '$SP1 $rcpath
  896. sed -i '/ro.HOME_APP_MEM/ a\
  897. setprop ro.HIDDEN_APP_MEM '$SL4 $rcpath
  898. sed -i '/ro.HIDDEN_APP_MEM/ a\
  899. setprop ro.EMPTY_APP_MEM '$SL6 $rcpath
  900. if [ "$gb" -eq 1 ]; then
  901. sed -i '/ro.VISIBLE_APP_MEM/ a\
  902. setprop ro.PERCEPTIBLE_APP_MEM '$SP1 $rcpath
  903. sed -i '/ro.PERCEPTIBLE_APP_MEM/ a\
  904. setprop ro.HEAVY_WEIGHT_APP_MEM '$SL3 $rcpath
  905. else
  906. sed -i '/ro.HIDDEN_APP_MEM/ a\
  907. setprop ro.CONTENT_PROVIDER_MEM '$SL5 $rcpath
  908. fi
  909. fi
  910. echo " Applying Kernel/Memory Tweaks..."
  911. echo ""
  912. $sleep
  913. echo " oom_kill_allocating_task = 0"
  914. echo " panic_on_oom = 0"
  915. echo " panic_on_oops = 1"
  916. echo " panic = 0"
  917. echo ""
  918. $sleep
  919. sed -i '/minfree/ a\
  920. write /proc/sys/vm/oom_kill_allocating_task 0' $rcpath
  921. sed -i '/oom_kill_allocating_task/ a\
  922. write /proc/sys/vm/panic_on_oom 0' $rcpath
  923. sed -i '/panic_on_oom/ a\
  924. write /proc/sys/kernel/panic_on_oops 1' $rcpath
  925. sed -i '/panic_on_oops/ a\
  926. write /proc/sys/kernel/panic 0' $rcpath
  927. else
  928. echo " ...Fixing OOM Priorities..."
  929. echo ""
  930. $sleep
  931. echo "ro.FOREGROUND_APP_ADJ=$adj1" >> /data/local.prop
  932. echo "ro.VISIBLE_APP_ADJ=$adj2" >> /data/local.prop
  933. if [ "$gb" -eq 1 ]; then
  934. echo "ro.PERCEPTIBLE_APP_ADJ=$(($adj2-1))" >> /data/local.prop
  935. echo "ro.HEAVY_WEIGHT_APP_ADJ=$(($adj3-1))" >> /data/local.prop
  936. fi
  937. echo "ro.SECONDARY_SERVER_ADJ=$adj3" >> /data/local.prop
  938. echo "ro.BACKUP_APP_ADJ=$(($adj4-1))" >> /data/local.prop
  939. echo "ro.HOME_APP_ADJ=$adj2" >> /data/local.prop
  940. echo "ro.HIDDEN_APP_MIN_ADJ=$adj4" >> /data/local.prop
  941. if [ "$froyo" -eq 1 ]; then
  942. echo "ro.CONTENT_PROVIDER_ADJ=$(($adj5-6))" >> /data/local.prop
  943. fi
  944. echo "ro.EMPTY_APP_ADJ=$adj6" >> /data/local.prop
  945. echo " ...OOM Groupings and Priorities are now fixed!"
  946. echo ""
  947. $sleep
  948. if [ "$opt" -eq 12 ]; then
  949. echo " Applying BulletProof Launcher..."
  950. echo ""
  951. $sleep
  952. if [ "$froyo" -eq 1 ]; then
  953. sed -i 's/ro.HOME_APP_ADJ=.*/ro.HOME_APP_ADJ='$adj1/ /data/local.prop
  954. else
  955. sed -i 's/ro.HOME_APP_ADJ=.*/ro.HOME_APP_ADJ='$(($adj2-2))/ /data/local.prop
  956. fi
  957. echo " Launcher is no Longer Hard To Kill..."
  958. echo ""
  959. $sleep
  960. echo " ...It's BULLETPROOF!"
  961. else
  962. echo " Applying Hard To Kill Launcher..."
  963. echo ""
  964. $sleep
  965. if [ "$froyo" -eq 1 ]; then
  966. sed -i 's/ro.HOME_APP_ADJ=.*/ro.HOME_APP_ADJ='$(($adj2-2))/ /data/local.prop
  967. else
  968. sed -i 's/ro.HOME_APP_ADJ=.*/ro.HOME_APP_ADJ='$(($adj2-1))/ /data/local.prop
  969. fi
  970. echo " ...Hard To Kill Launcher APPLIED!"
  971. fi
  972. echo ""
  973. $sleep
  974. if [ "$opt" -le 10 ]; then
  975. echo "ro.FOREGROUND_APP_MEM=$SL1" >> /data/local.prop
  976. echo "ro.VISIBLE_APP_MEM=$SL2" >> /data/local.prop
  977. if [ "$gb" -eq 1 ]; then
  978. echo "ro.PERCEPTIBLE_APP_MEM=$SP1" >> /data/local.prop
  979. echo "ro.HEAVY_WEIGHT_APP_MEM=$SL3" >> /data/local.prop
  980. fi
  981. echo "ro.SECONDARY_SERVER_MEM=$SL3" >> /data/local.prop
  982. echo "ro.BACKUP_APP_MEM=$SL4" >> /data/local.prop
  983. echo "ro.HOME_APP_MEM=$SP1" >> /data/local.prop
  984. echo "ro.HIDDEN_APP_MEM=$SL4" >> /data/local.prop
  985. if [ "$froyo" -eq 1 ]; then
  986. echo "ro.CONTENT_PROVIDER_MEM=$SL5" >> /data/local.prop
  987. fi
  988. echo "ro.EMPTY_APP_MEM=$SL6" >> /data/local.prop
  989. fi
  990. echo " Applying Kernel/Memory Tweaks..."
  991. echo ""
  992. $sleep
  993. echo " oom_kill_allocating_task = 0"
  994. echo " panic_on_oom = 0"
  995. echo " panic_on_oops = 1"
  996. echo " panic = 0"
  997. echo ""
  998. $sleep
  999. cat > /data/99SuperCharger.sh <<EOF
  1000. #!/system/bin/sh
  1001. # V6 SuperCharger, OOM Grouping & Priority Fixes created by zeppelinrox.
  1002. execute=0;
  1003. currentadj=\`cat /sys/module/lowmemorykiller/parameters/adj\`;
  1004. currentminfree=\`cat /sys/module/lowmemorykiller/parameters/minfree\`;
  1005. scadj=\`cat /data/SuperChargerAdj\`;
  1006. scminfree=\`cat /data/SuperChargerMinfree\`;
  1007. if [ "\$currentadj" != "\$scadj" ]; then
  1008. execute=1;
  1009. elif [[ -n "\$scminfree" ]] && [ "\$currentminfree" != "\$scminfree" ]; then
  1010. execute=1;
  1011. fi;
  1012. if [ "\$execute" -eq 1 ]; then
  1013. echo \$scadj > /sys/module/lowmemorykiller/parameters/adj;
  1014. EOF
  1015. if [ -f "/data/SuperChargerMinfree" ]; then
  1016. echo " echo "\$scminfree" > /sys/module/lowmemorykiller/parameters/minfree;" >> /data/99SuperCharger.sh
  1017. fi
  1018. cat >> /data/99SuperCharger.sh <<EOF
  1019. echo "0" > /proc/sys/vm/oom_kill_allocating_task;
  1020. echo "0" > /proc/sys/vm/panic_on_oom;
  1021. busybox sysctl -w kernel.panic_on_oops=1;
  1022. busybox sysctl -w kernel.panic=0;
  1023. fi;
  1024. EOF
  1025. chown 0.0 /data/99SuperCharger.sh
  1026. chmod 777 /data/99SuperCharger.sh
  1027. if [ ! -f "/data/local/userinit.sh" ]; then
  1028. echo "#!/system/bin/sh" > /data/local/userinit.sh;
  1029. fi
  1030. echo "sh /data/99SuperCharger.sh;" >> /data/local/userinit.sh
  1031. chown 0.0 /data/local/userinit.sh
  1032. chmod 777 /data/local/userinit.sh
  1033. if [ -d "/system/etc/init.d" ]; then
  1034. cp -fr /data/99SuperCharger.sh /system/etc/init.d/99SuperCharger
  1035. echo "sh /data/99SuperCharger.sh;" >> /system/etc/init.d/99SuperCharger
  1036. chown 0.0 /system/etc/init.d/99SuperCharger
  1037. chmod 777 /system/etc/init.d/99SuperCharger
  1038. echo "sh /system/etc/init.d/99SuperCharger;" >> /data/local/userinit.sh
  1039. else
  1040. echo $line
  1041. echo ""
  1042. $sleep
  1043. echo " Stock ROM? - Additional Configuration Required!"
  1044. echo ""
  1045. $sleep
  1046. if [ "$opt" -le 10 ]; then
  1047. echo " Some Changes are TEMPORARY & WON'T PERSIST!"
  1048. echo ""
  1049. $sleep
  1050. echo " To enable PERSISTENT SuperCharger settings..."
  1051. echo ""
  1052. $sleep
  1053. echo " ...HTK Launcher and OOM Grouping Fixes..."
  1054. else
  1055. echo " To enable PERSISTENT OOM Grouping Fixes..."
  1056. fi
  1057. echo ""
  1058. $sleep
  1059. if [[ -n "$smrun" ]]; then
  1060. SuperChargerScriptManagerHelp=1
  1061. cat > /sdcard/SuperChargerScriptManagerHelp.html <<EOF
  1062. Yay! You already have <a href="http://market.android.com/details?id=os.tools.scriptmanager">Script Manager!</a><br>
  1063. After running the script, have Script Manager load the newly created <b>/data/99SuperCharger.sh</b> on boot<br>
  1064. In the "Config" settings, enable "Browse as Root."<br>
  1065. Press the menu key and then Browser.<br>
  1066. Navigate up to the root, then click on the "data" folder.<br>
  1067. Click on 99SuperCharger.sh and select "Script" from the "Open As" menu.<br>
  1068. In the properties dialogue box, check "Run as root" and "Run at boot" and "Save".<br>
  1069. And that's it!<br>
  1070. Script Manager will load your most recent settings on boot!<br>
  1071. If you run the script later and with different settings, you don't have to reconfigure anything.<br>
  1072. Script Manager will just load the new /data/99SuperCharger.sh on boot automagically :)<br>
  1073. <br>
  1074. For more SuperCharging help and info,<br>
  1075. See the <a href="http://forum.xda-developers.com/showthread.php?t=991276">V6 SuperCharger Thread</a><br>
  1076. Feedback is Welcome!<br>
  1077. <br>
  1078. -=zeppelinrox=- @ <a href="http://forum.xda-developers.com/showthread.php?t=991276">XDA</a> & <a href="http://www.droidforums.net/forum/droid-hacks/148268-script-v6-supercharger-htk-bulletproof-launchers-fix-memory-all-androids.html">Droid</a> Forums<br>
  1079. EOF
  1080. echo "Use THIS app to load 99SuperCharger.sh on boot!"
  1081. echo ""
  1082. $sleep
  1083. echo $line
  1084. echo " See /sdcard/SuperChargerScriptManagerHelp.html"
  1085. echo $line
  1086. else
  1087. echo " ..Please ENABLE boot scripts to be run from..."
  1088. echo " .../system/etc/init.d folder!"
  1089. echo " Easier: Script Manager can solve everything ;)"
  1090. echo ""
  1091. $sleep
  1092. SuperChargerHelp=1
  1093. cat > /sdcard/SuperChargerHelp.html <<EOF
  1094. To enable init.d boot scripts, go <a href="http://forum.xda-developers.com/showthread.php?t=1017291">HERE</a><br>
  1095. This is for Motorolas! At least some of them anyway.<br>
  1096. If that page is incompatible with your phone, do some reasearch!<br>
  1097. <br>
  1098. A very nice and easy solution is to simply use<br>
  1099. Script Manager to load scripts on boot - on ANY ROM!<br>
  1100. Here is the <a href="http://market.android.com/details?id=os.tools.scriptmanager">Market Link</a><br>
  1101. So first, you use Script Manager to run the V6 SuperCharger script.<br>
  1102. Then use it again to load the newly created <b>/data/99SuperCharger.sh</b> on boot<br>
  1103. In the 99SuperCharger.sh properties dialogue box, check "Run as root" and "Run at boot" and "Save".<br>
  1104. And that's it!<br>
  1105. Script Manager will load your most recent settings on boot!<br>
  1106. If you run the script later and with different settings, you don't have to reconfigure anything.<br>
  1107. Script Manager will just load the new /data/99SuperCharger.sh on boot automagically :)<br>
  1108. <br>
  1109. For more SuperCharging help and info,<br>
  1110. See the <a href="http://forum.xda-developers.com/showthread.php?t=991276">V6 SuperCharger Thread</a><br>
  1111. Feedback is Welcome!<br>
  1112. <br>
  1113. -=zeppelinrox=- @ <a href="http://forum.xda-developers.com/showthread.php?t=991276">XDA</a> & <a href="http://www.droidforums.net/forum/droid-hacks/148268-script-v6-supercharger-htk-bulletproof-launchers-fix-memory-all-androids.html">Droid</a> Forums<br>
  1114. EOF
  1115. echo $line
  1116. echo "See /sdcard/SuperChargerHelp.html for more help!"
  1117. echo $line
  1118. fi
  1119. echo ""
  1120. $sleep
  1121. fi
  1122. fi
  1123. echo "$scadj" > /sys/module/lowmemorykiller/parameters/adj
  1124. if [ "$opt" -le 10 ]; then
  1125. if [ -d "/system/etc/init.d" ]; then
  1126. echo $line
  1127. echo ""
  1128. $sleep
  1129. fi
  1130. echo " Setting lowmemorykiller to $MB1,$MB2,$MB3,$MB4,$MB5,$MB6 mb"
  1131. echo ""
  1132. echo "$scminfree" > /sys/module/lowmemorykiller/parameters/minfree
  1133. currentminfree=`cat /sys/module/lowmemorykiller/parameters/minfree`
  1134. ran=1
  1135. $sleep
  1136. echo " OOM minfrees levels are now set to..."
  1137. echo ""
  1138. $sleep
  1139. echo " ..."$currentminfree
  1140. echo ""
  1141. $sleep
  1142. echo $line
  1143. echo " SUPERCHARGE IN EFFECT IMMEDIATELY!!"
  1144. fi
  1145. if [ "$opt" -gt 10 ] && [ ! -d "/system/etc/init.d" ]; then
  1146. nl=1
  1147. else
  1148. echo $line
  1149. echo ""
  1150. $sleep
  1151. fi
  1152. if [ "$opt" -le 10 ]; then
  1153. echo " If this is your first V6 SuperCharge...."
  1154. echo ""
  1155. $sleep
  1156. fi
  1157. echo " REBOOT NOW TO ENABLE..."
  1158. echo ""
  1159. $sleep
  1160. if [ "$opt" -eq 12 ]; then
  1161. echo " ...BULLETPROOF LAUNCHER..."
  1162. else
  1163. echo " ...HARD TO KILL LAUNCHER..."
  1164. fi
  1165. echo ""
  1166. $sleep
  1167. echo " ...AND OOM GROUPING FIXES!"
  1168. echo ""
  1169. $sleep
  1170. echo $line
  1171. if [ "$SuperChargerHelp" -eq 1 ]; then
  1172. echo " ...AND RE-RUN THIS SCRIPT AFTER EACH REBOOT!"
  1173. elif [ "$SuperChargerScriptManagerHelp" -eq 1 ]; then
  1174. echo " DON'T FORGET to have Script Manager load..."
  1175. echo " .../data/99SuperCharger.sh on boot!"
  1176. elif [ "$opt" -le 10 ]; then
  1177. echo "$CONFIG Settings WILL PERSIST after reboot!"
  1178. echo $line
  1179. echo ""
  1180. $sleep
  1181. echo " If they don't persist, check the help file!"
  1182. echo ""
  1183. else
  1184. $sleep
  1185. echo ""
  1186. echo " If OOM Fixes are not in effect after reboot..."
  1187. echo ""
  1188. $sleep
  1189. echo " ...and the Launcher is weak..."
  1190. echo ""
  1191. $sleep
  1192. echo " ...check the help file!"
  1193. echo ""
  1194. fi
  1195. echo $line
  1196. echo ""
  1197. $sleep
  1198. fi
  1199. fi
  1200. if [ "$opt" -eq 15 ]; then
  1201. echo " This will copy V6 SuperCharger to /system/xbin"
  1202. echo ""
  1203. $sleep
  1204. echo " To use this script with Terminal Emulator..."
  1205. echo ""
  1206. $sleep
  1207. echo " Run Terminal Emulator..."
  1208. echo ""
  1209. $sleep
  1210. echo " ...Type su and enter..."
  1211. echo ""
  1212. $sleep
  1213. echo " ...type bash V6 and enter..."
  1214. echo ""
  1215. $sleep
  1216. echo " THAT'S IT!"
  1217. echo ""
  1218. $sleep
  1219. echo " Note that su is short for SuperUser..."
  1220. echo ""
  1221. $sleep
  1222. echo " So... continue installation?"
  1223. echo ""
  1224. $sleep
  1225. echo -n " Enter Y for Yes, any key for No: "
  1226. read v6xbin
  1227. echo ""
  1228. echo $line
  1229. case $v6xbin in
  1230. y|Y)if [ "$0" == "V6" ]; then
  1231. echo " You are already running it from system/xbin!"
  1232. else
  1233. dd if=$0 of=/system/xbin/V6 2>/dev/null
  1234. echo " Installation was incredibly successful!"
  1235. fi;;
  1236. *)echo " Well... forget it then...";;
  1237. esac
  1238. echo $line
  1239. echo ""
  1240. $sleep
  1241. fi
  1242. if [ "$opt" -ge 2 ] && [ "$opt" -le 12 ] || [ "$opt" -eq 15 ] || [ "$opt" -eq 17 ]; then
  1243. echo " SuperCharging, OOM Grouping & Priority Fixes.."
  1244. echo ""
  1245. $sleep
  1246. echo " ...BulletProof & Hard To Kill Launchers..."
  1247. echo ""
  1248. $sleep
  1249. echo " ...by -=zeppelinrox=- @ XDA & Droid Forums"
  1250. sleep 2
  1251. fi
  1252. if [ "$opt" -eq 17 ]; then
  1253. echo ""
  1254. echo " Buh Bye :)"
  1255. echo ""
  1256. $sleep
  1257. exit 0
  1258. fi
  1259. fi
  1260. mount -o remount,ro /system 2>/dev/null
  1261. for m in /dev/block/mtdblock*
  1262. do
  1263. mount -o remount,ro $m /system 2>/dev/null
  1264. done
  1265. done
1

Comments