[TIP] Shell script output to AROMA UI - Android Software Development

Thanks to Chainfire for the original idea here, here comes the version for AROMA installers.
Purpose: Do "live" output from a shell script to the AROMA user interface in installation step.
How it works: The update-binary uses a pipe for accessing the UI of the recovery like writing a line of text or updating the progress-bar. AROMA does basically the same thing -- the main AROMA installer opens another pipe and forks itself for the actual installation, the child running the installation writes to the pipe of the parent AROMA. If you try Chainfire's script from above, it will obtain the pipe of the recovery UI and write to that instead of the AROMA UI, only causing some nasty screen flicker. Because AROMA forks only directly before starting the installation, it is a little trickier to get it right -- we have to wait for the child to show up in 'ps'.
Code:
OUTFD=$(ps | grep -v grep | grep -oE "aroma/update-binary(.*)" | cut -d " " -f 3)
if [ $OUTFD == "" ]; then
count=4
while [ $count -ge 0 ]; do
sleep 1
OUTFD=$(ps | grep -v grep | grep -oE "aroma/update-binary(.*)" | cut -d " " -f 3)
if [$OUTFD != ""]; then break; fi
count=$((count-1))
done
fi
progress() {
if [ $OUTFD != "" ]; then
echo "progress ${1} ${2} " 1>&$OUTFD
fi
}
set_progress() {
if [ $OUTFD != "" ]; then
echo "set_progress ${1} " 1>&$OUTFD
fi
}
ui_print() {
if [ $OUTFD != "" ]; then
echo "ui_print ${1} " 1>&$OUTFD
echo "ui_print " 1>&$OUTFD
else
echo "${1}"
fi
}
The script above provides the functions progress, set_progress and ui_print. Instead of putting it in every script, I suggest you place it alongside your installer shellscripts, name it ui_functions.sh and source it like this:
Code:
. ./ui_functions.sh

Related

[DEV/TOOL] Automated(ish) T-Mobile Theme Generator

A script I've been working on for a couple of days. Still a work in progress so if you suck less, I could use improvements. It's real simple:
** Put this script in a stock theme template like Cyanbread
1.) Place a source ROM you want to theme for, the base ROM/THROM you're taking images from and a stock theme template (like Cyanbread) and set them in the script at the top.
2.) Modify the script as needed (it's not done as of this writing) and set verbosity out the output, etc.
2.) Run the script and it will do the work
The code should be pretty self explanatory and I'll update it as I go. Just about finished at this point.
Screenshot shows you what it does
Code:
#!/bin/bash
# ------------------------- Set theme name TODO
# themeName=$(cat Android.mk | grep LOCAL_PACKAGE_NAME | sed 's/^LOCAL_PACKAGE_NAME\s:=\s//g')
# read -p "Enter theme name. Enter for default [$themeName]: " REPLY
# REPLY=${REPLY:-$themeName}
# echo "Theme name is $themeName"
# ------------------------- for testing to spare the parameters
SRCROM="ABSOLUTE/PATH/TO/ROOT/OF/SOURCEROM"
BASEROM="ABSOLUTE/PATH/TO/ROOT/OF/BASEROM/YOURE/THEMING/FOR"
# my example:
# SRCROM=~/GBSense2.1/
# BASEROM=~/cm_glacier_full-42/
# running this script from ~/haxzamatic-Templatebread--918313e/
DSTROM=$(pwd)
LOGFILE=$DSTROM/logfile.log
decompile_rom(){
cd $1/app
if [ ! -d $1/app/Browser/ ]; then # need apktool for drawables
#apktool if framework/framework_res.apk
#if [ -e framework/com.htc.resources.apk ]; then
# apktool if framework/com.htc.resources.apk
#fi
for i in `ls $1/app/*.apk`; do echo "Decompiling $i"; apktool d $i; done
cd ../framework
for i in `ls $1/framework/*.apk`; do echo "Decompiling $i"; apktool d $i; done
else
echo "Already decompiled"
fi
}
decompile_rom $SRCROM/system
decompile_rom $BASEROM/system
cd $DSTROM
rm $DSTROM/res/xml/*.xml
echo "" > appendleftovers.tmp
# ------------------------- Log file purge and title
cat <<EOF > $LOGFILE
*********************************************************
Missing files from $SRCROM
*********************************************************
EOF
# ------------------------- Redirections.xml
cat <<EOF > res/xml/redirections.xml
<?xml version="1.0" encoding="utf-8"?>
<theme-redirections
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pluto="http://www.w3.org/2001/pluto.html">
EOF
# ------------------------- Android.xml
echo "<resource-redirections>">$DSTROM/res/xml/android.xml
# ------------------------- Main Loop
find "$BASEROM" -type f -name "*.png" | while read fimg; do
# ------------------------- Base Params
FIMGFNAME=$(cat $(dirname $fimg)"/../../apktool.yml" | grep "apkFileName" | sed 's/apkFileName:\s//g' | sed 's/\.apk//g' )
FIMGPNAME=$(cat $(dirname $fimg)"/../../AndroidManifest.xml" | grep "package" | tr " " "\n" | grep package= | cut -d \" -f 2)
if [ $FIMGPNAME = "android" ]; then FIMGPNAME=framework_res; fi
FIMGDNAME=$(echo $(dirname $fimg) | sed "s/\(.*\)\///" )
cd $DSTROM
if [ "$FIMGFNAME" = "framework-res" ] || [ "$FIMGFNAME" = "com.htc.resources" ]; then wp="framework"
else wp="app"
fi
# -------------------------
SRCFILEPATH=$SRCROM/system/$wp/$FIMGFNAME/res/$FIMGDNAME/$DESTFILE
SRCFILENAME=$(echo $(basename $fimg))
DSTFILEPATH=$DSTROM/system/$wp/$FIMGFNAME/res/$FIMGDNAME/$DESTFILE
DSTFILENAME=$(echo $(echo $FIMGPNAME|sed 's/\./_/g')"_$(basename $fimg)")
BSEFILEPATH=$BASEROM/system/$wp/$FIMGFNAME/res/$FIMGDNAME/$DESTFILE
BSEFILENAME=$(echo $(basename $fimg))
# -------------------------
[ -d res ] || mkdir res
[ -d res/$FIMGDNAME ] || mkdir res/$FIMGDNAME
# -------------------------
if [ -f $SRCFILEPATH$SRCFILENAME ]; then
echo "cp $SRCFILEPATH$SRCFILENAME $DSTROM/res/$FIMGDNAME/$DSTFILENAME"
cp $SRCFILEPATH$SRCFILENAME $DSTROM/res/$FIMGDNAME/$DSTFILENAME
# ------------------------- Redirections.xml
thispname=$(cat $(dirname $fimg)"/../../AndroidManifest.xml" | grep "package" | tr " " "\n" | grep package= | cut -d \" -f 2)
if ! grep -iq $thispname $DSTROM/res/xml/redirections.xml ; then
echo "<package-redirections android:name=\"$thispname\" android:minSdkVersion=\"7\" android:resource=\"@xml/$(echo $thispname|sed 's/\./_/g')\" />" >>$DSTROM/res/xml/redirections.xml
fi
# ------------------------- Android.xml
drawrsrc=$(echo $SRCFILENAME | sed 's/\(.*\)\..*/\1/' | sed 's/\.9//g')
drawrdst=$(echo $DSTFILENAME | sed 's/\(.*\)\..*/\1/' | sed 's/\.9//g')
echo "<item name=\"@drawable/$drawrsrc\">@drawable/$drawrdst</item>" >>$DSTROM/res/xml/android.xml
# ------------------------- Package Redirections
drawrfnamenoext=$(echo $drawrsrc | sed 's/\./_/g')
dstfilenameparsed=$(echo $drawrdst | sed 's/\./_/g')
dstredirfname=`echo "$DSTROM/res/xml/$(echo $FIMGPNAME | sed 's/\./_/g').xml"`
if [ ! -f $dstredirfname ]; then
cat <<EOF > $dstredirfname
<?xml version="1.0" encoding="utf-8"?>
<resource-redirections>
EOF
echo "$dstredirfname" >> appendleftovers.tmp
fi
echo "<item name=\"drawable/$drawrfnamenoext\">@drawable/$dstfilenameparsed</item>" >>$dstredirfname
else
echo "[MISSING]: $SRCFILEPATH$SRCFILENAME" >> $LOGFILE
#echo "1.) $fimg" >> $LOGFILE
#echo "2.) $FIMGFNAME" >> $LOGFILE
#echo "3.) $FIMGPNAME" >> $LOGFILE
#echo "4.) $FIMGDNAME" >> $LOGFILE
#echo "5.) $SRCFILEPATH" >> $LOGFILE
#echo "6.) $SRCFILENAME" >> $LOGFILE
#echo "7.) $DSTFILEPATH" >> $LOGFILE
#echo "8.) $DSTFILENAME" >> $LOGFILE
#echo "9.) $BSEFILEPATH" >> $LOGFILE
#echo "10.)$BSEFILENAME" >> $LOGFILE
#echo "------------------------------" >> $LOGFILE
fi
# echo "1.) $fimg"
# echo "2.) $FIMGFNAME"
# echo "3.) $FIMGPNAME"
# echo "4.) $FIMGDNAME"
# echo "5.) $SRCFILEPATH"
# echo "6.) $SRCFILENAME"
# echo "7.) $DSTFILEPATH"
# echo "8.) $DSTFILENAME"
# echo "9.) $BSEFILEPATH"
# echo "10.)$BSEFILENAME"
# echo "------------------------------"
# ------------------------- Example output:
# 1.) ~/cm_glacier_full-42/system/app/Browser/res/drawable-hdpi/fav_icn_background.png
# 2.) Browser
# 3.) com.android.browser
# 4.) drawable-hdpi
# 5.) ~/GBSense2.1/system/app/Browser/res/drawable-hdpi/
# 6.) fav_icn_background.png
# 7.) ~/haxzamatic-Templatebread--918313e/system/app/Browser/res/drawable-hdpi/
# 8.) com_android_browser_fav_icn_background.png
# 9.) ~/cm_glacier_full-42/system/app/Browser/res/drawable-hdpi/
# 10.)fav_icn_background.png
done
# ------------------------- Close out the XML tags
echo "</resource-redirections>">>$DSTROM/res/xml/android.xml
echo "</theme-redirections>">>$DSTROM/res/xml/redirections.xml
cat $DSTROM/appendleftovers.tmp | while read thistmp; do
echo "</resource-redirections>" >> $thistmp
done
rm $DSTROM/appendleftovers.tmp
echo "FINISHED:::::::::::::::::::::::::::::::::::::::::::::::::::::::"
reserved for spam

Touch REcovery ?

Is there anyone working on it? Its really worth a shot. Even for the Aroma installer.
Özgürce said:
Is there anyone working on it? Its really worth a shot. Even for the Aroma installer.
Click to expand...
Click to collapse
Blefish is porting touch recovery, he tweeted that he will be releasing it with CM9 0.03 in mid July.
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Can you release it? At atmel will work with hardware buttons until you fix this..
Sent from my U8800
Why release it since the touch wont work for Atmel users, so no TOUCH recovery.
AceDroidX said:
Why release it since the touch wont work for Atmel users, so no TOUCH recovery.
Click to expand...
Click to collapse
Yes, but Blefish could release a version for those with synaptics... I think it wouldn't hurt
Sent from my U8800
It will be only for U8800 (not for pro) I think??
fjsferreira said:
Yes, but Blefish could release a version for those with synaptics... I think it wouldn't hurt
Sent from my U8800
Click to expand...
Click to collapse
Yes, and we could act as beta testers, so if there is some bug it could be fixed on next, atmel support version.
Blefish said:
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Click to expand...
Click to collapse
Thats great! Glad to hear someone working on it. I'm using 4EXT Touch recovery on my Incredible S. Its awesome.
Blefish said:
Yea, its working well, but its missing the atmel support again (...). I will tweet as soon as I get it properly working on both touch panels.
Sent from my U8800 using Tapatalk 2
Click to expand...
Click to collapse
Will it support Universal Flasher Tool for theming?
With your CyanogemMOD ROM that will be a must have!!!
For the moment it is only supported by 5.0.2.7 CWM...
sr21 said:
Will it support Universal Flasher Tool for theming?
With your CyanogemMOD ROM that will be a must have!!!
For the moment it is only supported by 5.0.2.7 CWM...
Click to expand...
Click to collapse
Can you get me the log? Try to flash it and after that go to advanced options, you should find it there.
About recovery - I'll cook it up, it will not have "offmode" charging as it's not handled by recovery nowadays. And of course, no Atmel support just yet.
Blefish said:
Can you get me the log? Try to flash it and after that go to advanced options, you should find it there.
About recovery - I'll cook it up, it will not have "offmode" charging as it's not handled by recovery nowadays. And of course, no Atmel support just yet.
Click to expand...
Click to collapse
LOG:
Code:
failed to open /sys/class/android_usb_/android0/state: No such file or directory
Universal Flasher Tool 3.6
sr21 said:
LOG:
Code:
failed to open /sys/class/android_usb_/android0/state: No such file or directory
Universal Flasher Tool 3.6
Click to expand...
Click to collapse
That error is common in 2.6.35 kernel with CWM 5.5.0.4. I'd need the whole log to help you. Or, you can send me the updater-script that should be located at zip-file/META-INF/com/google/android.
Blefish said:
That error is common in 2.6.35 kernel with CWM 5.5.0.4. I'd need the whole log to help you. Or, you can send me the updater-script that should be located at zip-file/META-INF/com/google/android.
Click to expand...
Click to collapse
You can see the script in the Universal Flasher Tool link that I provided before. The zip is a template.
It uses a script to do the modding in the recovery.
You can also check one of my flashable zips that I use in my TouchWiz MOD/ADDON PACK: Touchwiz_for_u8800_u8800pro_v4.1.0.1u1_signed.zip
You need to check the /META-INF/com/google/android/, the /tools/, /MORPH/ (themed apps goes here) and the MOD.config file.
I think the script fails here (/tools/run.sh):
Code:
################### MORPHING ##################
UI_PRINT " "; LOG="MORPHING >>"; LOGS "$LOG"; UI_PRINT "$LOG"
CHECK2=0
x=1
until [ $x = 0 ]; do
if [ -d $PATHDATA ];then
WORK=$PATHDATA
SYSTEM="/data/app"
elif [ ! -d $PATHDATA ] && [ -d $PATHFRAM ];then
WORK=$PATHFRAM
SYSTEM="/system/framework"
elif [ ! -d $PATHDATA ] && [ ! -d $PATHFRAM ] && [ -d $PATHAPP ]; then
WORK=$PATHAPP
SYSTEM="/system/app"
elif [ ! -d $PATHDATA ] && [ ! -d $PATHFRAM ] && [ ! -d $PATHAPP ]; then
x=0
fi
if [ $x = 1 ]; then
for f in $(ls $WORK); do
if [ -e $SYSTEM/$f ];then
if [ `/cache/tools/tar -tPf $RESTORE/backup.tar $SYSTEM/$f | wc -l` = 0 ]; then
/cache/tools/tar -prPf $RESTORE/backup.tar $SYSTEM/$f
fi
mkdir -p /$APPLY
f2="`echo $f | cut -d "." -f 1`.zip"
mv $SYSTEM/$f /$APPLY/$f2
#FIX -V4 SUFFIXES IN FOLDERS
if [ $V4MORPHING = "yes" ] && [ -d $WORK/$f/res ];then
FILES=`/system/xbin/7z l $APPLY/$f2 | awk '{print $6}'`
cd $WORK/$f/res
find * -type d | while read i;do
if [ `echo $FILES | grep $i-v4 | wc -l` != 0 ]; then
mv $WORK/$f/res/$i $WORK/$f/res/$i-v4
fi
done
fi
#CYANOGENMOD vs STOCK BASED ROM
if [ $MULTIPLATTFORM = "yes" ];then
cd $WORK/$f
find * -type f | while read i;do
if [ $CYANO = "yes" ] && [ `basename $i | cut -d "#" -f 1` = "CMOD" ];then
mv $WORK/$f/$i $WORK/$f/`dirname $i`/`basename $i | cut -d "#" -f 2`
elif [ $CYANO = "no" ] && [ `basename $i | cut -d "#" -f 1` = "CMOD" ];then
rm $i
fi
done
fi
#MORPH, ZIP & ZIPALIGN
if [ $CLEANMORPHING = "yes" ];then
MORPH=`/system/xbin/7z a -ur0x2y2z2w2 $APPLY/$f2 $WORK/$f/* | grep -o -E "Everything is Ok" | wc -l`
else
MORPH=`/system/xbin/7z a $APPLY/$f2 $WORK/$f/* | grep -o -E "Everything is Ok" | wc -l`
fi
/cache/tools/zipalign -f 4 $APPLY/$f2 $SYSTEM/$f
rm -Rf $APPLY $WORK/$f
chown 0.0 $SYSTEM/$f && chmod 644 $SYSTEM/$f
if [ ! -e $SYSTEM/$f ] || [ $MORPH = 0 ]; then
/cache/tools/tar -pxPf $RESTORE/backup.tar $SYSTEM/$f
LOG="[X] Error with $f!"; LOGS "$LOG"; UI_PRINT "$LOG"
LOG="[<] Restored original $f"; LOGS "$LOG"; UI_PRINT "$LOG"
let CHECK2=$CHECK2-1
else
LOGS "[v] $SYSTEM/$f morphed"; UI_PRINT "[v] $f morphed"
let CHECK2=$CHECK2+2
fi
else
LOG="[!] $f not found, ignoring"; LOGS "$LOG"; UI_PRINT "$LOG"
fi
done
rm -R $WORK
fi
done
if [ $CHECK2 -le 0 ];then
LOG="[!] Nothing to morph"; LOGS "$LOG"; UI_PRINT "$LOG"
fi

[email protected]@holic help thread

This is a thirteen step program for flashaholics.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Since there is no cure for flashaholism, we may as well give those afflicted more to flash..
**ALWAYS FLASH AT YOUR OWN RISK ANYTHING THAT GETS POSTED HERE**​
Just follow these simple steps:
1. Rate this thread 5 stars
2. Subscribe to this thread
3. Tell other flashaholics to join this thread
4. Treat all flashaholics with respect
5. Be on the constant lookout for anything new and noteworthy
6. Be helpful to those afflicted by posting these new found links
7. Always use protection when flashing (have a backup)
8. Don't be discrete about your flashing adventures, share your steamy details
9. Be helpful to outsiders that aren't as flash savvy as you and answer their posts nicely
10. If you feel a member is on the wagon, help them fall off by bragging about how cool your phone is
11. Remember to follow XDA rules
12. Happy flashing!!
13. Always thank your developers, and donate if you can..
BECOME PART OF AN ADDICTIVE COMMUNITY
I'm on telegram
HELP THE COMMUNITY AND JOIN THE ROM "WIKI"
You can add your knowledge to this growing chart of roms
-JOIN HERE-​
When not flashing I will update the thread with notable links of what, where, and how to flash..
Contributors
@#sychrome#
XDA community
Get your support banners -HERE-
WE'RE HERE FOR YOUR TUNING NEEDS
KA MOD (Kernel aduitor)
http://forum.xda-developers.com/android/apps-games/kernel-adiutor-mod-singularity-kernel-t3333549
How to apply profiles
http://forum.xda-developers.com/oneplus-one/development/rom-cm-12-builds-t3045053/post68636831
Lightning Kernel profiles
http://forum.xda-developers.com/oneplus-one/general/flshholic-help-thread-t2869514/post69351130
New Kernel profiles (jgcaap rom)
http://forum.xda-developers.com/oneplus-one/general/flshholic-help-thread-t2869514/post69271814
Moriarty Kernel profiles (S.O.S. rom)
http://forum.xda-developers.com/showpost.php?p=70181339&postcount=175
Battery Savings tips
1. Keep unneeded services off (location, BT, NFC, ect..)
2. Lower the screen brightness
3. Manage your apps with greenify (many apps will abuse services if you let them)
4. Don't discharge the battery to zero, and try to keep it cool (hot batteries discharge faster)
Settings Script
WELCOME TO SETTINGS SCRIPT
This is a set scripts I started collecting and working on since my days of old using a Nexus S. It has been updated and tested 100's of times and is ready for use on the OnePlus. I am not going to claim 1000's of points gained in benchmarks, or days of battery life, but it should help balance performance and battery..
Basically it's a collection of init.d scripts to gently modify some services, system, battery and various functions. This is active at boot (assuming you have init.d support and busybox). Please don't use this with other scripts (seeder is okay). Don't operate while intoxicated or holding an iPhone..
Code:
#!/system/bin/sh
# test
if [ -f /data/Test.log ] ; then
rm /data/Test.log
fi
echo "Script is working !!!" >> /data/Test.log
echo "excecuted on $(date +"%d-%m-%Y %r" )" >> /data/Test.log
# Expand Kernel Permission
if [ -e /dev/cpuctl/apps/cpu.notify_on_migrate ]; then
chown system.system /dev/cpuctl/apps/cpu.notify_on_migrate
chmod 0666 /dev/cpuctl/apps/cpu.notify_on_migrate
fi
# Cleaner
#Interval between runs, in seconds, 172800=48 hours
RUN_EVERY=172800
busybox rm -f /data/anr/*.*
busybox rm -f /data/cache/*.*
busybox rm -f /data/log/*.*
busybox rm -f /data/local/tmp/*.*
busybox rm -f /data/mlog/*
busybox rm -f /data/tombstones/*
busybox rm -f /data/backup/pending/*
busybox rm -f /data/system/dropbox/*
busybox rm -f /cache/recovery/*
busybox rm -f /dev/log/main/*
chmod 700 /data/system/dropbox
busybox chmod 700 /data/system/usagestats
# Zipalign
# 86400=24 hours
RUN_EVERY=86400
LOG_FILE=/data/zipalign.log
ZIPALIGNDB=/data/zipalign.db
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
if [ ! -f $ZIPALIGNDB ]; then
touch $ZIPALIGNDB;
fi;
echo "Starting FV Automatic ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
for DIR in /system/app /data/app ; do
cd $DIR
for APK in *.apk ; do
if [ $APK -ot $ZIPALIGNDB ] && [ $(grep "$DIR/$APK" $ZIPALIGNDB|wc -l) -gt 0 ] ; then
echo "Already checked: $DIR/$APK" | tee -a $LOG_FILE
else
zipalign -c 4 $APK
if [ $? -eq 0 ] ; then
echo "Already aligned: $DIR/$APK" | tee -a $LOG_FILE
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
else
echo "Now aligning: $DIR/$APK" | tee -a $LOG_FILE
zipalign -f 4 $APK /cache/$APK
cp -f -p /cache/$APK $APK
busybox rm -f /cache/$APK
grep "$DIR/$APK" $ZIPALIGNDB > /dev/null || echo $DIR/$APK >> $ZIPALIGNDB
fi
fi
done;
done;
touch $ZIPALIGNDB
echo "Automatic ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
# Renice
B=/system/xbin/busybox
( while true
do
sf=$( service list | $B grep -c "SurfaceFlinger" )
if [ $sf -eq 1 ]
then
service call SurfaceFlinger 1008 i32 1
break
else
sleep 2
fi
done
) &
# Kernel Tweaks
if [ -e /proc/sys/kernel/softlockup_panic ]
then
echo 0 > /proc/sys/kernel/softlockup_panic
fi
if [ -e /proc/sys/kernel/hung_task_timeout_secs ]
then
echo 0 > /proc/sys/kernel/hung_task_timeout_secs
fi
if [ -e /proc/sys/kernel/panic_on_oops ]
then
echo 0 > /proc/sys/kernel/panic_on_oops
fi
if [ -e /proc/sys/kernel/panic ]
then
echo 0 > /proc/sys/kernel/panic
fi
if [ -e /proc/sys/kernel/msgmni ]
then
echo 2048 > /proc/sys/kernel/msgmni
fi
if [ -e /proc/sys/kernel/msgmax ]
then
echo 64000 > /proc/sys/kernel/msgmax
fi
if [ -e /proc/sys/kernel/shmmax ]
then
echo 268435500 > /proc/sys/kernel/shmmax
fi
if [ -e /proc/sys/kernel/threads-max ]
then
echo 525810 > /proc/sys/kernel/threads-max
fi
if [ -e /proc/sys/kernel/nmi_watchdog ]; then
echo "0" > /proc/sys/kernel/nmi_watchdog;
sysctl -e -w kernel.nmi_watchdog=0;
fi;
if [ -e /proc/sys/vm/drop_caches ]; then
echo "3" > /proc/sys/vm/drop_caches;
sysctl -e -w vm.drop_caches=3;
fi;
#fsync
if [ -e /sys/devices/virtual/misc/fsynccontrol/fsync_enabled ]; then
echo "0" > /sys/devices/virtual/misc/fsynccontrol/fsync_enabled;
fi;
if [ -e /sys/class/misc/fsynccontrol/fsync_enabled ]; then
echo "0" > /sys/class/misc/fsynccontrol/fsync_enabled;
fi;
if [ -e /sys/module/sync/parameters/fsync ]; then
echo "0" > /sys/module/sync/parameters/fsync;
fi;
if [ -e /sys/module/sync/parameters/fsync_enabled ]; then
echo "0" > /sys/module/sync/parameters/fsync_enabled;
echo "N" > /sys/module/sync/parameters/fsync_enabled;
fi;
# Disable Sleepers
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NORMALIZED_SLEEPER" > /sys/kernel/debug/sched_features;
# Kill Media Tweak
LOG=/data/mediaserver_log.txt;
supolicy --live "allow mediaserver mediaserver_tmpfs:file { read write execute };";
if [ "$SDK" -le "18" ]; then
if [ "$SDK" -gt "10" ]; then
echo "Mediaserver kill" >> $LOG;
busybox killall -9 android.process.media;
busybox killall -9 mediaserver;
fi;
fi;
# Vsync tweak
if [ -e /sys/kernel/debug/msm_fb/0/vsync_enable ]; then
echo 0 > /sys/kernel/debug/msm_fb/0/vsync_enable
fi;
#Sqlite
# Log file location
LOG_FILE=/data/sqlite.log
#Interval between SQLite3 runs, in seconds, 604800=1 week
RUN_EVERY=604800
# Get the last modify date of the Log file, if the file does not exist, set value to 0
if [ -e $LOG_FILE ]; then
LASTRUN=`stat -t $LOG_FILE | awk '{print $14}'`
else
LASTRUN=0
fi;
# Get current date in epoch format
CURRDATE=`date +%s`
# Check the interval
INTERVAL=$(expr $CURRDATE - $LASTRUN)
# If interval is more than the set one, then run the main script
if [ $INTERVAL -gt $RUN_EVERY ]; then
if [ -e $LOG_FILE ]; then
rm $LOG_FILE;
fi;
echo "SQLite database VACUUM and REINDEX started at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
for i in `busybox find /d* -iname "*.db"`;
do /system/xbin/sqlite3 $i 'VACUUM;';
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS";
else
resVac="ERRCODE-$resVac";
fi;
/system/xbin/sqlite3 $i 'REINDEX;';
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS";
else
resIndex="ERRCODE-$resIndex";
fi;
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex" | tee -a $LOG_FILE;
done
echo "SQLite database VACUUM and REINDEX finished at $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE;
fi;
#Lcd power
if [ -e /sys/class/lcd/panel/power_reduce ]; then
echo "LCD power reduce detected. Activating..";
echo "1" > /sys/class/lcd/panel/power_reduce;
fi;
# Properties tweak
setprop ro.kernel.android.checkjni 0
setprop debug.kill_allocating_task 0
setprop dev.pm.dyn_samplingrate 1
setprop pm.sleep_mode 1
setprop persist.sys.purgeable_assets 1
setprop persist.cust.tel.eons 1
setprop ro.ril.enable.amr.wideband 1
setprop ro.ril.transmitpower true
setprop ro.ril.sensor.sleep.control 1
setprop ro.config.combined_signal true
setprop ro.ril.hep 1
setprop wifi.supplicant_scan_interval 300
setprop cm.filesystem.ready 1
setprop persist.service.pcsync.enable 0
setprop persist.service.lgospd.enable 0
setprop ro.min_pointer_dur 1
setprop ro.sys.fw.bg_apps_limit 6
setprop ro.lcd_min_brightness 1
setprop persist.sys.use_dithering 0
setprop persist.sys.use_16bpp_alpha 1
setprop ro.max.fling_velocity 20000
setprop ro.min.fling_velocity 10000
#Ext4 mount
# Log file location
LOG_FILE=/data/fsck.log
if ( mount | grep -w ext4 ) then
echo "EXT4 Partition Found!"
echo "Remounting..."
mount -o noatime,remount,rw,discard,barrier=0,commit=60,noauto_da_alloc,delalloc /cache /cache;
mount -o noatime,remount,rw,discard,barrier=0,commit=60,noauto_da_alloc,delalloc /data /data;
mount >> /data/fsck.log;
else
echo "EXT4 Partition Not Found!"
fi;
echo "Script finished"
FLASH AT YOUR OWN RISK
INSTALLATION:
**Requires BusyBox and init.d support**
(For some Nougat roms emulation of init.d may be nessesary, use KA mod, or another app for init.d emulation..)
Just flash in recovery, no extra steps required to enjoy..
It removes the old version, so flash and forget, it also survives a dirty flash (v5.5+)..
This has been tested, but no guarantees for protection from aliens or ninjas..
SPECIAL THANKS TO: @h-cspu @7u5h4r @Stone_88@ashutoshmn @Purerawenergy and @maxed4901 for helping me improve it..
Unless there's a bug fix or something I like, this won't get updated further.. NO ETAS
DOWNLOAD(s)
https://www.androidfilehost.com/?w=files&flid=123565
SCRIPTS & UNINSTALLER
LATEST UPDATE
VERSION: 6.1 SS Beta 08/04/2017
VERSION: 3.1 SS Stable 08/04/2017
Enjoy
Mine
CARBON
DOWNLOAD
Normal ext4 Debloated, with Android L keyboard and MiXplorer
Converted F2FS Converted, debloated, with Android L keyboard and MiXplorer.. THIS DOES NOT NEED A KERNEL FLASHED OVER THIS it is an "all in one" convert and is complete..
Original from Moonlight Original with extra Chinese apps
Not mine
yeeeaaaaaa
Sent from my 1+1
Thank you so much for bringing us carbon!
For the spreadsheet, it requires access. Don't forget to change the permissions
You need permission
Want in? Ask the owner for access, or switch to an account with permission. Learn more
Click to expand...
Click to collapse
zephiK said:
For the spreadsheet, it requires access. Don't forget to change the permissions
Click to expand...
Click to collapse
I'll get that fixed, its a work in progress..
Sent from my One using XDA Premium 4 mobile app
My name is ninjanurse, and I am a [email protected]@holic
Sent from my One A0001 using Tapatalk
welcome, ninjanurse
Sent from my 1+1
ninjanurse said:
My name is ninjanurse, and I am a [email protected]@holic
Sent from my One A0001 using Tapatalk
Click to expand...
Click to collapse
I think you need to tell the group about your latest flashing exploits, and don't forget to brag..
Sent from my One using XDA Premium 4 mobile app
Hello i am primo14z
and i can't stand to have one ROM to much time :/
so ya they say that first step is to face yourself with the problem , so I am a [email protected]@holic
i tryed Carbon ROM and i must say works great, but doesn't have that special something why would i make it my daily
I'm a [email protected]@holic as well, dansou901 is my name. My method of getting along is having multirom installed, it helps alot with all the flashing...
dansou901 said:
I'm a [email protected]@holic as well, dansou901 is my name. My method of getting along is having multirom installed, it helps alot with all the flashing...
Click to expand...
Click to collapse
I wonder if multirom works on f2fs?..
**using that search thingy, it turns out that multirom does indeed support f2fs..
Sent from my One using XDA Premium 4 mobile app
Setting.Out said:
I wonder if multirom works on f2fs?..
**using that search thingy, it turns out that multirom does indeed support f2fs..
MultiROM really helps me to stay a real [email protected]@holic, why choose a rom of choice.. I can have them all...
Click to expand...
Click to collapse
ninjanurse said:
Setting.Out said:
I wonder if multirom works on f2fs?..
**using that search thingy, it turns out that multirom does indeed support f2fs..
MultiROM really helps me to stay a real [email protected]@holic, why choose a rom of choice.. I can have them all...
Click to expand...
Click to collapse
As long as you don't run out of storage space...
Click to expand...
Click to collapse
ninjanurse said:
As long as you don't run out of storage space...
Click to expand...
Click to collapse
Binge and purge!!..
Sent from my A0001 using XDA Premium 4 mobile app
I just moved back to ext4 from f2fs.. For a Flashaholic that was a long time to be limited in how and when you can flash.. I was going through withdrawls, so I flashed 4 roms 3 recoveries and 1 kernel along with gapps and the lot as well.. AHHHH... Much better.. And honestly, I know that f2fs is supposed to be faster, but even if it is, I want a bit more freedom to flash.. I'm not saying I won't try it again, but not for a while..
I will have some updated links to websites/roms this week as well as more than just a shell of a chart.. I think the chart(s) will really help others see what a rom has to offer..

[SCRIPT] Log CPU Usage with interval (Linux)

Hey guys, I've just decided to get inside of the Android development world. Anyways, I'm mostly a fan of Linux, so I've made my first Linux script, I know it's simple, but I've never interacted with the user before, or picked an output. When I knew that Android made use of Linux in its core, my interest on working inside it grew up faster than ever.
In my script, firstly, you type the filename. For compatibility reasons, it'll everytime save to /sdcard/filename. Then, it will ask you how many times you want the script to log everything, and lately, every how many seconds should it save everything to the file.
The script will save, before every entry at the log, the screen status (if it's on or off), that can help to, for example, if your device has been lagging as a result of a bad screen driver or UI error.
Last thnig: it also works on recovery (maybe it give some error, and if no dumpsys is present on your recovery's ramdisk, it'll save everything as OFF).
Remember to send it anywhere excepting from /storage and any sbudir, it won't work as the Android permissions system blocks script execution on those dirs.
Code:
clear
# Wipe $logfile content in /sdcard (if any existing)
echo "Please type the filename where you want to save the log: "
read -r logfile
echo "" > /sdcard/$logfile
echo "Deleted previous log."
echo "SCREEN | CPU" >> /sdcard/$logfile
#cont=60
cont=1
#SHOWLOG=X
echo "Please type how many times the cycle must repeat: "
read -r maxcont
echo "Please type how many seconds will the interval take: "
read -r maxmin
clear
# Here it counts how many times the logging script has been ran
while [ $cont -lt $((maxcont + 1)) ];
do
# That nested while takes control of how many seconds have passed in the current cycle
while [ "$contmin" -lt "$maxmin" ];
do
contmin=$((contmin + 1))
sleep 1
clear
echo "C: $cont/$maxcont - T: $contmin/$maxmin"
done
# echo "$maxmin seconds passed."
# Logs the fist line of "busybox top" to a var
LOGVAR=$(busybox top -d 1 -n 1 | grep "idle")
# Logs the screen state (on or off) to another var
SCREENSTATE=$(dumpsys input_method | grep mScreenOn | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
# Saves a string that tells what it should expect if the screen is on
SCREENSTATEON="msystemreadytruemscreenontrue"
if [ "$SCREENSTATE" == "$SCREENSTATEON" ]
then
echo "ON: $LOGVAR" >> /sdcard/$logfile
else
echo "OFF: $LOGVAR" >> /sdcard/$logfile
fi
cont=$((cont + 1))
contmin=0
done
echo "Show logged values? [Y/N]"
read -r SHOWLOG
case $SHOWLOG in
[yY] | [yY][Ee][Ss] )
cat /sdcard/$logfile
;;
[nN] | [n|N][O|o] )
echo "Ok, goodbye. You'll see a what you've asked me to log in /sdcard/$logfile";
exit 1
;;
*) echo "You must write Y or N to continue."
;;
esac
exit 0
For example, save it as script.sh (remember to save it using Unix codifcation, if you're running Windows, else, it'll tell you that it's unable to find many binaries, as long as Linux isn't ok with CR+LF and requires LF as newline). Then, send it to the sdcard (over USB or adb push script.sh /sdcard/) , now, run ADB shell. Type the following commands:
Code:
su -c "cp -f /sdcard/script.sh /data/local/;chmod 777 /data/local/script.sh"
Then, if you want to run it:
Code:
su
sh /data/local/script.sh
That's all, I hope you enjoy it and not so many people kills me for explaining and feeling so grateful for that simple script.

[NO ROOT] Amazon Fire TV Setup Tool [ Kills Amazon Launcher + XFINITY STREAM 2017 ]

Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Thank you so much, I can't root my fire TV and I'm sick and tired of the Amazon launcher. I will be setting it up tomorrow. Will post back with results
Nvmd, finally got it.
This can be ran as a straight native Windows batch without having to install Bash support. Replace "sleep 1" with "timeout -t 1"
(or you can just paste ^^ into a properly connected ADB console with apks in the right places, will fail on "sleep 1" but it worked for me)
EDIT: Also works fine with Tvlauncher 2 rename the apk to tvlauncher like in the package and thanks OP! Home button seems to work fine for me!
installation help
Please help me install this fire tv setup tool i have a newer fire tv and dont know what to do with the download. i am not a pro but can follow directions and i hate the fire tv launcher.
Please help
Thank You
1. open a command prompt to the directory that contains ADB and put everything from the download in the same folder.
2. in the console window "adb connect xxx.xxx.xxx.xxx" where the x's are your IP of your FireTV\Stick (no quotes)
3. cut\paste the script from above into the console (cmd) window and run it...
4. it will error on "sleep 1" but continue and finish fine. If you want to correct the script for Windows batch scripting, replace "sleep 1" with "timeout -t 1" and save it as a .bat file.
I don't understand why this was only posted as a bash script (it is the best non-root hack there is). Windows doesn't support bash out of the box, and 99 percent of the people who download the script wont know what to do with it. BTW this works, and even works with other launchers. I use Tv launcher 2 which supports (its own special) widgets. No root. Never see the amazon launcher. Block updates, and do it asap.
EDIT: Fire Stick 2 fyi
So do we need to use the tvlauncher apk for the xfinity app to work?
What is the tv launcher? Same UI as the newer aftv ui (-ads?)
Only reason I don't just jump in and test it is Im not 100%sure how to undo it. Just uninstall the apks?
Thanks
UPDATE-I just went for it and it works....sort of.
It immediately launches the new UI but after setting it up, when I hit the home button it just returns to the normal AFTV launcher.
***This is actually preferable to me since all I really wanted was the Xfinity stream app to work. I tried just extracting the apk and installing it on my other Fire TV but it said incompatible.
First I would like to say thank you for a great tool to use on non rooted devices, I love it.
One thing i noticed is, that most people still won't know what to do with this tool so i will try and help explain better
-download adb and install it, if you haven't already
-download the file OP has at top of post
-extract the zip file
-copy and paste the code at top of OP into NOTEPAD
-change every spot that says "Sleep 1", erase that and copy and paste this there instead "timeout -t 1
-click file at the top left in notepad and click save as name it FireTV.bat
-goto your adb folder of install, usually C:\Program Files (x86)
-erase the "sh file" in the file you downloaded and extracted from the OP earlier
-put the new FireTV.bat you just made in that folder you just erased the "sh file" from
-now put all of those files into the adb folder you just opened and found,"launcher hijack apk, TVLauncher apk, x43Stream apk and your FireTV.bat files."
-hold on shift and right click with your mouse to open and command promnt here, if that doesn't show powershell works as well, it depends on your windows version.
-type "adb connect 192.168.1.8 or whatever you ip is for your FIreTV, this is found by going to settings, device, about and scroll down to network and it will list your IP
-if right it will say connected to device
-now simply left click hold and drag the FireTV.bat file you just created into the command promt and press enter
-that is it should work just fine.
I usually don't do this so I hope I helped a little bit.
Ok, just tried this, works pretty flawless. Sometimes you have to press home a couple times to get it to work(but that's no big deal). One thing i did notice though, if you have appstarter/firestarter (forget its name) it launches it instead, simple fix is to uninstall it then run the .bat again.
Does this work on firestick as well? Would hate to mess something up lol.
Edit.
For anyone wondering, no this does not work on firestick, it will install the apps but thats it.
TimmyP said:
This can be ran as a straight native Windows batch without having to install Bash support. Replace "sleep 1" with "timeout -t 1"
(or you can just paste ^^ into a properly connected ADB console with apks in the right places, will fail on "sleep 1" but it worked for me)
EDIT: Also works fine with Tvlauncher 2 rename the apk to tvlauncher like in the package and thanks OP! Home button seems to work fine for me!
Click to expand...
Click to collapse
Do you have a safe download link for the Tvlauncher 2 apk? Also so all I do is change Tvlauncher in the script to Tvlauncher2 and replace the apk in the download file?
Would it be possible to add a app killer similar to firestarter when you press the menu key, even if just to launch system default app manager? If it had that i think it'd be perfect.
Can anyone add screenshots or video of what this looks like when completed?
enigma7820 said:
First I would like to say thank you for a great tool to use on non rooted devices, I love it.
One thing i noticed is, that most people still won't know what to do with this tool so i will try and help explain better
-download adb and install it, if you haven't already
-download the file OP has at top of post
-extract the zip file
-copy and paste the code at top of OP into NOTEPAD
-change every spot that says "Sleep 1", erase that and copy and paste this there instead "timeout -t 1
-click file at the top left in notepad and click save as name it FireTV.bat
-goto your adb folder of install, usually C:\Program Files (x86)
-erase the "sh file" in the file you downloaded and extracted from the OP earlier
-put the new FireTV.bat you just made in that folder you just erased the "sh file" from
-now put all of those files into the adb folder you just opened and found,"launcher hijack apk, TVLauncher apk, x43Stream apk and your FireTV.bat files."
-hold on shift and right click with your mouse to open and command promnt here, if that doesn't show powershell works as well, it depends on your windows version.
-type "adb connect 192.168.1.8 or whatever you ip is for your FIreTV, this is found by going to settings, device, about and scroll down to network and it will list your IP
-if right it will say connected to device
-now simply left click hold and drag the FireTV.bat file you just created into the command promt and press enter
-that is it should work just fine.
I usually don't do this so I hope I helped a little bit.
Click to expand...
Click to collapse
Very helpful but I had to correct a few lines:
-There was a "Sleep 3" I had to change to "timeout -t 3"
-In powershell I had to type ".\adb connect 192.168.xx.xxx" to get it to work.
-The left click hold and drag the FireTV.bat file didn't do anything so I just typed "FireTV.bat" on the command prompt and it ran.
Thanks for your help.
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Click to expand...
Click to collapse
The sendspace link is very slow,
Here is a direct download link: https://ipfs.works/ipfs/QmXnYYH5iSnsa4DQdQED8RapgM4pA7v6EV3bzfGdoR9sMp/Amazon_Fire_TV_Setup_Tool.zip
md5sum: 8847a2b99afee549e2f5f973d86bfa51
Thread cleaned. XDA-Developers is a site for all, including those whose main languages and experience levels may vary.
If you're unwilling or unable to treat people with the civility we all deserve, kindly consider a break away from the keyboard.
Thank you all for your cooperation.
Sorry Somehow my post posted twice! not sure how to delete it so i'm editing this one
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
or download it:
https://www.sendspace.com/file/epob8z
Click to expand...
Click to collapse
I'm assuming this is using adb tcpip? I have a very Epic setup of bash scripts for setting up Fire Devices. I made it for my brother.
Anyways here is the chunk of code will grab your current connected networks and provide a list to choose from. Example if you have to it would show: 192.168.0.1 & 10.0.0.1 . When you choose one it will scan your network for Fire Devices with port 5555 open and present you with a list of found devices. You can choose to connect to a specific one or connect to them all.
There is a lot of extra code in this that needs to be removed. Right now i dont have the time to clean it up so hopefully you can! Also this chunk of code requires nmap to be installed. FYI This runs on Kali Linux but should work on other distro's but you may have to account for sudo usage.
Code:
function NetworkScan() {
function GetNetworks() {
echo -e "\n\n"
cd $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g") &>/dev/null
TotalConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | sort | uniq | wc -l)"
ConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -iv "offline" | sort | uniq | wc -l)"
ConnectedOffline="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -i "offline" | sort | uniq | wc -l)"
prompt="$(echo -e "\e[96m][NT3L][G3NC][ NetworkPicker Menu:\e[0m")"
IP=$(for file in $(ifconfig | egrep -o "wlan.:|eth.:" | cut -d" " -f1 | sed -e "s/://g"); do ip addr show $file | grep -w inet | cut -d"/" -f1 |sed -e 's/\<inet\>//g' -e 's/^[ \t]*//' | grep "[1-9][0-9]" | cut -d'.' -f1,2,3; done | sort | uniq)
options=( $(for file in $(echo "$IP"); do echo "$file.1/24"; done | sort | uniq | xargs -0) )
echo -e " $prompt $TotalConnectedDevices "
echo -e " [\e[96m$ConnectedOffline\e[0m]----------------------------------[\e[96m$ConnectedDevices\e[0m]"
echo -e " $RemoteKodi "
echo -e ""
select opt in "${options[@]}" "All" ; do
if [[ $REPLY = 'QUIT' || $REPLY = 'quit' ]] ; then
exit 1
elif (( REPLY == 1 + ${#options[@]} )) ; then
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
clear
NetworkScan "$opt"
else
echo -e "Invalid option. Try another one."
sleep 2 &>/dev/null
clear
StartMenu
fi
done
}
Args=( $(for file in $(echo "[email protected]"); do echo "$file" ; done | xargs -0) )
ArgsCount=${#Args[@]}
if [ "$ArgsCount" = '0' ]
then
GetNetworks
else
echo "${Args[@]}" | grep "\.1/24" &>/dev/null
if [ "$?" = '0' ]
then
options=( $(for file in $(echo ${Args[@]}); do nmap -p 5555 $file -oG - | grep "open" | cut -d" " -f2 ; done | xargs -0) )
else
options=( $(for file in $(echo ${Args[@]}); do echo $file ; done | xargs -0) )
fi
echo -e "\n\n"
cd $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g") &>/dev/null
TotalConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | sort | uniq | wc -l)"
ConnectedDevices="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -iv "offline" | sort | uniq | wc -l)"
ConnectedOffline="$(adb devices 2>/dev/null | grep -v "List" | grep -v "^$" | grep -iv "daemon" | grep -i "offline" | sort | uniq | wc -l)"
prompt="$(echo -e "\e[96m][NT3L][G3NC][ NetworkScan Menu:\e[0m")"
echo -e " $prompt $TotalConnectedDevices "
echo -e " [\e[96m$ConnectedOffline\e[0m]----------------------------------[\e[96m$ConnectedDevices\e[0m]"
echo -e " $RemoteKodi "
echo -e ""
select opt in "${options[@]}" "All" "Pick Network" ; do
if [[ $REPLY = 'QUIT' || $REPLY = 'quit' ]] ; then
exit 1
elif [[ $REPLY = 'KILL' || $REPLY = 'kill' ]] ; then
clear
killall adb gnome-terminal xterm terminator &>/dev/null
exit 1
elif [[ $REPLY = 'LIST' || $REPLY = 'list' ]] ; then
clear
$(declare -f ListDevicesConnected)
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'REFRESH' || $REPLY = 'refresh' || $REPLY = 'RELOAD' || $REPLY = 'reload' ]] ; then
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'FireStarter' || $REPLY = 'fIREsTARTER' ]] ; then
clear
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/FireStarterUP.sh &
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'APK' || $REPLY = 'apk' ]] ; then
clear
for apk in $(find $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/AApushApk/SendAPK -type f -iname "*.apk"); do adb install "$apk" ; done
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'REBOOT' || $REPLY = 'reboot' ]] ; then
clear
$(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/RebootDevices.sh
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'stop' || $REPLY = 'STOP' ]] ; then
clear
adb kill-server
adb start-server
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'HELP' || $REPLY = 'help' ]] ; then
clear
echo -e "$(HelpMe)"
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'USBCHECK' || $REPLY = 'usbcheck' || $REPLY = 'usb' || $REPLY = 'USB' ]] ; then
terminator -e dmesg -wH &
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'html' || $REPLY = 'HTML' ]] ; then
clear
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/Scriptz/GenerateHTML.sh
iceweasel $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2 | sed -e "s:/$::g")/ScreenShots/index.html &
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif [[ $REPLY = 'BACK' || $REPLY = 'back' || $REPLY = 'Menu' || $REPLY = 'menu' || $REPLY = 'MENU' ]] ; then
clear
StartMenu
elif [[ $REPLY = 'UpdateKodi' || $REPLY = 'uPDATEkODI' ]] ; then
clear
KodiAPKMenu
elif (( REPLY == 1 + ${#options[@]} )) ; then
clear
for file in $(echo ${options[@]}); do adb connect "$file" ; done
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
elif (( REPLY == 2 + ${#options[@]} )) ; then
clear
GetNetworks
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
clear
adb connect "$opt"
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
else
echo -e "Invalid option. Try another one."
sleep 2 &>/dev/null
clear
NetworkScan $(for file in $(echo ${options[@]}); do echo -n "$file " ; done)
fi
done
fi
}
The chunk of code above is setup to be a Menu in the terminal. NetworkScan is just one of the Menu options. If you make a base Menu setup with options: "Network Scan" , "Install APKs", "Change Launcher" etc. you could have "Change Launcher" launch a script that would have something like this in it.
Code:
for DroidID in $(adb devices 2>/dev/null | grep -v "List" | grep -v "daemon" | grep -v "^$" | cut -f1)
do
xterm -e $(grep 'MainPath=' $HOME/.][NT3L][ST][CKS/main.conf | cut -d'=' -f2)/Scriptz/Clean.sh "$DroidID" &
done
The above script gets all connected devices and then loops through their serial starting another script while passing the serial as a parameter. You would need to make sure the script that gets ran applies the parameter as the serial. Example below is used to remove all 3rd party apps installed, data and then uninstall it
Code:
#!/bin/bash
SerialNum="$1"
IsDeviceOffline="$(adb -s "$1" devices | grep "$1" | cut -f2)"
function AutoClean() {
echo -e ""
echo -e "Clearing App Data And Removing APKs"
for file in $(adb -s "$1" shell pm list packages -3 | cut -d':' -f2)
do
adb -s "$1" shell pm clear "$(echo "$file" | tr -d '\r')"
adb -s "$1" uninstall "$(echo "$file" | tr -d '\r' )"
done
echo -e ""
read -p "Finished Auto Cleaning"
}
echo -e "$IsDeviceOffline" | grep -i "offline" &>/dev/null
if [ "$?" != '0' ]
then
AutoClean "$SerialNum"
else
echo -e "Device:"$SerialNum" Is Offline!"
read -p "Exiting Script"
fi
nyln said:
Hello everyone!
I have had to set up quite a few of these sticks, so I wanted to start a little development tool to automate the process.
This is just a stupid bash script but it will make your TV usable without ads by installing Launcher Hijack 3 and configuring it for you and X43Stream. If anyone has requests I will work on this further. Leanback will not work, someone needs to mod it.
Source
PHP:
echo "Please ensure you are already connected and adb is installed correctly."
sleep 1
echo "Installing Launcher Hijack 3 (LH3).."
adb install "LauncherHijack3.apk"
echo "Installing TV Launcher.."
adb install "TVLauncher.apk"
echo "Installing XFinity Stream latest July 2017.."
adb install "X43Stream.apk"
echo "Opening LH3.."
adb shell am start -n com.baronkiko.launcherhijack/.MainActivity
sleep 3
echo "Selecting new launcher.."
adb shell input keyevent 23
sleep 1
adb shell input keyevent 23
sleep 1
adb shell am start -n com.awe.dev.pro.tv/.Launcher
echo "Enjoy, try out the home button!"
echo "It may not work every time, press again, work in progress :)"
Thanks for this. I use a slightly edited version of this on all of my firesticks now.
Click to expand...
Click to collapse
Anyone knows if is there a new update for the xfinity app for the firetv?
zeroth said:
Anyone knows if is there a new update for the xfinity app for the firetv?
Click to expand...
Click to collapse
Bump

Categories

Resources