FORUMS

Voices Of XDA: Orbiting The Earth With Android

Editor’s note: This week’s feature has been written by forum … more

CloudPlayer: DIY HiFi Music Streaming Solution

In our Helpful Guide to Music Streaming Services, we mentioned several different services … more

Optimize Battery Life with This Useful App

Battery life is an important aspect of your smartphone, especially if you use it for more … more

The OnePlus 2 & The Year of Smartphone Compromises

We are very close to entering the last third of 2015, and we have now seen many of … more

[TOOL][BOOT SCRIPTS] bse

1,658 posts
Thanks Meter: 1,795
 
Post Reply Subscribe to Thread Email Thread
Hello, all!

I have recently built a tool that allows users to more efficiently create and run scripts on boot.
These can be python scripts if you have python installed to your system (No, SL4A won't work. At least, not without some work). Usually though, they are bash or sh scripts.
They can be used to do various things, such as fix permissions every reboot, or things such as record a log of the time of every time you boot up your device, or other cool things.

I am currently looking into getting python packed into a flashable zip (lots of more fun with python scripts like showing a toast notification on boot).

To use bse's scripts executing feature, you must place the script you wish to execute under /system/etc/startup. You don't need to worry about chmodding it, there is an init script that does that already. For reference purposes, I recommend you read the contents of that init script (it's in /system/etc/startup).

To clarify, anyone who wants to build an automated installer for this, distribute some scripts, or distribute any modification to be, you have my full permission as long as you provide a link to this thread.

DOWNLOAD
https://docs.google.com/file/d/0Byul...p=docslist_api

INSTALLATION
- Just flash the zip file in the recovery of your choice


If you have any questions, feel free to ask. I'm sorry, this was written when I was tired (Not the program, the post)

Sent from my Nexus 7 using Tapatalk
The Following 10 Users Say Thank You to r3pwn For This Useful Post: [ View ]
 
 
28th February 2014, 01:30 AM |#2  
r3pwn's Avatar
OP Recognized Developer / Recognized Contributor
Thanks Meter: 1,795
 
Donate to Me
More
FAQ:
What does "bse" stand for?
If you were to run bse alone, you would see that it stands for "Boot Script Executer".

Is BSE open-sourced?
Almost. I lost the source code and I'm in the process of re-creating it from scratch.

Where is the open source repo?
It's at https://github.com/boot-script-executer. PM me with your Github email if you wish to contribute to BSE development or submit your bse scripts. (please tell me which one)


Sent from my Nexus 7 using Tapatalk
Last edited by r3pwn; 24th March 2014 at 01:30 AM.
The Following 4 Users Say Thank You to r3pwn For This Useful Post: [ View ]
23rd March 2014, 01:47 PM |#3  
Guest
Thanks Meter: 241
 
More
Can we have a github source of all the scripts so we can execute in the Roms and execute it in the android source
23rd March 2014, 03:23 PM |#4  
cybojenix's Avatar
Forum Moderator / Retired Recognized Developer / XDA Portal Team
Thanks Meter: 1,858
 
Donate to Me
More
nice idea

how about adding in a log wrapper to forward all output to the logcat

note: this is untested, but it should work
Code:
function logger() {
    # args:
      # $1 = message - the message you want to show
      # $2 = priority - optional, defaults to i. the priority you want to give the log message
    export LOG="/system/bin/log"
    tag="BSE_LOGGER"
    message=${1}
    priority="i"
    if [[ $2 ]]
    then
        options="vdiwe"
        if test "${options#*$2}" == "$options"
        then
            $LOG -p "e" -t "$tag" "invalid priority level: $2"
        else
            priority=$2
        fi
    fi
    $LOG -p "$priority" -t "$tag" "$message"
}
examples:
Code:
logger "this is a random message"
# I/BSE_LOGGER(15836): this is a random message
logger "another random message" d
# D/BSE_LOGGER(17393): another random message
logger "this message should give an error" t
# E/BSE_LOGGER(17395): invalid priority level: t 
# I/BSE_LOGGER(17396): this message should give an error
Last edited by cybojenix; 23rd March 2014 at 03:52 PM.
23rd March 2014, 03:24 PM |#5  
Maribou's Avatar
Senior Member
Flag Oklahoma City
Thanks Meter: 622
 
More
This is freaking awesome r3. Good job bro.
*Starts slow clapping. Waiting for other people to join in.* ☺

Sent from my SAMSUNG-SGH-I337 using XDA Premium 4 mobile app
23rd March 2014, 03:49 PM |#6  
Ricky Divjakovski's Avatar
Recognized Developer / Recognized Contributor
Flag Sydney
Thanks Meter: 5,548
 
Donate to Me
More
Quote:
Originally Posted by cybojenix

nice idea

how about adding in a log wrapper to forward all output to the logcat

note: this is untested, but it should work
Code:
function logger() {
    # args:
      # $1 = message - the message you want to show
      # $2 = priority - optional, defaults to i. the priority you want to give the log message
    export LOG="/system/bin/log"
    tag="BSE_LOGGER"
    message=${1}
    priority="i"
    if [[ $2 ]]
    then
        options="vdiwe"
        if test "${options#*$2}" == "$options"
        then
            $LOG -p "e" -t "$tag" "invalid priority level: $2"
        else
            priority=$2
        fi
    fi
    $LOG -p "$priority" -t "$tag" "$message"
}

i like the thought of this!
The Following User Says Thank You to Ricky Divjakovski For This Useful Post: [ View ]
23rd March 2014, 06:30 PM |#7  
-CALIBAN666-'s Avatar
Recognized Contributor
Flag Leverkusen-Wiesdorf
Thanks Meter: 3,905
 
Donate to Me
More
this is realy cool,great idea and work,thanx man.
23rd March 2014, 07:17 PM |#8  
eushaun99's Avatar
Senior Member
Flag Subang Jaya
Thanks Meter: 923
 
More
Sorry if this sounds like a stupid question, but what's the difference between using init.d and your tool or even using script manager to run scripts at boot?

Sent from my GT-P7500 using Tapatalk
24th March 2014, 01:51 AM |#9  
r3pwn's Avatar
OP Recognized Developer / Recognized Contributor
Thanks Meter: 1,795
 
Donate to Me
More
Hehe. Funny story about this. All of its source code (There wasn't too much... Don't worry) was on my trusty (not really) old Kindle Fire HD, which I managed to brick. I will have to re-write the source (Again, I didn't really lose that much) and I'll make everything open-sourced (see 2nd post if you want to help contribute).



Quote:
Originally Posted by cybojenix

nice idea ...

Thanks... I will try to see if I can implement that. If I have no sucess, you could try for yourself once I get everything re-written.
24th March 2014, 05:29 AM |#10  
Ricky Divjakovski's Avatar
Recognized Developer / Recognized Contributor
Flag Sydney
Thanks Meter: 5,548
 
Donate to Me
More
Quote:
Originally Posted by eushaun99

Sorry if this sounds like a stupid question, but what's the difference between using init.d and your tool or even using script manager to run scripts at boot?

Sent from my GT-P7500 using Tapatalk

init.d triggered through the rom not the kernel, and it supports python scripts aswell
24th March 2014, 03:24 PM |#11  
Senior Member
Thanks Meter: 112
 
More
Quote:
Originally Posted by ricky310711

init.d triggered through the rom not the kernel, and it supports python scripts aswell

Hi
I didn't understand this answer...
This solution also relies on init.d. Apart from python interpreting, what's the thing that makes it more robust aganist init.d scripts?
If a Rom (it's kernel) does not or only via 3rd part apps supports init.d, there could be problems the same.

Read More
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes