[Q] SU Command from hook topic
Im trying to run a su command from within a hook,
But even though I grant the shell su access I still get error:
tmp-mksh: <stdin>[1]: can't create /system/sd/temporary.txt Read-only file system
Any ideas?
Code:
Process p;
try {
// Preform su to get root privledges
p = Runtime.getRuntime().exec("su");
// Attempt to write a file to a root-only
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
// Close the terminal
os.writeBytes("exit\n");
os.flush();
try {
p.waitFor();
if (p.exitValue() != 255) {
toastMessage("root");
return true;
} else {
toastMessage("not root");
}
} catch (InterruptedException e) {
toastMessage("not root");
}
} catch (IOException e) {
toastMessage("not root");
}
But even though I grant the shell su access I still get error:
tmp-mksh: <stdin>[1]: can't create /system/sd/temporary.txt Read-only file system
Any ideas?
xda-developers
0 commentaires:
Enregistrer un commentaire