Manually, we can run:
adb shell
su
chmod 666 /dev/graphics/fb0
export CLASSPATH=/data/local/device.jar
export LD_LIBRARY_PATH=/data/local
exec app_process /system/bin com.device.client.Main /data/local/device.conf &
However, we need to be able to run that from a bash script on the computer compiling the program.
I have tried:
adb shell "su
&& chmod 666 /dev/graphics/fb0
&& export CLASSPATH=/data/local/device.jar
&& export LD_LIBRARY_PATH=/data/local
&& exec app_process /system/bin com.device.client.Main /data/local/device.conf &"
But since we are entering the su shell, this does not work.
Can you please suggest a solution?
Try this:
adb shell "su -c '
chmod 666 /dev/graphics/fb0
&& export CLASSPATH=/data/local/device.jar
&& export LD_LIBRARY_PATH=/data/local
&& exec app_process /system/bin com.device.client.Main
/data/local/device.conf &'"
It might be possible to simplify it, too:
adb shell "su -c '
chmod 666 /dev/graphics/fb0 &&
CLASSPATH=/data/local/device.jar
LD_LIBRARY_PATH=/data/local
app_process /system/bin com.device.client.Main
/data/local/device.conf &'"
This is because you can set environment variables for one job just by prepending them on the line, rather than the export this, export that form.