Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Help][Bash][build.prop]Developers only!

$
0
0
Hello everyone, i just wanted help with my Bash script!
I usually flash nightlies and when ever i flash them, i lose my tweaks :(
So i decided creating a bash script for myself,
Here's how it is....

Code:

#!/system/bin/sh

## personal file
tweaks=/sdcard/tweaks

build=/system/build.prop

## loop trough $tweak

sed -r '/(#.*|^ *$)/d;/.*=.*/!d;$a' $tweak | while read line
do
        ## get entry from $tweak
        entry=$(echo $line | sed "s/=.*//")

        ## if variable already present in $build
        if cat $build | grep -q $entry
        then
                ## override value in $build if different
                if ! cat $build | grep -q $(cat $tweak | grep $entry)
                then
                        sed -i "s/^${entry}=.*$/${line}/g" $build
                fi
        else
                echo $line >> $build
        fi
done

Everything works but i wanted to keep this process running (For testing purposes),
I mean after my tweaks/values get replaced, i want the same thing to happen with other values!

Eg:- /sdcard/tweak= Contains line= ro.build.model=Nexus 5,
Same file contains ro.build.model=Xperia Z,
now what i want my script to do is, First replace my phone model with Nexus 5 and after some time change it with Xperia Z without starting/stopping any other script!

But i aint too good at this!
So i require a helping hand!

I hope you get my point.

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>