[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Chris, I am only trying to justify my questioning on this forum. The steps mentioned on the rsync wiki work on a emulator. I assumed it would work on the device since it does on the emualtor. I was wondering what I was doing wrong, so wrote a piece of shareable code that can put up on a public forum. Obviously you will realize that I cannot put up production quality code up here. By the way, I am not getting personal. I will and have not written anything derogatory. All I said was I assumed that the rsync guys would have tried it out on a real device, but may be its just in beta stage now. Again, I am only trying to justify my questioning on this forum. I used android sdk to develop a app to auto deploy a tool that I believe is helpful. It works on a emulator, does not on a device. Thats it.. Yes, I did put up a question and a marked a bug on the rsync project too. I politely request that you refrain from be derogatory on a public forum. This is my last mail on this topic. Conny On Sep 18, 8:43 am, Chris crehb...@gmail.com wrote: On Saturday, September 17, 2011 10:45:46 PM UTC-4, Conny wrote: I was assuming that the developers of that app would have done enough research to get it to work on a real device. I guess not enough. And what lead you to believe that 'rsync droid' was a part of the SDK or has anything whatsoever to do with this mailing list? If you want to make some kind of point about some developers of 'rsync droid' not 'having done research' we can start with your utter butchering of the Java language referenced in your op. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Guys, obviously I understand that /system/bin is read only, I would be blind not to be able to read the error messages. But the question is if I do need to get rsync into the bin folder what do I need to do. Rsync is a important feature to have on the android device. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. Since there are so many smart people up here, please do share some hints/direction. Thanks for your comments Conny On Sep 16, 9:10 pm, Chris crehb...@gmail.com wrote: On Friday, September 16, 2011 5:02:43 AM UTC-4, Conny wrote: May be forgetting my basics here. I sincerely doubt you ever understood your basics to begin with. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Data files don't go on /system, so what you are trying to do doesn't make sense. Nor is it possible for normal applications to do. A good Android device will not allow /system to be mounted read/write under normal operation. On Fri, Sep 16, 2011 at 11:35 PM, Conny mcon...@gmail.com wrote: Guys, obviously I understand that /system/bin is read only, I would be blind not to be able to read the error messages. But the question is if I do need to get rsync into the bin folder what do I need to do. Rsync is a important feature to have on the android device. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. Since there are so many smart people up here, please do share some hints/direction. Thanks for your comments Conny On Sep 16, 9:10 pm, Chris crehb...@gmail.com wrote: On Friday, September 16, 2011 5:02:43 AM UTC-4, Conny wrote: May be forgetting my basics here. I sincerely doubt you ever understood your basics to begin with. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
On Sat, Sep 17, 2011 at 1:46 AM, Conny mcon...@gmail.com wrote: But the question is if I do need to get rsync into the bin folder what do I need to do. Install some alternative firmware that has rsync in it. Or, root your phone. Or, don't put rsync in /system, since AFAIK you don't need it in /system. Rsync is a important feature to have on the android device. You are welcome to your opinion. It is my opinion that this has absolutely nothing to do with this list. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. Sounds like you need a better server. Beyond that, though, if you're willing to deal with multiple CPU ports of rsync, you shouldn't need it in /system to run it, any more than you need a binary in desktop Linux to be in /usr/bin to run it. If you are so smart, why dont u try to give me some direction/hints. Because this has nothing to do with this list. After all the group is meant just for that right ? No. It is meant for developing Android applications with the SDK. rsync has nothing to do with the Android SDK. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in Oslo: http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Thanks Murphy.. On Sep 17, 5:24 pm, Mark Murphy mmur...@commonsware.com wrote: On Sat, Sep 17, 2011 at 1:46 AM, Conny mcon...@gmail.com wrote: But the question is if I do need to get rsync into the bin folder what do I need to do. Install some alternative firmware that has rsync in it. Or, root your phone. Or, don't put rsync in /system, since AFAIK you don't need it in /system. Rsync is a important feature to have on the android device. You are welcome to your opinion. It is my opinion that this has absolutely nothing to do with this list. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. Sounds like you need a better server. Beyond that, though, if you're willing to deal with multiple CPU ports of rsync, you shouldn't need it in /system to run it, any more than you need a binary in desktop Linux to be in /usr/bin to run it. If you are so smart, why dont u try to give me some direction/hints. Because this has nothing to do with this list. After all the group is meant just for that right ? No. It is meant for developing Android applications with the SDK. rsync has nothing to do with the Android SDK. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in Oslo:http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Just wanted you to know that rysnc droid is a project for android. If the install steps dont work on a android device, android forum is the best place to seek advice. Dont get me wrong, but getting a android app to work, I was assuming that the developers of that app would have done enough research to get it to work on a real device. I guess not enough. When I put up the question I was thinking may be I was doing something wrong. Then it struck me, why system/bin.. It can be just any other folder. Hope I clarified On Sep 17, 6:44 pm, Conny mcon...@gmail.com wrote: Thanks Murphy.. On Sep 17, 5:24 pm, Mark Murphy mmur...@commonsware.com wrote: On Sat, Sep 17, 2011 at 1:46 AM, Conny mcon...@gmail.com wrote: But the question is if I do need to get rsync into the bin folder what do I need to do. Install some alternative firmware that has rsync in it. Or, root your phone. Or, don't put rsync in /system, since AFAIK you don't need it in /system. Rsync is a important feature to have on the android device. You are welcome to your opinion. It is my opinion that this has absolutely nothing to do with this list. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. Sounds like you need a better server. Beyond that, though, if you're willing to deal with multiple CPU ports of rsync, you shouldn't need it in /system to run it, any more than you need a binary in desktop Linux to be in /usr/bin to run it. If you are so smart, why dont u try to give me some direction/hints. Because this has nothing to do with this list. After all the group is meant just for that right ? No. It is meant for developing Android applications with the SDK. rsync has nothing to do with the Android SDK. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android Training in Oslo:http://bit.ly/fjBo24 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
On Saturday, September 17, 2011 10:45:46 PM UTC-4, Conny wrote: I was assuming that the developers of that app would have done enough research to get it to work on a real device. I guess not enough. And what lead you to believe that 'rsync droid' was a part of the SDK or has anything whatsoever to do with this mailing list? If you want to make some kind of point about some developers of 'rsync droid' not 'having done research' we can start with your utter butchering of the Java language referenced in your op. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
I get the exception at OutputStream out = new FileOutputStream(dst); On Fri, Sep 16, 2011 at 2:32 PM, MCON Dev mcon...@gmail.com wrote: Hi, If I use the code below, I get java.io.FileNotFoundException : /system/bin/rsync (Read-Only File system). I have one more question following this for the Samsung Tablet. The emulator has a /dev/block/mtdblock0 file. But the samsung tablet does not. It instead has a mmcblk0. I need to know how I identify which is the right /dev/block/file to be used for remounting ? May be forgetting my basics here. Please guide me. public class DeployRSync extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); runCommand(mount -o remount,rw /dev/block/mtdblock0 /system, false); try { copy(getAssets().open(rsync), new File(/system/bin/rsync)); } catch (IOException e) { e.printStackTrace(); } runCommand(chmod 755 /system/bin/rsync, false); runCommand(mount -o remount, ro /dev/block/mtdblock0 /system, false); } void copy(InputStream in, File dst) throws IOException { OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) 0) { out.write(buf, 0, len); } in.close(); out.close(); } private String runCommand(String command, boolean check) { try { String env[] = new String[1] ; env[0] = Environment.getRootDirectory().getAbsolutePath() ; Process process ; if (check) process = Runtime.getRuntime().exec(command, env, new File(/system/bin)); else process = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream()),4096); process.getOutputStream(); int read; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((read = reader.read(buffer)) 0) { output.append(buffer, 0, read); } reader.close(); // Waits for the command to finish. process.waitFor(); return output.toString(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (InterruptedException e) { e.printStackTrace(); throw new RuntimeException(e); } } } Regards Siddharth -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
I tried adding dst.createNewFile(); Got a 09-16 14:35:39.569: WARN/System.err(1137): java.io.IOException: Read-only file system 09-16 14:35:39.579: WARN/System.err(1137): at java.io.File.createNewFileImpl(Native Method) 09-16 14:35:39.579: WARN/System.err(1137): at java.io.File.createNewFile(File.java:1160) 09-16 14:35:39.588: WARN/System.err(1137): at com.sears.rsync.DeployRSync.copy(DeployRSync.java:33) 09-16 14:35:39.601: WARN/System.err(1137): at com.sears.rsync.DeployRSync.onCreate(DeployRSync.java:24) My android manifest has manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.sears.rsync android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=8 / uses-permission android:name=android.permission.MOUNT_FORMAT_FILESYSTEMS/uses-permission uses-permission android:name=android.permission.MOUNT_UNMOUNT_FILESYSTEMS/uses-permission uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE / application android:icon=@drawable/icon android:debuggable=true android:label=@string/app_name activity android:name=.DeployRSync android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest On Fri, Sep 16, 2011 at 2:34 PM, MCON Dev mcon...@gmail.com wrote: I get the exception at OutputStream out = new FileOutputStream(dst); On Fri, Sep 16, 2011 at 2:32 PM, MCON Dev mcon...@gmail.com wrote: Hi, If I use the code below, I get java.io.FileNotFoundException : /system/bin/rsync (Read-Only File system). I have one more question following this for the Samsung Tablet. The emulator has a /dev/block/mtdblock0 file. But the samsung tablet does not. It instead has a mmcblk0. I need to know how I identify which is the right /dev/block/file to be used for remounting ? May be forgetting my basics here. Please guide me. public class DeployRSync extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); runCommand(mount -o remount,rw /dev/block/mtdblock0 /system, false); try { copy(getAssets().open(rsync), new File(/system/bin/rsync)); } catch (IOException e) { e.printStackTrace(); } runCommand(chmod 755 /system/bin/rsync, false); runCommand(mount -o remount, ro /dev/block/mtdblock0 /system, false); } void copy(InputStream in, File dst) throws IOException { OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) 0) { out.write(buf, 0, len); } in.close(); out.close(); } private String runCommand(String command, boolean check) { try { String env[] = new String[1] ; env[0] = Environment.getRootDirectory().getAbsolutePath() ; Process process ; if (check) process = Runtime.getRuntime().exec(command, env, new File(/system/bin)); else process = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream()),4096); process.getOutputStream(); int read; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((read = reader.read(buffer)) 0) { output.append(buffer, 0, read); } reader.close(); // Waits for the command to finish. process.waitFor(); return output.toString(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (InterruptedException e) { e.printStackTrace(); throw new RuntimeException(e); } } } Regards Siddharth -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
You seriosily think that any old app just copy stuff to the system/bin folder?? On Sep 16, 5:06 pm, MCON Dev mcon...@gmail.com wrote: I tried adding dst.createNewFile(); Got a 09-16 14:35:39.569: WARN/System.err(1137): java.io.IOException: Read-only file system 09-16 14:35:39.579: WARN/System.err(1137): at java.io.File.createNewFileImpl(Native Method) 09-16 14:35:39.579: WARN/System.err(1137): at java.io.File.createNewFile(File.java:1160) 09-16 14:35:39.588: WARN/System.err(1137): at com.sears.rsync.DeployRSync.copy(DeployRSync.java:33) 09-16 14:35:39.601: WARN/System.err(1137): at com.sears.rsync.DeployRSync.onCreate(DeployRSync.java:24) My android manifest has manifest xmlns:android=http://schemas.android.com/apk/res/android; package=com.sears.rsync android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=8 / uses-permission android:name=android.permission.MOUNT_FORMAT_FILESYSTEMS/uses-permission uses-permission android:name=android.permission.MOUNT_UNMOUNT_FILESYSTEMS/uses-permission uses-permission android:name=android.permission.WRITE_EXTERNAL_STORAGE / application android:icon=@drawable/icon android:debuggable=true android:label=@string/app_name activity android:name=.DeployRSync android:label=@string/app_name intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity /application /manifest On Fri, Sep 16, 2011 at 2:34 PM, MCON Dev mcon...@gmail.com wrote: I get the exception at OutputStream out = new FileOutputStream(dst); On Fri, Sep 16, 2011 at 2:32 PM, MCON Dev mcon...@gmail.com wrote: Hi, If I use the code below, I get java.io.FileNotFoundException : /system/bin/rsync (Read-Only File system). I have one more question following this for the Samsung Tablet. The emulator has a /dev/block/mtdblock0 file. But the samsung tablet does not. It instead has a mmcblk0. I need to know how I identify which is the right /dev/block/file to be used for remounting ? May be forgetting my basics here. Please guide me. public class DeployRSync extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); runCommand(mount -o remount,rw /dev/block/mtdblock0 /system, false); try { copy(getAssets().open(rsync), new File(/system/bin/rsync)); } catch (IOException e) { e.printStackTrace(); } runCommand(chmod 755 /system/bin/rsync, false); runCommand(mount -o remount, ro /dev/block/mtdblock0 /system, false); } void copy(InputStream in, File dst) throws IOException { OutputStream out = new FileOutputStream(dst); // Transfer bytes from in to out byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) 0) { out.write(buf, 0, len); } in.close(); out.close(); } private String runCommand(String command, boolean check) { try { String env[] = new String[1] ; env[0] = Environment.getRootDirectory().getAbsolutePath() ; Process process ; if (check) process = Runtime.getRuntime().exec(command, env, new File(/system/bin)); else process = Runtime.getRuntime().exec(command); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream()),4096); process.getOutputStream(); int read; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((read = reader.read(buffer)) 0) { output.append(buffer, 0, read); } reader.close(); // Waits for the command to finish. process.waitFor(); return output.toString(); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (InterruptedException e) { e.printStackTrace(); throw new RuntimeException(e); } } } Regards Siddharth-
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
On Friday, September 16, 2011 5:02:43 AM UTC-4, Conny wrote: May be forgetting my basics here. I sincerely doubt you ever understood your basics to begin with. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Copying a file from assets or raw to /system/bin folder (rsync)
Guys, obviously I understand that /system/bin is read only, I would be blind not to be able to read the error messages. But the question is if I do need to get rsync into the bin folder what do I need to do. Rsync is a important feature to have on the android device. Helps to keep files in sync. I have a bunch of files I need to keep in sync with the server. Imagine having to keep 1000 devices in sync with data files. If you are so smart, why dont u try to give me some direction/hints. After all the group is meant just for that right ? Direction and hints ? Or is it only a place where 2 smart people would discuss how smart they really are ? Thanks for your comments Conny On Sep 16, 9:10 pm, Chris crehb...@gmail.com wrote: On Friday, September 16, 2011 5:02:43 AM UTC-4, Conny wrote: May be forgetting my basics here. I sincerely doubt you ever understood your basics to begin with. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en