Looking for ideas on why cmd.exe would not work on T-Mobile Wing? Also have tried the DOS prompt from a Pocket Controller-Pro connection yet while in the folder with pdocread I get:
1:\storage card\my files\page pool size>pdocread -l
Unknown command 'pdocread -l'
Any ideas?
Dave
try reading this
http://forum.xda-developers.com/showthread.php?t=255114&highlight=console
Thanks, with the simple change the registry alue:
HKEY_LOCAL_MACHINE\Drivers\Console\Output
To
to value 0 and cmd.exe now works as do batch files however pdocread.exe now failing with "could not execute", time for some more digging...
Hi,
I'm creating a simple update pack to replace fonts and apn
all very basic but for some reason i can get a clean run of a script that i want to run
this is the script
Code:
#!/sbin/sh
#
# This script gets 1 parameter - the directory which the new files are in (under /cache)
# he then go over each of them, finding where thier matching file in /system and /data are
# and replace them with the new file
# after going over the list of files we then delete the /cache/<name_of_dir>
#
# the purpose of this script is to not hardcoded the path of files we want to replace
#
# Created by dmanbuhnik
# Version 0.5 (12/03/2010)
find_replace_file() {
nfile=$1
dir=$2
echo $nfile
echo $dir
rfile=`find /system -name "$nfile"`
cp /cache/$dir/$nfile rfile
rfile=`find /data -name "$1"`
cp /cache/$dir/$nfile rfile
}
mount /system
mount /data
dir=$1
echo $dir
cd /cache/$dir
pwd
for from_list in * ; do
echo $from_list
find_replace_file $from_list $dir
done
rm -rf /cache/$dir
exit 0
and i'm calling it from the upate-script by:
Code:
show_progress 0.1 0
copy_dir PACKAGE:cache CACHE:
show_progress 0.2 0
run_program PACKAGE:listInstall.sh new_fonts
show_progress 0.2 0
run_program PACKAGE:listInstall.sh new_apn
but i get failures when trying to flash it:
Code:
E:Error in listInstall.sh
(Status 65280)
E:Failure at line 5:
run_program PACKAGE:listInstall.sh new_fonts
when running the script line by line - all good
but when I try to run the script i get weird failures:
Code:
: not foundh: line 12:
new_apn
': No such file or directory
': No such file or directory
: not foundh: line 22: }
: not foundh: line 23:
in /etc/fstabind /system
in /etc/fstabind /data
: not foundh: line 26:
new_apn
: not foundh: line 29:
/sdcard/g.sh: cd: line 30: can't cd to /cache/new_apn
: not foundh: line 31: pwd
/sdcard/g.sh: line 32: syntax error: unexpected word (expecting "do")
please help
The recovery images use execv() to call the program. This means that shell scripts are not supported.
that doesn't make sense, cyan runs the 'backuptools.sh' in the recovery (the script that backup and restore your close source application)
dmanbuhnik said:
that doesn't make sense, cyan runs the 'backuptools.sh' in the recovery (the script that backup and restore your close source application)
Click to expand...
Click to collapse
Indeed, you're correct. I was looking at the wrong code
Anyway, make sure that the script runs outside of the updatescript properly. Esp. be vary ofc the commands you use. The recovery environment is based on busybox versions of the commands, and the might not behave exactly the same way you expect them to do.
i tried running it as a normal script in recovery env
you can see that errors in the last part of my first thread
i don't understand why they are errors, as i said when running the script commands manually (line by line) everything is great, so i know the shell support the commands but
btw, thank you for you help
help? pls....
Did you get this fixed? I'm not familiar with shell scripting, hence I might be more hindrance than help, but no one else is posting, so...
1) I'd be inclined to rewrite the script to handle errors, rather than just assume they won't occur.
2) Why not upload a copy of your update.zip & maybe someone will try to test it? (obviously after backing up their own /system & /data)
3) In the new_font case, say, I understand looking in /system but why/where is there also a copy expected within /data to replace?
4) In find_replace_file, why is the 2nd -name pattern "$1" rather than "$nfile"
5) In find_replace_file, why is the destination for both cp's rfile & not $rfile?
not yet.
1) no problem but i can't seems to even run the script correctly, after i do i will handle everything
2) the update.zip is not important, the update-script is not running as it should in the recovery as a stand alone script, so lets fix that first and then launch it from the update.zip
3) i'm building this script for the future, i want to be ready if someone will decided to move the directories around
4) you are correct, i will fix that
5) mmm, that looks stupid... let me fix that
ok, no change
running the script in the recovery with:
Code:
/sdcard/listInstall new_fonts
will get:
Code:
/sbin/sh: ./listInstall.sh: not found
if i try with 'sh /sdcard/listInstall':
Code:
: not found.sh: line 12:
': No such file or directory
': No such file or directory
: not found.sh: line 22: }
: not found.sh: line 23:
in /etc/fstabind /system
in /etc/fstabind /data
: not found.sh: line 26:
: not found.sh: line 29:
listInstall.sh: cd: line 30: can't cd to /cache/
: not found.sh: line 31: pwd
listInstall.sh: line 32: syntax error: unexpected word (expecting "do")
dmanbuhnik said:
3) i'm building this script for the future, i want to be ready if someone will decided to move the directories around
Click to expand...
Click to collapse
The script is looking for files in locations in which they currently don't exist (as you say above, for the future), but then assumes find has returned the location of a file. You need to catch & deal with the cases where it says the file doesn't exist.
A general rule in programming is to construct your own code with rigour, but make no assumptions about your input being well behaved, including data you receive from external function calls. An obvious corollary is that you must handle errors.
Generous debug info is always a good idea when you get into a situation like this too.
BTW I've been stuck staring at even shorter sections of my own code in the past which I 'knew' should work. It's all part of the fun
dmanbuhnik said:
not yet.
1) no problem but i can't seems to even run the script correctly, after i do i will handle everything
2) the update.zip is not important, the update-script is not running as it should in the recovery as a stand alone script, so lets fix that first and then launch it from the update.zip
3) i'm building this script for the future, i want to be ready if someone will decided to move the directories around
4) you are correct, i will fix that
5) mmm, that looks stupid... let me fix that
ok, no change
running the script in the recovery with:
Code:
/sdcard/listInstall new_fonts
will get:
Code:
/sbin/sh: ./listInstall.sh: not found
if i try with 'sh /sdcard/listInstall':
Code:
: not found.sh: line 12:
': No such file or directory
': No such file or directory
: not found.sh: line 22: }
: not found.sh: line 23:
in /etc/fstabind /system
in /etc/fstabind /data
: not found.sh: line 26:
: not found.sh: line 29:
listInstall.sh: cd: line 30: can't cd to /cache/
: not found.sh: line 31: pwd
listInstall.sh: line 32: syntax error: unexpected word (expecting "do")
Click to expand...
Click to collapse
I know this is old, but I was wondering if anyone can solve this issue.
I have a similiar problem.
If I run the following from recovery after mounting /system:
Code:
if [ -s /system/etc/data2sd.on ]; then echo Presemt; else echo No; fi;
I get the output: Present
However, if I put it in a script:
Code:
#!/sbin/sh
if [ -s /system/etc/data2sd.on ];
then
mkdir /tmp/data2sd ;
cp /system/etc/data*.* /tmp/data2sd/ ;
echo "Data2SD exists" > /tmp/data2sd.os ;
else
#Do nothing
echo "Do nothing" ;
fi;
Code:
I get this error:
/tmp # sh /tmp/test.sh
sh /tmp/test.sh
: not foundh: line 10:
: not foundh: line 10:
Do nothing
: not foundh: line 10:
/tmp #
The line 10 seems to be fi;
Can anyone good at this explain?
I'm getting crazy ...
I have problems running this script, saved as /system/etc/tole.d/10sdcard:
Code:
#!/system/bin/sh
echo "+++ tolemaC 10sdcard";
if [ -e /dev/block/mmcblk0p2 ];
then
echo "+++ Mounting second SD partition on `getprop tole.sd2.path`";
/system/bin/busybox mount /dev/block/mmcblk0p2 /sdcard2;
fi;
Fist I wrote the script on windows using Notepad++, I saved the script as ANSI and I got this error:
Code:
# /system/etc/tole.d/10sdcard
/system/etc/tole.d/10sdcard
/system/etc/tole.d/10sdcard: not found
Then I saved the script using notepad++ as UTF-8, then I got this error:
Code:
# /system/etc/tole.d/10sdcard
/system/etc/tole.d/10sdcard
: not found/tole.d/10sdcard: ´╗┐#!/system/bin/sh
: not found
+++ Mounting second SD partition on /sdcard2
: not found
: not found
/system/etc/tole.d/10sdcard: 13: Syntax error: "fi" unexpected (expecting "then")
Appears some chars at the begining of first line.
Then I have saved the script on Linux using GEdit as UTF-8 and then I get this:
Code:
# /system/etc/tole.d/10sdcard
/system/etc/tole.d/10sdcard
+++ tolemaC 10sdcard
[: not found
It seems that the script now reads well but I don´t know what is wrong.
¿There is something wrong in the script?
¿any ideas?
Thanks in advance.
Solved!
I have found the way (for me)
I have to create the files as ANSI and saved as unix file.
Notepad++ have options for it.
Wanna just say thanks, I was wondering why my scripts weren't working
Thanks!
Ok heres the back story. I have been reading a lot on Android development and wanted to try.
I read the post by CM that said start with simple apps first. So thats what I did, I happened to find a source code for a camera application. Now that I have that I tried to run a make command and get the following errors
roid.mk: line 1: call: command not found
./Android.mk: line 1: LOCAL_PATH:=: command not found
./Android.mk: line 2: CLEAR_VARS: command not found
./Android.mk: line 2: include: command not found
./Android.mk: line 4: LOCAL_MODULE_TAGS: command not found
./Android.mk: line 6: call: command not found
./Android.mk: line 6: LOCAL_SRC_FILES: command not found
./Android.mk: line 8: LOCAL_PACKAGE_NAME: command not found
./Android.mk: line 9: LOCAL_SDK_VERSION: command not found
./Android.mk: line 11: LOCAL_PATH: command not found
./Android.mk: line 11: LOCAL_PROGUARD_FLAGS: command not found
./Android.mk: line 13: BUILD_PACKAGE: command not found
./Android.mk: line 13: include: command not found
./Android.mk: line 16: LOCAL_PATH: command not found
./Android.mk: line 16: call: command not found
./Android.mk: line 16: include: command not found
I'm a little confused at this point.
I am pretty familial with Linux ; thats all I run, and never ran into this problem; matter of fact I'm in school for linu/unix scripting and programming I'm also going to take C++ too.
so the point of trying this out was to get familial with developing, if anyone can give some insight that would be great. I'm not asking for someone to hold my hand ,but just to help maybe point me in the right direction with some clearer directions then the android open source provides.
Thank you and sorry if this is a dumb question
I'm developing my first application, and I'm curious if there are any "standard" ways for executing privileged shell commands. I've only been able to find one way to do it, by executing su, and then appending my commands to stdin of the su process.
Code:
Process p = Runtime.getRuntime().exec("su");
DataOutputStream pOut = new DataOutputStream(p.getOutputStream());
DataInputStream pIn = new DataInputStream(p.getInputStream());
String rv = "";
// su must exit before its output can be read
pOut.writeBytes(cmd + "\nexit\n");
pOut.flush();
p.waitFor();
while (pIn.available() > 0)
rv += pIn.readLine() + "\n";
I've read about wrapping privileged (superuser) calls up in JNI: is this possible? If so, how would one go about accomplishing it? Other than that, are there any other ways of calling privileged instructions from Java?
EDIT: Also, why exactly must su exit before I can capture it's output? When I read from the processes stdout before it has closed I get nothing.