Bump! Workaround for the LG G3 Locked Bootloader – XDA TV

The LG G3 is a power house device. It’s been a favorite of many people. … more

Enable Call Recording on Xperia Z2 and Z3

Call recording, while not legal in every part of the world, is quite handy in certain situations. … more

Google Play Store Payments Available in China

Google has taken a big step to make its services accessible globally. Since the introduction of … more

How to Set a Video as Your Boot Animation

If you wish to make your phone truly unique, you may want to consider adding a nice boot animation. … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[TOOL][BOOT SCRIPTS] bse

OP r3pwn

28th February 2014, 02:18 AM   |  #1  
r3pwn's Avatar
OP Recognized Contributor
Thanks Meter: 1,312
 
1,191 posts
Join Date:Joined: Jul 2012
Donate to Me
More
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, 02:30 AM   |  #2  
r3pwn's Avatar
OP Recognized Contributor
Thanks Meter: 1,312
 
1,191 posts
Join Date:Joined: Jul 2012
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 02:30 AM.
The Following 4 Users Say Thank You to r3pwn For This Useful Post: [ View ]
23rd March 2014, 02:47 PM   |  #3  
Guest
Thanks Meter: 241
 
0 posts
Join Date:Joined: Jan 1970
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, 04:23 PM   |  #4  
cybojenix's Avatar
Recognized Developer
Thanks Meter: 1,580
 
834 posts
Join Date:Joined: Apr 2012
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 04:52 PM.
23rd March 2014, 04:24 PM   |  #5  
Maribou's Avatar
Senior Member
Flag Oklahoma City
Thanks Meter: 609
 
537 posts
Join Date:Joined: Nov 2012
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, 04:49 PM   |  #6  
Ricky Divjakovski's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 5,352
 
3,613 posts
Join Date:Joined: Feb 2013
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, 07:30 PM   |  #7  
-CALIBAN666-'s Avatar
Recognized Contributor
Flag Leverkusen
Thanks Meter: 3,594
 
5,807 posts
Join Date:Joined: Feb 2012
Donate to Me
More
this is realy cool,great idea and work,thanx man.
23rd March 2014, 08:17 PM   |  #8  
eushaun99's Avatar
Senior Member
Flag Subang Jaya
Thanks Meter: 903
 
1,834 posts
Join Date:Joined: Feb 2013
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, 02:51 AM   |  #9  
r3pwn's Avatar
OP Recognized Contributor
Thanks Meter: 1,312
 
1,191 posts
Join Date:Joined: Jul 2012
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, 06:29 AM   |  #10  
Ricky Divjakovski's Avatar
Recognized Contributor
Flag Sydney
Thanks Meter: 5,352
 
3,613 posts
Join Date:Joined: Feb 2013
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

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

Advanced Search
Display Modes