update-script脚本语法说明.doc

上传人:ng****60 文档编号:2244622 上传时间:2019-05-02 格式:DOC 页数:6 大小:40KB
下载 相关 举报
update-script脚本语法说明.doc_第1页
第1页 / 共6页
update-script脚本语法说明.doc_第2页
第2页 / 共6页
update-script脚本语法说明.doc_第3页
第3页 / 共6页
update-script脚本语法说明.doc_第4页
第4页 / 共6页
update-script脚本语法说明.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、手机常识理解:system:系统分区.我们刷机器一般就是刷的这个分区.userdata:数据分区.cache:缓存分区recovery:Recovery 分区,相当于建立在 hboot 与 android 系统间的一个中间层,如名字一般,主要用于系统调试和恢复。 .boot:存放内核和 ramdisk 的分区.hboot:这个是 SPL 所在的分区,即 bootloadersplash1:这个就是开机第一屏幕了.radio:这个是无线所在的分区.misc:其他分区1.copy_dir语法:copy_dir 表示原文件夹,表示目的文件夹,表示时间戳作用:将 文件夹中的内容复制到 文件夹中。文件夹

2、中的原始内容将会保存不变,除非 文件夹中有相同的内容,这样 中的内容将被覆盖举例:copy_dir PACKAGE:system SYSTEM:(将升级包中的 system 文件夹复制到手机中)2.format语法:format 表示要格式化的分区作用:格式化一个分区举例:format SYSTEM:(将手机/system 分区完全格式化)注意:格式化之后的数据是不可以恢复的3.delete语法:delete . . 表示要格式化的文件,可以是多个文件用空格隔开作用:删除文件 1,2 到 n举例:delete SYSTEM:app/Calculator.apk(删除手机 systen 文件夹中

3、 app 中的 Calculator.apk 文件)4.delete_recursive语法:delete_recursive . . 表示要删除的文件或文件夹,可以使多个,中间用空格隔开作用:删除文件或者目录,删除目录时会将目录中的所有内容全部删除举例:delete_recursive DATA:dalvik-cache(删除/data/dalvik-cache 文件夹下的所有内容)5.run_program语法:run_program .表示要运行的程序, .表示运行程序所加的参数作用:运行终端程序举例:run_program PACKAGE:install_busybox.sh(执行升级

4、包中的 install_busybox.sh 脚本)6.set_perm语法:set_perm . 表示用户名称,表示用户组名称,表示权限模式, . 表示文件路径,可以使多个,用空格隔开作用:设置单个文件或目录的所有者和权限,像 linux 中的 chmod、chown 或 chgrp 命令一样,只是集中在了一个命令当中举例:set_perm 0 2000 0550 SYSTEM:etc/init.goldfish.sh(设置手机 system 中的 etc/init.goldfish.sh 的用户为 root,用户组为 shell,所有者以及所属用户组成员可以进行读取和执行操作,其他用户无操

5、作权限)7.set_perm_recursive语法:set_perm_recursive . 表示用户,表示用户组,表示文件夹的权限,表示文件的权限, . 表示文件夹的路径,可以多个,用空格分开作用:设置文件夹及文件夹中的文件的所有者和用户组举例:set_perm_recursive 0 0 0755 0644 SYSTEM:app(设置手机 system/app 文件夹及其中文件的用户为 root,用户组为 root,app 文件夹权限为所有者可以进行读、写、执行操作,其他用户可以进行读取和执行操作,其中的文件的权限为所有者可以进行读写操作,其他用户可以进行读取操作)8.show_prog

6、ress语法:show_progress 作用:为下面进行的程序操作显示进度条,进度条会根据进行前进,当操作时间是确定的时候会更快举例:show_progress 0.1 0(显示进度条当操作完成后前进 10%)9.symlink语法:symlink 表示链接到的目标,表示快捷方式的路径作用:相当于 linux 中的 ln 命令,将 在 处创建一个软链接,的格式应为绝对路径(或许相对路径也可以) ,为“根目录:路径”的形式举例:symlink /system/bin/su SYSTEM:xbin/su(在手机中 system 中的 xbin 中建立一个 /system/bin/su 的快捷方式

7、)10.assert 作用:此命令用来判断表达式 boolexpr 的正确与否,当表达式错误时程序终止执行此作用有待验证11.write_radio_image 作用:将基带部分的镜像写入手机,表示镜像文件举例:write_radio_image PACKAGE:radio.img12.write_hboot_image 作用:将系统 bootloader 镜像写入手机, 表示镜像位置,此命令在直到在所有的程序安装结束之后才会起作用举例:write_hboot_image PACKAGE:hboot.img13.write_raw_image 作用:将 boot.img 写入手机,里面包含了内

8、核和 ram 盘举例:write_raw_image PACKAGE:boot.img BOOT:完整示例:assert(getprop(“ro.product.device“) = “morr“ | getprop(“ro.build.product“) = “morr“ | getprop(“ro.product.board“) = “morr“ | getprop(“ro.product.device“) = “morrison“ | getprop(“ro.build.product“) = “morrison“ | getprop(“ro.product.board“) = “mor

9、rison“);package_extract_file(“system/bin/backuptool.sh“, “/tmp/backuptool.sh“);set_perm(0, 0, 0777, “/tmp/backuptool.sh“);run_program(“/tmp/backuptool.sh“, “backup“);show_progress(0.500000, 0);format(“yaffs2“, “MTD“, “system“);mount(“yaffs2“, “MTD“, “system“, “/system“);package_extract_dir(“recovery

10、“, “/system“);package_extract_dir(“system“, “/system“);symlink(“busybox“, “/system/xbin/“, “/system/xbin/“,“/system/xbin/arp“, “/system/xbin/ash“, “/system/xbin/awk“,“/system/xbin/basename“, “/system/xbin/bbconfig“, “/system/xbin/brctl“,“/system/xbin/bunzip2“, “/system/xbin/bzcat“, “/system/xbin/bzi

11、p2“,“/system/xbin/cal“, “/system/xbin/cat“, “/system/xbin/catv“,“/system/xbin/chgrp“, “/system/xbin/chmod“, “/system/xbin/chown“,“/system/xbin/chroot“, “/system/xbin/cksum“, “/system/xbin/clear“,“/system/xbin/cmp“, “/system/xbin/cp“, “/system/xbin/cpio“,“/system/xbin/cut“, “/system/xbin/date“, “/sys

12、tem/xbin/dc“,“/system/xbin/dd“, “/system/xbin/depmod“, “/system/xbin/devmem“,“/system/xbin/df“, “/system/xbin/diff“, “/system/xbin/dirname“,“/system/xbin/dmesg“, “/system/xbin/dnsd“, “/system/xbin/dos2unix“,“/system/xbin/du“, “/system/xbin/echo“, “/system/xbin/ed“,“/system/xbin/egrep“, “/system/xbin

13、/env“, “/system/xbin/expr“,“/system/xbin/false“, “/system/xbin/fdisk“, “/system/xbin/fgrep“,“/system/xbin/find“, “/system/xbin/fold“, “/system/xbin/free“,“/system/xbin/freeramdisk“, “/system/xbin/fuser“, “/system/xbin/getopt“,“/system/xbin/grep“, “/system/xbin/gunzip“, “/system/xbin/gzip“,“/system/x

14、bin/head“, “/system/xbin/hexdump“, “/system/xbin/id“,“/system/xbin/ifconfig“, “/system/xbin/insmod“, “/system/xbin/install“,“/system/xbin/ip“, “/system/xbin/kill“, “/system/xbin/killall“,“/system/xbin/killall5“, “/system/xbin/length“, “/system/xbin/less“,“/system/xbin/ln“, “/system/xbin/losetup“, “/

15、system/xbin/ls“,“/system/xbin/lsmod“, “/system/xbin/lspci“, “/system/xbin/lsusb“,“/system/xbin/lzop“, “/system/xbin/lzopcat“, “/system/xbin/md5sum“,“/system/xbin/mkdir“, “/system/xbin/mke2fs“, “/system/xbin/mkfifo“,“/system/xbin/mkfs.ext2“, “/system/xbin/mknod“, “/system/xbin/mkswap“,“/system/xbin/m

16、ktemp“, “/system/xbin/modprobe“, “/system/xbin/more“,“/system/xbin/mount“, “/system/xbin/mountpoint“, “/system/xbin/mv“,“/system/xbin/netstat“, “/system/xbin/nice“, “/system/xbin/nohup“,“/system/xbin/nslookup“, “/system/xbin/ntpd“, “/system/xbin/od“,“/system/xbin/patch“, “/system/xbin/pgrep“, “/syst

17、em/xbin/pidof“,“/system/xbin/ping“, “/system/xbin/pkill“, “/system/xbin/printenv“,“/system/xbin/printf“, “/system/xbin/ps“, “/system/xbin/pwd“,“/system/xbin/rdev“, “/system/xbin/readlink“, “/system/xbin/realpath“,“/system/xbin/renice“, “/system/xbin/reset“, “/system/xbin/rm“,“/system/xbin/rmdir“, “/

18、system/xbin/rmmod“, “/system/xbin/route“,“/system/xbin/run-parts“, “/system/xbin/sed“, “/system/xbin/seq“,“/system/xbin/setsid“, “/system/xbin/sh“, “/system/xbin/sha1sum“,“/system/xbin/sha256sum“, “/system/xbin/sha512sum“,“/system/xbin/sleep“, “/system/xbin/sort“, “/system/xbin/split“,“/system/xbin/

19、stat“, “/system/xbin/strings“, “/system/xbin/stty“,“/system/xbin/swapoff“, “/system/xbin/swapon“, “/system/xbin/sync“,“/system/xbin/sysctl“, “/system/xbin/tac“, “/system/xbin/tail“,“/system/xbin/tar“, “/system/xbin/tee“, “/system/xbin/telnet“,“/system/xbin/test“, “/system/xbin/tftp“, “/system/xbin/t

20、ime“,“/system/xbin/top“, “/system/xbin/touch“, “/system/xbin/tr“,“/system/xbin/traceroute“, “/system/xbin/true“, “/system/xbin/tty“,“/system/xbin/tune2fs“, “/system/xbin/umount“, “/system/xbin/uname“,“/system/xbin/uniq“, “/system/xbin/unix2dos“, “/system/xbin/unlzop“,“/system/xbin/unzip“, “/system/x

21、bin/uptime“, “/system/xbin/usleep“,“/system/xbin/uudecode“, “/system/xbin/uuencode“, “/system/xbin/vi“,“/system/xbin/watch“, “/system/xbin/wc“, “/system/xbin/wget“,“/system/xbin/which“, “/system/xbin/whoami“, “/system/xbin/xargs“,“/system/xbin/yes“,“/system/xbin/zcat“);symlink(“iwmulticall“, “/syste

22、m/xbin/iwconfig“, “/system/xbin/iwgetid“,“/system/xbin/iwlist“, “/system/xbin/iwpriv“,“/system/xbin/iwspy“);symlink(“toolbox“, “/system/bin/cat“, “/system/bin/cmp“,“/system/bin/date“, “/system/bin/dd“, “/system/bin/dmesg“,“/system/bin/getevent“, “/system/bin/getprop“, “/system/bin/hd“,“/system/bin/i

23、d“, “/system/bin/ifconfig“, “/system/bin/iftop“,“/system/bin/insmod“, “/system/bin/ioctl“, “/system/bin/ionice“,“/system/bin/kill“, “/system/bin/log“, “/system/bin/lsmod“,“/system/bin/nandread“, “/system/bin/netstat“,“/system/bin/newfs_msdos“, “/system/bin/notify“, “/system/bin/printenv“,“/system/bi

24、n/ps“, “/system/bin/reboot“, “/system/bin/renice“,“/system/bin/rmdir“, “/system/bin/rmmod“, “/system/bin/route“,“/system/bin/schedtop“, “/system/bin/sendevent“,“/system/bin/setconsole“, “/system/bin/setprop“, “/system/bin/sleep“,“/system/bin/smd“, “/system/bin/start“, “/system/bin/stop“,“/system/bin

25、/sync“, “/system/bin/top“, “/system/bin/uptime“,“/system/bin/vmstat“, “/system/bin/watchprops“,“/system/bin/wipe“);set_perm_recursive(0, 0, 0755, 0644, “/system“);set_perm_recursive(0, 2000, 0755, 0755, “/system/bin“);set_perm(0, 3003, 02750, “/system/bin/netcfg“);set_perm(0, 3004, 02755, “/system/b

26、in/ping“);set_perm(0, 2000, 06750, “/system/bin/run-as“);set_perm(1001, 1005, 0444, “/system/etc/AudioPara4.csv“);set_perm_recursive(1002, 1002, 0755, 0440, “/system/etc/bluetooth“);set_perm(0, 0, 0755, “/system/etc/bluetooth“);set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf“);se

27、t_perm(3002, 3002, 0444, “/system/etc/bluetooth/blacklist.conf“);set_perm(1002, 1002, 0440, “/system/etc/dbus.conf“);set_perm(1014, 2000, 0550, “/system/etc/dhcpcd/dhcpcd-run-hooks“);set_perm_recursive(0, 2000, 0755, 0750, “/system/etc/init.d“);set_perm(0, 0, 0755, “/system/etc/init.d“);set_perm(0,

28、2000, 0550, “/system/etc/init.goldfish.sh“);set_perm(0, 0, 0544, “/system/etc/install-recovery.sh“);set_perm_recursive(0, 0, 0755, 0555, “/system/etc/ppp“);set_perm_recursive(0, 2000, 0755, 0644, “/system/vendor“);set_perm_recursive(0, 0, 0755, 0644, “/system/vendor/firmware“);set_perm(0, 2000, 0755

29、, “/system/vendor/firmware“);set_perm_recursive(0, 2000, 0755, 0755, “/system/xbin“);set_perm(0, 0, 06755, “/system/xbin/hcitool“);set_perm(0, 0, 06755, “/system/xbin/librank“);set_perm(0, 0, 06755, “/system/xbin/procmem“);set_perm(0, 0, 06755, “/system/xbin/procrank“);set_perm(0, 0, 06755, “/system

30、/xbin/su“);set_perm(0, 0, 06755, “/system/xbin/tcpdump“);show_progress(0.200000, 0);show_progress(0.200000, 10);package_extract_file(“system/bin/backuptool.sh“, “/tmp/backuptool.sh“);set_perm(0, 0, 0777, “/tmp/backuptool.sh“);run_program(“/tmp/backuptool.sh“, “restore“);package_extract_file(“system/

31、bin/modelid_cfg.sh“, “/tmp/modelid_cfg.sh“);set_perm(0, 0, 0777, “/tmp/modelid_cfg.sh“);run_program(“/tmp/modelid_cfg.sh“);package_extract_file(“system/bin/verify_cache_partition_size.sh“, “/tmp/verify_cache_partition_size.sh“);set_perm(0, 0, 0777, “/tmp/verify_cache_partition_size.sh“);run_program(“/tmp/verify_cache_partition_size.sh“);show_progress(0.200000, 10);assert(package_extract_file(“boot.img“, “/tmp/boot.img“),write_raw_image(“/tmp/boot.img“, “boot“),delete(“/tmp/boot.img“);show_progress(0.100000, 0);unmount(“/system“);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 精品笔记

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。