How to run .sh scripts on Rooted Fire Device running rbox CFW - Fire TV Q&A, Help & Troubleshooting

HERE'S THE ANSWER!
Let's say the script is on the /sdcard and named 'script.sh'. The script would be run like so....
Code:
adb connect
adb shell su
cd /sdcard/
sh ./script.sh
@rbox
I've been searching for a guide to run .sh scripts on my Fire Stick Gen1. I've found a couple guides on how to auto run scripts on boot...but I want to simply run a script on demand. Particularly, I'm trying to run a few of the debloat scripts offered inside "esc0rtd3w" FirePwn Amazon FireTV Stick Loader located at... https://github.com/esc0rtd3w/firestick-loader
To run a script on demand. Do I need to have the script in a specific location on the Fire device? Do I need to set permissions for the script? Does it matter what file extension the script has? Does it need .sh at the end of the filename? I noticed the autoboot script guides DO NOT have .sh at the end of the filenames for the scripts its auto running at boot.
I also have another question...
I want to try out esc0rtd3w's FirePwn Amazon FireTV Stick Loader. I downloaded his entire github repo and open the 'autorun.cmd' but it doesn't recognize my device. Does anyone know how to successfully connect to the FireTV Stick Gen1 with his script? I've tried adb connecting to my device and then running his script but it still doesn't recognize my device. Has anyone successfully utilized this tool? If so, how did you get it to recognize your device? Because I haven't been able to utilize his windows script to automate the plethora of tasks it offers, it led me to seek how to run .sh scripts manually.

I still CANNOT for the life of me, figure out how to run a script on the Fire TV through ADB. I'm using terminal on Linux, directly connected to a FireTV Stick Gen 2 with full root. I can manually execute the commands in the script but I cannot execute the script(s)! So here's one of the scripts I'm trying to run... Script Could someone explain to me, how would I execute this script via ADB?
Edit: I solved my issue! The text needs to be in unix format!! I used dos2linux to fix all the scripts and they go without a hitch. So I put all the scripts into a folder. I right clicked on that folder and clicked open terminal. I then executed this code to batch convert all files in the folder to unix format.
Code:
find . -type f -print0 | xargs -0 dos2unix

Related

[Q] rooting slide in ubuntu

Hey If anyone can help i have a few questions about rooting the slide in ubuntu
the "loop" script will not run regardless of what i do....also i can't seem to get the phone to show up with adb devices when i am in the bootloader
i can see the phone when it is in the rom but for some reason it won't show in the bootloader
thanks in advance
just type
Code:
adb devices
in terminal, and then when you select recovery and press enter, press "ENTER, UP, ENTER, UP, ENTER, UP...) really fast...and hope it works! if not lather, rinse, repeat...
There are instructions in the rooting thread on making an equivalent script for MacOS (which should work under Linux as well.) If you tried to run a DOS batch file under Linux thinking it would work...well, that's a judgment for another day
-------------------------------------
Sent via the XDA Tapatalk App
The Mac script does not run as a sh script on linux.
(PS: don't for the ./ before adb on a linux term. (./adb etc...))
beartard said:
There are instructions in the rooting thread on making an equivalent script for MacOS (which should work under Linux as well.) If you tried to run a DOS batch file under Linux thinking it would work...well, that's a judgment for another day
-------------------------------------
Sent via the XDA Tapatalk App
Click to expand...
Click to collapse
Sent from my T-Mobile myTouch 3G Slide using Tapatalk
Ive got a loop script for linux that I can send you when I get home. And like Indikut said, don't forget to add "./" before adb.
chrisinaz said:
Ive got a loop script for linux that I can send you when I get home. And like Indikut said, don't forget to add "./" before adb.
Click to expand...
Click to collapse
No need for the ./ if you added the sdk tools folder to your PATH.
Why that MacOS script doesn't work in bash on Ubuntu is beyond me. It looks to be formatted correctly.
Code:
#!/bin/sh
while [ 1 ]; do
adb devices;
sleep .25;
done
You could always use the following equivalent:
Code:
#!/bin/sh
watch -n .25 adb devices;
done
Assuming adb is in your path, this would run it every 1/4 second. You could, of course, change it to suit your location for adb (/usr/local/bin/adb or other location).
Cool thanks ..I will try that for the loop script
The other issue I have is that I can't see my phone as a device when I type adb devices in the bootloader ...it works fine when the phone is in the rom tho....I tried searching for the problem but I can't seem to find a solution ....I may just have overlooked it tho
beartard said:
Why that MacOS script doesn't work in bash on Ubuntu is beyond me. It looks to be formatted correctly.
Code:
#!/bin/sh
while [ 1 ]; do
adb devices;
sleep .25;
done
You could always use the following equivalent:
Code:
#!/bin/sh
watch -n .25 adb devices;
done
Assuming adb is in your path, this would run it every 1/4 second. You could, of course, change it to suit your location for adb (/usr/local/bin/adb or other location).
Click to expand...
Click to collapse
thanks again for the help with my problem i have a feeling the macos script would of worked i was using the wrong command i ended up typing "sh loop.sh" and it ran the script ....alltho i don't see it spamming adb devices ...it seems to just output it one time ....
now all i have to do is get the phone to show up when its in the bootloader....off to the search button i go
newspeak said:
thanks again for the help with my problem i have a feeling the macos script would of worked i was using the wrong command i ended up typing "sh loop.sh" and it ran the script ....alltho i don't see it spamming adb devices ...it seems to just output it one time ....
now all i have to do is get the phone to show up when its in the bootloader....off to the search button i go
Click to expand...
Click to collapse
As soon as you hit power to go to recovery either A) Activate the stupid script or B) mash ENTER+UP+ENTER+UP+ENTER until your keys fall off. I only got it to work the latter way.
Also, in Linux I've found that you'll get ???????? NO PERMISSIONS unless you do sudo ./adb devices.
The first time you run adb in a session, it should be started with sudo, since that starts the adb daemon. After that, any normal user's permissions (like running the script) should be ok. Make it easy on yourself and copy the adb executable to some place in your path (I use /usr/local/bin/). That way, you can delete the entire SDK unless you have plans for developing apps for Android.
I tried using my second code snippet above as loop.sh. I didn't go any higher, but it really doesn't have to work really quickly. I went up to .5 (executing "adb devices" twice a second) and it worked fine. You won't see a scrolling output like you would in DOS. The screen just updates if/when new info comes up (like showing the phone offline or in recovery.) When you get to the phone icon with the red triangle, hit VolUp and Power at the same time to get the recovery menu. The rest of the normal root tutorial should work for you.
ok thanks again for the help so far....here is where i am at ...i put adb in /usr/local/bin ...i can use adb devices ....the script is working for me but now when i get to the point where i push over the first file it says permission denied
i make sure to start adb with sudo ....i even tried running everything from a root terminal but i still get the same thing....i have already tried killing the adb server and restarting it with root permissions ...i have tried pushing the file with devices still listed as offline
kind of at a loss
here is what i get btw
"[email protected]:~/androidsdk/tools$ adb push ota.zip /sdcard/update.zip
failed to copy 'ota.zip' to '/sdcard/update.zip': Permission denied
[email protected]:~/androidsdk/tools$
"
I'm using a pretty fresh install of Ubuntu Lucid. I haven't messed with my user's groups or anything, so it's still fairly stock.
All I've done is copied adb to /usr/local/bin. The first run of adb (adb devices) is done as root using sudo. You could try running "sudo adb root" to begin with, and see if that makes a difference. After that, I can run any adb push commands as the normal user in GNOME's terminal.
Assuming you're set up like I am, if you're getting a permissions error after doing that, I'd hazard a guess and say the problem is on the phone's side rather than the computer.
Check and make sure USB debugging is checked in your settings. Beyond that, I'm stumped.

[Q] Smart App Protector app password forgotten

Daughter installed an app named Smart App Protector on her Kindle Fire and forgot the password. The app prevents access to anything. Worked with Amazon and can't do anything that gets around it, they even deregistered it. Finally suggested going through Android Debugger Bridge. After researching, found this forum. Have searched for similar question. So,
1) Can ADB be used to remove that app and leave Kindle as it was?
2) If I need to reset to Stock, which set of instructions on this forum should I follow. Still downloading all of the Android SDK files and have downloaded Kindle Fire Utility 0.9.6, but haven't installed.
How familiar are you with adb and/or basic shell commands?
Complete novice
To use adb you must do so while booted into custom recovery since Amazon has disabled it.
Assuming you have custom recovery installed and you are rooted you need to search a few directories to find where the program and it's data are installed.
The directories (path to) are...
/data/app (for apks installed on internal memory)
/data/data (for app data stored on internal memory)
/system/app (for system apks, just in case)
/sdcard/android/data (for app data stored on sdcard)
You need to open a shell in adb
Code:
adb shell
...your prompt will change to a #. From here you'll need to know a couple commands.
Code:
ls
("ell ess" to list the files in a particular directory)
Code:
rm
(to remove or delete a particular file or directory)
First pick a directory and list the contents
Code:
ls /data/app
When you find the file or folder you want removed...
Code:
rm /data/app/problematic_file.apk
"Data" folders will only contain folders, not apks. Sometimes they are named kind of weird but if you look closely enough you can figure out the right one to delete.
If you are running 100% stock, you'll have to install custom recovery to go any further, even if you want to revert back to full stock.
thanks, but KFU status says ADB status is <offline> and boot status is <unknown>. Since I can't get past the 'enter password' screen on the Kindle, i can't change anything from it. From Windows Devices, it shows the Kindle as a Android ADB Interface, so the kfu must have loaded properly.
Make sure you're in recovery and reinstall your drivers if you have to.
http://forum.xda-developers.com/showpost.php?p=23747671&postcount=2
If you don't have access to recovery, you'll have to use fastboot to install it.

[Q] Kindle Fire (D01400) soft-brick

Hi all.
Yesterday, a friend of mine asked me if i know about tablets with android os, i told him that I know a little, and he challenged me to try to fix his daughter's kindle stuck at load screen (the one with colored triangles).
I accepted the challenge and started to research at forums about Kindle Fires stuck, i will resume my problem ....
I downloaded Firekit for linux (iḿ using Ubuntu 12.04) and started to try some commands. I got ADB console to connect on the device using
Code:
# adb shell
command, and started to run around the system inside the Kindle.
For some reason (noob nonsense action), I remounted /system partition as RW and ran (again, not knowing the side effects of that) the command wipe and chose ALL. Yes, i got the system folder cleaned and now i can't run commands on kindle console. I still can
Code:
#adb push
things inside the device. I'm not planning to buy a factory cable or build one, and, here is my question, is there a way to copy these binary files inside the /system folder again, without factory cable? Is there a place where i can find these binaries for download or a package containing them?
About the device: Kindle Fire (D01400)
Bootloader: Stock (Kindle fire logo)
Fastboot: Can't find compatible devices.
Rooted: Maybe (i got root logidn on command adb shell)
Thank you for helping.
Ok, I downloaded the Stock ROM from amazon and uploaded /system folder using adb.
Code:
#adb shell
now working, i got again kindle console as root but i couldn't find ls or rm on /system/bin and now, all environment variables are unset. Maybe a problem with home path (i'm logged as root).
any advice how to reset the root user's home?
Code:
# export
ANDROID_ASSETS
ANDROID_BOOTLOGO
ANDROID_CACHE
ANDROID_DATA
ANDROID_PROPERTY_WORKSPACE
ANDROID_ROOT
ASEC_MOUNTPOINT
BOOTCLASSPATH
DOWNLOAD_CACHE
EXTERNAL_STORAGE
LD_LIBRARY_PATH
LOOP_MOUNTPOINT
PATH
PWD
TERM
TERMINFO

Illegal instruction 132

Hi,
Admittedly, I don't know what I'm doing, yet. I'm trying to learn by compiling the rsync source to port to the phone. I've followed some different threads on compiling using the ndk. My phone has the latest marshmallow update from Verizon. Here's a list of things I've learned so far:
One cannot have an executables run on the sdcard.
/data/local/tmp doesn't appear to exist or is not writable if you aren't rooted
The 'Terminal' app does create a writable home directory that I can put the executable into.
Which takes me here ... I've "successfully" compiled rsync on my linux laptop. By successfully, I mean I have an executable. I have no idea if the executable is valid or not. Then I did this:
On the phone, I started the terminal app.
I typed 'cd' into the terminal app window which took me to a writable home directory under /data/user/0/........
I launched an FTP Server app.
I copied the rsync executable from the linux laptop to the phone's sd card using filezilla
In the phone's terminal window I cp'd from the /sdcard/rsync to the home dir of the terminal app
I chmodded the rsync to 555
I typed: rsync --help
That is when I see 'Illegal instruction 132'. I have no idea what this means. Can someone help?
Thanks!
I decide to bail on attempting to compile my own since I found the termux application. It allows for easy installation of rsync, tar, sshd and so forth. Really great!

Run a BAT File on Firestick?

Is it possible to run a Batch File on a Firestick? Trying to help people set their firesticks up and, I have written a Batch file using ADB that works well loading programs onto a firestick and installing them. That only works if someone is on my local network though. If I push all of the files to someone including the batch file, would you be able to run the batch file on a firestick?
trizzypballr said:
Is it possible to run a Batch File on a Firestick? Trying to help people set their firesticks up and, I have written a Batch file using ADB that works well loading programs onto a firestick and installing them. That only works if someone is on my local network though. If I push all of the files to someone including the batch file, would you be able to run the batch file on a firestick?
Click to expand...
Click to collapse
i have a firestick that i need setup and was going to do it over this weekend, if you can send me the stuff i can test
Batch files are for Windows only.
The easiest way to do this would be to put all your apks into a folder, along with the adb.exe, AdbWinApi.dll, and your batch file.
Have them enable ADB on their stick, and give them the folder. Here's an example of a batch file that would make it dead simple:
Code:
@echo off
set /p ip="Enter Fire TV IP: "
adb connect %ip%
adb install apks\example.apk
<other code here>
adb disconnect
This would be the example file tree:
Code:
| adb.exe
| AdbWinApi.dll
| example.bat
|
\---apks
example.apk
Then give this folder to the person
trizzypballr said:
Is it possible to run a Batch File on a Firestick? Trying to help people set their firesticks up and, I have written a Batch file using ADB that works well loading programs onto a firestick and installing them. That only works if someone is on my local network though. If I push all of the files to someone including the batch file, would you be able to run the batch file on a firestick?
Click to expand...
Click to collapse
You can run any shell script on a Fire TV: A First Script
rainman74 said:
You can run any shell script on a Fire TV: A First Script
Click to expand...
Click to collapse
Are we able to use ADB commands on a shell script on a firestick? Looking at a gethub .sh file for use on firesticks it looks like they are?
For simplicity sake here is a scaled down version of the goal. I want to put kodi.apk and terrarium.apk onto their firestick for them. I want to be able to connect via teamviewer and push a folder over that contains:
kodi.apk
terrarium.apk
a shell file
The goal is that either the shell file is triggered somehow or the person with the firestick in front of them runs it and it does the equivalent of what I can do from my computer with the batch file using:
adb install "kodi.apk"
adb install "terrarium.apk"
I tried googling shell script on a firestick and didnt have any luck besides finding the github of a firestick loader that i searched through.
trizzypballr said:
Are we able to use ADB commands on a shell script on a firestick? Looking at a gethub .sh file for use on firesticks it looks like they are?
For simplicity sake here is a scaled down version of the goal. I want to put kodi.apk and terrarium.apk onto their firestick for them. I want to be able to connect via teamviewer and push a folder over that contains:
kodi.apk
terrarium.apk
a shell file
The goal is that either the shell file is triggered somehow or the person with the firestick in front of them runs it and it does the equivalent of what I can do from my computer with the batch file using:
adb install "kodi.apk"
adb install "terrarium.apk"
I tried googling shell script on a firestick and didnt have any luck besides finding the github of a firestick loader that i searched through.
Click to expand...
Click to collapse
You don't need adb for that, I'll write you a script example later...
By the way, you could also execute adb commands if you reinstalled adb before (Amazon deliberately removed this). Do you have root rights on the sticks?
rainman74 said:
You don't need adb for that, I'll write you a script example later...
By the way, you could also execute adb commands if you reinstalled adb before (Amazon deliberately removed this). Do you have root rights on the sticks?
Click to expand...
Click to collapse
No the sticks are not rooted
trizzypballr said:
No the sticks are not rooted
Click to expand...
Click to collapse
ok, here is the example, that you can customize.
Code:
#!/bin/sh
pm install /sdcard/kodi.apk
pm install /sdcard/terrarium.apk
You have to save the sh file in Unix format (linefeed as line ends). The easiest way is to save it in Notepad++ as a Unix script file.
rainman74 said:
ok, here is the example, that you can customize.
Code:
#!/bin/sh
pm install /sdcard/kodi.apk
pm install /sdcard/terrarium.apk
You have to save the sh file in Unix format (linefeed as line ends). The easiest way is to save it in Notepad++ as a Unix script file.
Click to expand...
Click to collapse
I tried saving as .sh and also as .bash . The firestick gave the message that there is no program to run it. How can I make this runnable on a firestick
trizzypballr said:
I tried saving as .sh and also as .bash . The firestick gave the message that there is no program to run it. How can I make this runnable on a firestick
Click to expand...
Click to collapse
Code:
sh file.sh
or
Code:
chmod 755 file.sh
to make the text file executable, and then run
Code:
./file.sh
Google isn't your friend, is it?
rainman74 said:
Code:
sh file.sh
or
Code:
chmod 755 file.sh
to make the text file executable, and then run
Code:
./file.sh
Google isn't your friend, is it?
Click to expand...
Click to collapse
I did try to google but didnt google the correct thing apparently I tried Googling "how to run Unix File on Firestick" and a few variations of it with no luck. I appreciate all of your help though for sure!
Trying to figure out where to run this on the firestick, after googling it, it seems like I need to get to a command code somehow to run this? I was hoping it was executable. Can I make it executable on my computer and then when I push it to the firestick just click on it and it runs?
trizzypballr said:
I did try to google but didnt google the correct thing apparently I tried Googling "how to run Unix File on Firestick" and a few variations of it with no luck. I appreciate all of your help though for sure!
Trying to figure out where to run this on the firestick, after googling it, it seems like I need to get to a command code somehow to run this? I was hoping it was executable. Can I make it executable on my computer and then when I push it to the firestick just click on it and it runs?
Click to expand...
Click to collapse
You cannot shortcut a sh file to the Fire TV gui!
Use View attachment Terminal-Emulator-1.0.70.apk to manually execute a sh file.
If you want to start it by pressing a button I can recommend Terminal Shortcut, only this version View attachment Terminal-Shortcut-Pro-4.11_MOD.apk still works with the Fire Remote. Here you can include scripts accordingly. I have modified the version so that it cannot be updated by a newer one

Categories

Resources