fix reboot flag
[android-command-line.git] / adb-install-update.sh
1 #!/bin/sh -x
2
3 #  The recovery tool communicates with the main system through /cache files.
4 #   /cache/recovery/command - INPUT - command line for tool, one arg per line
5 #   /cache/recovery/log - OUTPUT - combined log file from recovery run(s)
6 #   /cache/recovery/intent - OUTPUT - intent that was passed in
7 #
8 # The arguments which may be supplied in the recovery.command file:
9 #   --send_intent=anystring - write the text out to recovery.intent
10 #   --update_package=root:path - verify install an OTA package file
11 #   --wipe_data - erase user data (and cache), then reboot
12 #   --wipe_cache - wipe cache (but not user data), then reboot
13 #
14 # After completing, we remove /cache/recovery/command and reboot.
15
16 if [ ! -e "$1" ] ; then
17         echo "Usage: $0 update.zip"
18         exit 1
19 fi
20
21 adb shell "rm /sdcard/update.zip"
22
23 adb push $1 /sdcard/update.zip || exit 1
24
25 adb remount
26 adb shell "echo 'boot-recovery ' > /cache/recovery/command"
27 adb shell "echo '--update_package=/sdcard/update.zip' >> /cache/recovery/command"
28 adb shell "echo '--wipe_cache' >> /cache/recovery/command"
29 adb shell "echo 'reboot' >> /cache/recovery/command"
30 adb shell "reboot recovery"