FORUMS
Remove All Ads from XDA

[TRICK/CWM3/EDIFY] Output to recovery UI from shell script

11,416 posts
Thanks Meter: 88,052
 
By Chainfire, Moderator Emeritus / Senior Recognized Developer - Where is my shirt? on 5th April 2011, 02:14 PM
Post Reply Email Thread
27th March 2019, 10:01 AM |#41  
Senior Member
Thanks Meter: 109
 
More
In your script, add a echo in ui_print function. This will send everything to fd and stdout simultaneously
 
 
27th March 2019, 05:01 PM |#42  
Recognized Developer / Recognized Contributor
Thanks Meter: 4,266
 
Donate to Me
More
Quote:
Originally Posted by AxelBlaz3

I have a query, what if I'd like to run the script from terminal emulator after extracting zip manually? Is it possible? I know it can't figure out the FD. But I'm curious to know if there's a way to run such scripts from terminal.

The fd for stdout is 1, so you can simply use that.
27th March 2019, 05:30 PM |#43  
AxelBlaz3's Avatar
Member
Flag Hyderabad
Thanks Meter: 58
 
More
Quote:
Originally Posted by _that

The fd for stdout is 1, so you can simply use that.

Thank you . I can run scripts a way better now. Now I've to fix some errors he he.
27th March 2019, 06:54 PM |#44  
Senior Member
Thanks Meter: 109
 
More
Quote:
Originally Posted by AxelBlaz3

I have a query. I'm executing the anykernel.sh from terminal emulator (I've manually copied the files to /tmp/anykernel/ after reading the script a while). Everything's fine so far. However, while executing the script, there's a command that needs to create the OUTFD in /proc/self/fd/. I get an error saying Cannot create directory. Yes, that's due to the reason that /proc is just a virtual file system AFAIK. When I try to chmod that for write permissions, it again pops Operation not permitted(Yes, that's again due to the /proc's virtual nature). Is ther any workaround for this? Thank you.

i think you just have not set a value for OUTFD, or you have a typo (missing $)
Code:
echo -e "ui_print Hello World\nui_print" > /proc/self/fd/$OUTFD
you may use Chainfire's version of ui_print from OP to avoid this and make scripts working for both, recovery or terminal (it will switch, even better than simultaneously)
28th March 2019, 02:44 AM |#45  
AxelBlaz3's Avatar
Member
Flag Hyderabad
Thanks Meter: 58
 
More
Quote:
Originally Posted by aIecxs

i think you just have not set a value for OUTFD, or you have a typo (missing $)

Code:
echo -e "ui_print Hello World\nui_print" > /proc/self/fd/$OUTFD
you may use Chainfire's version of ui_print from OP to avoid this and make scripts working for both, recovery or terminal (it will switch, even better than simultaneously)

Nope, I figured it out. No problem. Thanks for your help
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes