android shell cp 文件到/system/xxx

来源:互联网 发布:wget和yum 编辑:程序博客网 时间:2024/06/17 05:56

在shell下将文件cp到/system/xxx下, 除了需要root权限,还需要将/system重新挂载为 rw:


code 如下:

/*

* root权限下,cp文件到 "/system/xxx" 下面

*/

private voidcpFile2System() {

// 重新挂载为可读写,然后再cp进去

String cmd = "mount -o remount rw /system";

CommandUtil.getInstance().execute(cmd);


String src = CacheTools.getCacheRootPath();

String filePath = src + "26910.zip";

cmd = "cp " + filePath +" /system/xbin";

CommandUtil.getInstance().execute(cmd);


// cp 完成之后,再次挂载未只读

cmd = "mount -o ro,remount /system";

CommandUtil.getInstance().execute(cmd);

}


1 0
原创粉丝点击