What replaces stagefright? - Nexus S Android Development

I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Code:
#!/system/bin/sh
#I just made this into a script this was from a post on XDA by spiicytuna
#http://forum.xda-developers.com/showpost.php?p=8274824&postcount=2
#Please give the credit to him not me.
echo "preparing system..."
#Setting up the system for read/write access
mount -o remount,rw /system
#linking busybox mkdir (broken in rc2)
rm /system/bin/mkdir
ln -s /system/xbin/mkdir /system/bin/mkdir
mkdir -p /data/local/boot
echo "checking for previous bootsound installation..."
if [ -e /system/bin/bootsound ];
then
echo "bootsound already enabled, exiting.."
mount -o remount,ro /system
exit
fi
if [ "`ls /sbin|grep -q recovery;echo $?`" = "0" ];
then
mount -a > /dev/null
recoverymode=y
else
mount -o rw,remount /system
recoverymode=n
fi
echo "preparing startup scripts..."
#This is to create the needed scripts in init.local.rc
echo '' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo '###Bootsound - Safe to Delete: Start ###' >> /system/etc/init.local.rc
echo "" >> /system/etc/init.local.rc
echo 'service bootsound /system/bin/bootsound' >> /system/etc/init.local.rc
echo ' user media' >> /system/etc/init.local.rc
echo ' group audio' >> /system/etc/init.local.rc
echo ' disabled' >> /system/etc/init.local.rc
echo ' oneshot' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:init.svc.bootanim=running # to correct timin' >> /system/etc/init.local.rc
echo ' start bootsound' >> /system/etc/init.local.rc
echo '' >> /system/etc/init.local.rc
echo 'on property:dev.bootcomplete=1' >> /system/etc/init.local.rc
echo ' stop bootsound' >> /system/etc/init.local.rc
echo '### Bootsound - Safe to Delete: End ###' >> /system/etc/init.local.rc
echo "creating script for bootsound in /system/bin..."
echo '#Now creating the bootsound script'
touch /system/bin/bootsound
echo '#!/system/bin/sh' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'bprop=/system/build.prop' >> /system/bin/bootsound
echo '' >> /system/bin/bootsound
echo 'play=$(cat $bprop | egrep -c -i -o ro.config.play.bootsound=1)' >> /system/bin/bootsound
echo 'if [ "$play" = "1" ]; then' >> /system/bin/bootsound
echo ' stagefright -a -o /system/media/android_audio.mp3' >> /system/bin/bootsound #this is the line that breaks the code
echo 'fi' >> /system/bin/bootsound
echo 'exit 0' >> /system/bin/bootsound
#Changing some permissions
chmod 777 /system/bin/bootsound
chown root:shell /system/bin/bootsound
echo '' >> /system/build.pro
echo 'ro.config.play.bootsound=1' >> /system/build.prop
echo 'media.stagefright.enable-player=true' >> /system/build.prop
echo 'media.stagefright.enable-meta=true' >> /system/build.prop
echo 'media.stagefright.enable-scan=true' >> /system/build.prop
echo 'media.stagefright.enable-http=true' >> /system/build.prop
#removed self-destruct, script checks for previous install
sleep 1
mount -o ro,remount /system
echo "done."
exit

ethan_hines said:
I found a script that adds boot audio. In it there is a line calling stagefright, stagefright either doesn't exist on my ROM and I have no clue as to add it. Here is the script in question which I don't know the original author however lithid from http://forum.cyanogenmod.org did some work on it and was close to creating a updater-script. Please Help Me as I know some scripting but not a lot
PS I was advised to ask this question to the devs by a cyanogenmod.org mod named bassmadrigal
Click to expand...
Click to collapse
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!

thethiny said:
Not sure if this works , but I will eventually try it , but not now , on my free time.
stagefright indeed is not included , my phone too doesn't have stagefright , if you go to youtube and search for android developement tutorials by "thenewboston" . you'll find 200 videos series , just watch the first 20 ones and you'll learn to use Media which replaces stagefright...I didn't try it yet.
It includes
Our_Player and Media Player and the directory of the song....check it out and give us heads ups!
Click to expand...
Click to collapse
I appreciate the info, I took a look at his tutorials esp the ones involving animation, he really knows his stuff. I am not a Java programmer by any means and to be honest I find it quite tedious, it's like trying to teach a baby (this case the Dalvik VM) to do basic stuff like draw a green ball took like 20 lines of code!
What I need to know essentially is, do I have to use JAVA to get this to work now? In the past ie ICS and lower, there wasn't a problem with Custom Boot Audio, now with JB it seems it has disappeared from the radar.
I know the binary /system/bin/bootanimation (is this written in JAVA?, is there a source code for this bin?) is called at boot time by init.rc in the following manner:
Code:
service bootanim /system/bin/bootanimation
class main
user graphics
group graphics
disabled
oneshot
/system/bin/bootanimation (at least from what I gather) looks in /system/media for bootanimation.zip (zipped in store mode) decompresses it , looks at desc.txt for the code and displays the animation png by png.
In some desc.txt there is an s line, example:
Code:
# mobility
p 1 0 SOUND
s transdroid.mp3
which is SUPPOSED TO call a custom boot audio from /system/media (.mp3?) at the same time. This appears not to work. So logicaly I think the binary needs some tweaking. Can you offer any suggestions?
As you can see I have spent ALLOT of time mulling over why this,one would think, simple task: display a series of images and play audio at boot time I mean how hard can that be?
I am not trying to be a pest I just need to know WHY this doesn't work in JB (CM10.1)

Related

[Solved]Help to mount SDcard

Hi I built a little script to mount my SDcard @ startup of the phone and install some apps.
here it is:
Code:
sleep 2
busybox mount > /data/mount.txt
busybox ls /dev/block/vold >> /data/mount.txt
busybox mount -t vfat -o rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,shortname=mixed,utf8 /dev/block/vold/179:1 /sdcard >> /data/mount.txt
busybox mount >> /data/mount.txt
sleep 3
echo "APPS installation"
if [ -e /sdcard/Apps-install/install.txt ];
then
echo "found file" > /sdcard/Apps-install/install.txt
cd /sdcard/Apps-install
ls *.apk > ./apps.txt
for line in $(cat apps.txt); do install -c -D /sdcard/Apps-install/"$line" /data/app >> /sdcard/Apps-install/install.txt; done
echo "ok" >> /sdcard/Apps-install/install.txt
else
echo "file not found" > /sdcard/Apps-install/install.txt
fi;
sleep 2
echo "Finish"
if [ -e /data/firstboot.sh ];
then
busybox rm -f /data/firstboot.sh;
busybox rm -f /sdcard/Apps-install/apps.txt;
fi;
echo "Restart"
sleep 1
reboot
I'm sure that the code is well executed (as is have data in /data/mount.txt) but the mount of the SD and so every work related to the SD
What is strange is that script work if i execute it after the phone has completely started.
Can someone help please.
Bye
Herc.8)
A Little up for a little help
Hi,
I still need help,
thx by advance
Bye
Herc. 8)
Ok finally found bye myself.
I changed the device: /dev/block/vold/179:1 for /dev/block/mmcblk0p1
That's all.
Bye
Herc. 8)

I created a script for my rom. But..

Hi to all guys i'm developing a new rom and i'd like to put an executable script in it. I'm not very goot at bash,but you can help me. Here it is:
Code:
Welcome to openOptimus modding script!
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
read -p "Change boot animation" choice
read -p "Disable/enable Stagefright player" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Check Wi-Fi Tx-Power" choice
if test "$choice" == "1"
then
goto bootanim
fi
if test "$choice" == "2"
then
goto stagefright
fi
if test "$choice" == "3"
then
goto hwacc
fi
if test "$choice" == "4"
then
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
:bootanim
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read -p "Megatron boot animation" bootchoice
read -p "Android particles" bootchoice
read -p "CyanogenMod 7" bootchoice
read -p "Coin" bootchoice
if test "$bootchoice" == "1"
then
busybox cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
if test "$bootchoice" == "2"
then
busybox cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
if test "$bootchoice" == "3"
then
busybox cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
fi
if test "$bootchoice" == "4"
then
busybox cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
fi
:stagefright
Stagefright player enabler/disabler
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read -p "Enable Stagefright player" stagefright
read -p "Disable stagefright player" stagefright
if test "$stagefright" == "1"
then
busybox cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player enabled.
fi
if test "$stagefright" == "2"
then
busybox cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
:hwacc
echo
echo Hardware acceleration enabler/disabler
echo WARNING:This disables/enables Hwacc,but enables stagefright
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read -p "Enable Hardware acceleration" hwacc
read -p "Disable Hardware acceleration" hwacc
if test "$hwacc" == "1"
then
busybox cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
if test "$hwacc" == "2"
then
busybox cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
It's all ok? Please answer me,in my last three topics nobody answered me.
Uhh, what exactly is the problem?
The only problem I see in this is that you use multiple build.prop files for enabling/disable stagefright and hardware acceleration.
My suggestion is you use sed, a stream editor. This way, you won't need copying files from the folder and may actually make the code easier to read.
This is how I use sed. It creates a backup of the file, searches for the string to be replaced, and then replaces it.
Code:
sed -i.bak 's/ro.media.enc.jpeg.quality=90/ro.media.enc.jpeg.quality=100/g' /system/build.prop
If you plan on doing this, read more about sed. I've kinda forgotten the syntax since I made this 15 days ago and never really used it again. And yes, that's how fast I forget stuff
Thanks kpbotbot ur da man of xda. So,there are no syntax problems in the script except the build.prop? Maybe i can use setprop to disable/enable hwacc/stagefright. I read about setprop in franciscofranco's tweaks topic. Can i use it?
@kpbotbot ..i wanted to look at sed and your example just made it very easy
Lol no I'm not.
I'm not entirely sure how bash handles input. I haven't given scripting much time yet despite the fact that I've been on linux for quite some time xD The logic is in the script though. Have you tested it?
Regarding the franciscofranco's scripts, of course you can use them
I'm trying it with setprop. BTW,i don't wanna piss you off guys but take a look in Optimus One General. Take a look at "APKManager not working" It's very important.
I don't have any idea what in the world is wrong with APKManager since I don't use or plan on using it. What do you need it for anyway?
By the way, had a look at bash scripting. Why does this have 4 read lines?
Code:
read -p "Change boot animation" choice
read -p "Disable/enable Stagefright player" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Enable/disable Hardware acceleration" choice
read -p "Check Wi-Fi Tx-Power" choice
I've had a quick look on your script. First of all DON'T USE GOTO's!!!
You have two "read -p "Enable/disable Hardware acceleration" choice".
Code:
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
Why do you have iwconfig wlan0 lying there? If you don't have Wi-Fi on it will just simply output an error saying it's not on...
Use functions instead.
Try a little tutorial here (http://tldp.org/LDP/abs/html/functions.html) about functions. I didn't recommend using this a few minutes ago for some reason. Anyway, you may need to make a major rewrite to your script, but better readability and flow make it easier to maintain and trace errors.
I'm not sure if there are any other (or better) ways of doing this. Have a look at ruigui's script
kpbotbot said:
Use functions instead.
Try a little tutorial here (http://tldp.org/LDP/abs/html/functions.html) about functions. I didn't recommend using this a few minutes ago for some reason. Anyway, you may need to make a major rewrite to your script, but better readability and flow make it easier to maintain and trace errors.
I'm not sure if there are any other (or better) ways of doing this. Have a look at ruigui's script
Click to expand...
Click to collapse
I agree, functions would be better than the way you're doing atm.
Yea now i'm gonna take a look at ruigui's script.
Dudes i wanna ask you some:
When i cook my rom and change framework i get bootloop. This doesn't happen if i cook rom w/ original framework,or if i flash a zip that contains that particular framework.
And,i downloaded black mms apk from void and ringnofade. When i put 'em in my rom they force close! Why? Do i need to change classes.dex?
.
EDIT:I taked a look at ruigui's script,but this didn't help me. Please fix my script.
Thanks guys.
I don't know most of bash's syntax, so you do it
Here's how you should do it:
Create the functions. 1 for bootanim changer, 1 for enabling of hardware acceleration, 1 for SF, and 1 for the other one I forgot
Make the choosing part (the one with the reads)
Call appropriate function depending on choice
If you come to think of it this is actually easier than gotos.
ciaox said:
Dudes i wanna ask you some:
* When i cook my rom and change framework i get bootloop. This doesn't happen if i cook rom w/ original framework,or if i flash a zip that contains that particular framework.
Click to expand...
Click to collapse
Because you're not supposed to replace framework-res.apk because on the first boot, android checks signatures. It will get into a bootloop when it fails on that. (Experts please follow this up. I'm not sure).
Just replace the stuff inside the framework-res.apk with the stuff in the themed framework so as not to break signing. Just open framework-res.apk with an archiving tool and drag stuff onto it replacing the previous stuff. DO NOT EXTRACT
At least that's how I avoid bootloops. Try asking paolo how he did some of the stuff
EDIT: Also, do not resign framework-res.apk. You shouldn't sign it with a testkey xD
ciaox said:
EDIT:I taked a look at ruigui's script,but this didn't help me. Please fix my script.
Click to expand...
Click to collapse
We ain't gonna fix your script. If you come here with valuable questions after you did your research, then we can help and answer, if you come here asking for us to fix "your" work, sorry dude, ain't going to happen.
And about gotos, anyone that programmed anything in his/her life will know that gotos = problems and possible security holes.
@ciaox Got bored xD Made a script.
Try to look at mine. The code is straightforward so no need to explain them - http://forum.xda-developers.com/showpost.php?p=12510469&postcount=144
Don't use this as base though. Just look at the functions and how to call them. Then, make yours
franciscofranco said:
We ain't gonna fix your script. If you come here with valuable questions after you did your research, then we can help and answer, if you come here asking for us to fix "your" work, sorry dude, ain't going to happen.
And about gotos, anyone that programmed anything in his/her life will know that gotos = problems and possible security holes.
Click to expand...
Click to collapse
Man i'm sorry about dis,i will take a look at kpbotbot's script. Many thanks to everyone. Please keep thread open cuz i'm gonna need you guys..
oh man i get this. I can now call functions,i will let u know
Many thanks
[OT] I wanna integrate dspmanager in my rom but it doesn't work,and if i put libaudioflinger.so from cm7 by mik i can't hear anything. [/OT]
Yeah guys just rewrited my script! Now it must be ok! Check it out,i think it's OK.
Code:
#!/system/bin/sh
##########################################################################
# openOptimus tweaks v2 beta #
# Script created by ciaox. only for openOptimus ROM. #
# Copyright (c) ciaox 2011. #
##########################################################################
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
megatron(){
cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
}
particles(){
cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
}
cyan7(){
cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
}
coin(){
cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
}
boot(){
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read megatron
read particles
read cyan7
read coin
if test "$megatron" == "1"
then megatron
fi
if test "$particles" == "2"
then particles
fi
if test "$cyan7" == "3"
then cyan7
fi
if test "$coin" == "4"
then coin
fi
}
tx(){
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
}
sf(){
echo *********************************************************
echo *stagefright player enabler/disabler *
echo *********************************************************
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read sfon
read sfoff
if test "$sfon" == "1"
then sfon
fi
if test "$sfoff" == "2"
then sfoff
fi
}
sf(){
echo *********************************************************
echo * Hardware acceleration enabler/disabler *
echo *********************************************************
echo WARNING:This disables/enables Hwacc,but enables stagefright
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read hwon
read hwoff
if test "$hwon" == "1"
then hwon
fi
}
if test "$hwoff" == "2"
then hwoff
fi
}
echo *********************************************************
echo * Welcome to openOptimus modding script! *
echo *********************************************************
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
read boot
read sf
read hw
read tx
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi
if test "$hw" == "3"
then hw
fi
if test "$tx" == "4"
then tx
you called you hardware acceleration disabler/enabler as "sf" instead of "hw".
I think you should call a case loop instead of this:
Code:
read boot
read sf
read hw
read tx
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi. . . . . . .
which should be something like this:
Code:
read $option
case $option in
1)
boot
;;
2)
sf
;;
3)
hw
;;
4)
tx
;;
esac
or something like that. btw, what happens after you're finished with one tweak, let's say disabling/enabling stagefright? I think you should call you main menu as another function and just call it at the bottom of you script. not an expert, just giving some inputs.
Code:
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
What happened to setprop? Using multiple build.prop files will make it even more complicated. And if someone made modifications to their build.prop files then used this, they would lose their changes.
kpbotbot said:
Code:
hwon(){
cp /sdcard/openOptimus_resources/Hwacc1/build.prop /system
echo Hardware acceleration enabled.
fi
}
hwoff(){
cp /sdcard/openOptimus_resources/Hwacc2/build.prop /system
echo Hardware acceleration disabled.
fi
}
sfon(){
cp /sdcard/openOptimus_resources/Stagefright1/build.prop /system
echo Stagefright player enabled.
fi
}
sfoff(){
cp /sdcard/openOptimus_resources/Stagefright2/build.prop /system
echo Stagefright player disabled.
fi
}
What happened to setprop? Using multiple build.prop files will make it even more complicated. And if someone made modifications to their build.prop files then used this, they would lose their changes.
Click to expand...
Click to collapse
Oh yeah forgot this..will update script. Thx to ungaze for the tip i'm gonna add a main_menu function. And i will use case.
Ok i rewrited script again:
Code:
#!/system/bin/bash
##########################################################################
# openOptimus tweaks v2 beta 2 #
# Script created by ciaox. only for openOptimus ROM. #
# Copyright (c) ciaox 2011. #
##########################################################################
exit(){
echo Goodbye! And hope u will enjoy openOptimus (:
fi
}
hwon(){
setprop debug.sf.hw=1
echo Hardware acceleration enabled.
fi
}
hwoff(){
setprop debug.sf.hw=0
echo Hardware acceleration disabled.
fi
}
sfon(){
setprop media.stagefright.enable-player=true
setprop media.stagefright.enable-meta=true
setprop media.stagefright.enable-scan=true
setprop media.stagefright.enable-http=true
echo Stagefright player enabled.
fi
}
sfoff(){
setprop media.stagefright.enable-player=false
setprop media.stagefright.enable-meta=false
setprop media.stagefright.enable-scan=false
setprop media.stagefright.enable-http=false
echo Stagefright player disabled.
fi
}
megatron(){
cp /sdcard/openOptimus_resources/Megatron/bootanimation.zip /data/local
echo Boot animation copied.
}
particles(){
cp /sdcard/openOptimus_resources/Particles/bootanimation.zip /data/local
echo Boot animation copied.
}
cyan7(){
cp /sdcard/openOptimus_resources/CM7/bootanimation.zip /data/local
echo Boot animation copied.
}
coin(){
cp /sdcard/openOptimus_resources/Coin/bootanimation.zip /data/local
echo Boot animation copied.
}
boot(){
echo *********************************************************
echo * Boot animation changer *
echo *********************************************************
echo Please choose one:
echo 1.Megatron boot animation
echo 2.Android particles
echo 3.CyanogenMod 7
echo 4.Coin
read megatron
read particles
read cyan7
read coin
if test "$megatron" == "1"
then megatron
fi
if test "$particles" == "2"
then particles
fi
if test "$cyan7" == "3"
then cyan7
fi
if test "$coin" == "4"
then coin
fi
}
tx(){
echo You need to run this only if you have Wi-Fi on!
iwconfig wlan0
fi
}
sf(){
echo *********************************************************
echo *stagefright player enabler/disabler *
echo *********************************************************
echo Please choose an option:
echo 1.Enable Stagefright player
echo 2.Disable stagefright player
read sfon
read sfoff
if test "$sfon" == "1"
then sfon
fi
if test "$sfoff" == "2"
then sfoff
fi
}
sf(){
echo *********************************************************
echo * Hardware acceleration enabler/disabler *
echo *********************************************************
echo
echo Please choose an option:
echo 1.Enable Hardware acceleration
echo 2.Disable Hardware acceleration
read hwon
read hwoff
if test "$hwon" == "1"
then hwon
fi
}
if test "$hwoff" == "2"
then hwoff
fi
}
main_menu(){
echo *********************************************************
echo * Welcome to openOptimus modding script! *
echo *********************************************************
echo Choose an option:
echo 1.Change boot animation
echo 2.Disable/enable Stagefright player
echo 3.Enable/disable Hardware acceleration
echo 4.Check Wi-Fi Tx-Power
echo 5.Exit
read boot
read sf
read hw
read tx
read exit
if test "$boot" == "1"
then boot
fi
if test "$sf" == "2"
then sf
fi
if test "$hw" == "3"
then hw
fi
if test "$tx" == "4"
then tx
fi
}
if test "$exit" == "5"
then exit
fi
}

[Q] Build.prop edit on boot userinit.sh script

I'm trying to make a script that will do a modification to the build.prop on boot.
Usually I flash the cm7 nightly and I pull the build.prop, modify it and push it back before the first boot. The idea is to make it easier for flashing roms on the go. Using custom_backup_list.txt seems to be a viable option but it will keep an old build.prop indefinitely.
Some of the properties that I want to change are
Code:
windowsmgr.max_events_per_sec=100
ro.sf.lcd_density=201
ro.config.ringtone=_Mosquito 16bit.mp3
ro.config.alarm_alert=Alarm_Beep_02.ogg
From what I read today CM7 looks for inituser.sh file at two different locations:
Code:
/sd-ext/userinit.sh
/data/local/userinit.sh
As of now I have tried without success doing the following
Make a userinit.sh script at /data/local with the following code
Code:
#!/system/bin/sh
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
setprop windowsmgr.max_events_per_sec 100
setprop ro.sf.lcd_density 201
setprop ro.config.ringtone "_Mosquito 16bit.mp3"
setprop ro.config.alarm_alert Alarm_Beep_02.ogg
I'm not sure if there's something wrong in the above code, or CM7 is not running the scripts on boot.
EDIT: after adb push the file I do
Code:
adb shell
chmod 755 /data/local/userinit.sh
I've been trying for several hours now. Still get issue with stuck at X.
This is my updated script. Not sure what is wrong...
Using CM7 nightly36
cavs intersectraven
ss4n1 script
dtapp2sd
this is my userinit.sh at /data/local
Code:
#!/system/bin/sh
file=/system/.bproped
if [ -f "$file" ]; then
echo "Done already"
else
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
sed -i '/ro.config.ringtone/d' /system/build.prop
sed -i '/ro.config.alarm_alert/d' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "ro.config.ringtone=_Mosquito 16bit.mp3" >> /system/build.prop
echo "ro.config.alarm_alert=Alarm_Beep_02.ogg" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo > /system/.bproped
fi;
exit 0
I know where you're coming from. Takes a while to customize your phone manually after each nightly, so I actually have a custom script similar to what you're doing, which updates build.prop and other config files (hosts, gps.conf, etc). Only mine is run within the update.zip, using the recovery shell /sbin/sh.
For your method, you can try this ...
Code:
#!/system/bin/sh
MODIFIED=`cat /system/build.prop|grep "zeus_chingon"`
if [ "$MODIFIED" ];
then
echo "Done already"
else
mount -o remount,rw /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
RINGTONE=`cat /system/build.prop|grep "ro.config.ringtone"`
sed -i 's/$RINGTONE/ro.config.ringtone=_Mosquito_16bit.mp3/g' /system/build.prop
ALARM=`cat /system/build.prop|grep "ro.config.alarm_alert"`
sed -i 's/$ALARM/ro.config.alarm_alert=Alarm_Beep_02.ogg/g' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo "# Modified by zeus_chingon" >> /system/build.prop
mount -o remount,ro /system
fi
EDIT:
My own custom script is HERE. Feel free to modify for your own use.
ch33kybutt said:
I know where you're coming from. Takes a while to customize your phone manually after each nightly, so I actually have a custom script similar to what you're doing, which updates build.prop and other config files (hosts, gps.conf, etc). Only mine is run within the update.zip, using the recovery shell /sbin/sh.
For your method, you can try this ...
Code:
#!/system/bin/sh
MODIFIED=`cat /system/build.prop|grep "zeus_chingon"`
if [ "$MODIFIED" ];
then
echo "Done already"
else
mount -o remount,rw /system
sed -i 's/ro.sf.lcd_density=240/ro.sf.lcd_density=202/g' /system/build.prop
RINGTONE=`cat /system/build.prop|grep "ro.config.ringtone"`
sed -i 's/$RINGTONE/ro.config.ringtone=_Mosquito_16bit.mp3/g' /system/build.prop
ALARM=`cat /system/build.prop|grep "ro.config.alarm_alert"`
sed -i 's/$ALARM/ro.config.alarm_alert=Alarm_Beep_02.ogg/g' /system/build.prop
echo "ro.telephony.call_ring.delay=1000" >> /system/build.prop
echo "windowsmgr.max_events_per_sec=100" >> /system/build.prop
echo "# Modified by zeus_chingon" >> /system/build.prop
mount -o remount,ro /system
fi
EDIT:
My own custom script is HERE. Feel free to modify for your own use.
Click to expand...
Click to collapse
Thanks for your help, I end up using your zip file with some modification. The problem that I keep encountering is that using the /data/local/userinit.sh method it get stuck on boot at X.
I saw in your buildprop.sh some settings like
Code:
ro.HOME_APP_ADJ=1
ro.HOME_APP_MEM=3072
what does each one do?
I use LauncherPro if that have anything to do with it.
ro.HOME_APP_ADJ determines oom_adj value and ro.HOME_APP_MEM determines memory threshold, for your chosen launcher app. In short, these settings help to keep the launcher resident in memory and thus reduce homescreen lag.
One thing you have know about the ro.* settings in build.prop, are that they are writeable one-time only, i.e. once any ro.* value has been set, it becomes read-only and you cannot use setprop to change it further.
So it seems that your orginal buildprop.sh script add to the first line of build prop by using the
Code:
sed -i '1i\Something' /system/build.prop;
to put it in "higher priority" so that it get run first and overlook the second occurence that might occur in the build.prop afterwards?
So if i want to add something to line number n it would be
sed -i 'ni\something' .......
zeus_chingon said:
So it seems that your orginal buildprop.sh script add to the first line of build prop by using the
Code:
sed -i '1i\Something' /system/build.prop;
to put it in "higher priority" so that it get run first and overlook the second occurence that might occur in the build.prop afterwards?
So if i want to add something to line number n it would be
sed -i 'ni\something' .......
Click to expand...
Click to collapse
That's correct.
Build.prop
Hi All,
By default my System folder didn't had the build.prop. i extracted it from the CM7 Rom made some changes and copied it to System folder and rebooted.
Changes ringtone(default) Playa.ogg to Rigel.ogg.
After reboot still Playa.ogg as my default ringtone.
What is figured was my Phone isnt including build.prop file
Any suggestions?
Thanx
Wildfire Rooted(CM7 Nightly 2.3.5)

[Q] Odex Script For User (/data/app) Apps :)

Dear bros and members here,
I want some script for using dexopt-wrapper to some location
Example: if there is file in (/sdcard/app)
then the script should prompt two request:
the first is the apk file name
and the other is the odex file name and should execute
dexopt-wrapper /sdcard/app/name.of.the.apk /sdcard/app/name.of.the.odex
Please, I want this in shell script
Here you are:
Code:
#!/system/bin/sh
# In the name of Allah
tmp=/data/local/tmp
mkdir $tmp > /dev/null 2>&1
BCP="`cat /init.rc | grep BOOTCLASSPATH`"
echo $BCP>$tmp/fbcp.txt
sed -e 's/export BOOTCLASSPATH //g' $tmp/fbcp.txt>$tmp/bcp.txt
BCP="`cat $tmp/bcp.txt`"
rm $tmp/fbcp.txt
rm $tmp/bcp.txt
echo "Please enter the name of app to odex:"
echo "Example: Browser"
echo "--->"
read APP
if [ ! -f /sdcard/app/${APP}.apk ]; then
echo "Requested app not found."
echo "Please check the app name again."
else
dexopt-wrapper /sdcard/app/${APP}.apk /sdcard/app/${APP}.odex ${BCP}
zip -d /sdcard/app/${APP}.apk classes.dex
echo "Done!"
fi;
Sent from my E15i using Tapatalk 2
Ahmad.H said:
Here you are:
Code:
#!/system/bin/sh
# In the name of Allah
tmp=/data/local/tmp
mkdir $tmp > /dev/null 2>&1
BCP="`cat /init.rc | grep BOOTCLASSPATH`"
echo $BCP>$tmp/fbcp.txt
sed -e 's/export BOOTCLASSPATH //g' $tmp/fbcp.txt>$tmp/bcp.txt
BCP="`cat $tmp/bcp.txt`"
rm $tmp/fbcp.txt
rm $tmp/bcp.txt
echo "Please enter the name of app to odex:"
echo "Example: Browser"
echo "--->"
read APP
if [ ! -f /sdcard/app/${APP}.apk ]; then
echo "Requested app not found."
echo "Please check the app name again."
else
dexopt-wrapper /sdcard/app/${APP}.apk /sdcard/app/${APP}.odex ${BCP}
zip -d /sdcard/app/${APP}.apk classes.dex
echo "Done!"
fi;
Sent from my E15i using Tapatalk 2
Click to expand...
Click to collapse
Thanks a lot bro!
There's a syntax error.
I type in the terminal and output is looked like this
/sdcard/odex.sh: 4: Syntax error: Bad fd number
anyway, I fix it to
line 4: mkdir $tmp > /dev/null 2&>1
but it still doesn't work..
Many errors in shell script.. Please test it and correct something.. Please bro..
I really like your script if it would be executable because it has classes.dex delete function..
Thanks

Badly made antivirus script I created

Bash:
#This script is satire. This is, like, the worst antivirus ever.
tput setaf 2
echo "Welcome to Web Antivirus."
echo "Make sure you are running this from a live Linux image as the root user."
lsblk
echo "Select your Windows drive: "
read drive
mount $drive /mnt
cd /mnt/Windows/system32/etc
wget https://github.com/T145/black-mirror/releases/download/latest/black_domain.txt >> /dev/null
wget https://github.com/T145/black-mirror/releases/download/latest/black_ipv4.txt >> /dev/null
echo "Downloaded blacklists."
cp hosts.txt hosts.txt.bak
mawk '{print "0.0.0.0 " $0}' black_domain.txt >> hosts.txt
echo "Wrote domain blacklist."
mawk '{print "0.0.0.0 " $0}' black_ipv4.txt >> hosts.txt
echo "Wrote IPv4 blacklist"
rm -f black_domain.txt black_ipv4.txt
echo "Deleted temporary files."
cd /mnt
echo "@echo off" > clean.bat
echo "del %userprofile%\\Downloads\\*.exe" >> clean.bat
echo "Created cleaner script."
echo "Put this in Task Scheduler so it runs at regular intervals."
echo "Options:"
echo "Type \"restore\" to restore original /etc/hosts."
echo "Type \"exit\" to leave."
echo "Select an option: "
alias restore="rm -f hosts.txt && mv hosts.txt.bak hosts.txt"
read option
$option

Categories

Resources