Merge "envsetup.sh: Add 'provision' function."
This commit is contained in:
29
envsetup.sh
29
envsetup.sh
@@ -10,6 +10,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
|
||||
To limit the modules being built use the syntax: mmm dir/:target1,target2.
|
||||
- mma: Builds all of the modules in the current directory, and their dependencies.
|
||||
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
|
||||
- provision: Flash device with all required partitions. Options will be passed on to fastboot.
|
||||
- cgrep: Greps on all local C/C++ files.
|
||||
- ggrep: Greps on all local Gradle files.
|
||||
- jgrep: Greps on all local Java files.
|
||||
@@ -1470,6 +1471,34 @@ function make()
|
||||
return $ret
|
||||
}
|
||||
|
||||
function provision()
|
||||
{
|
||||
if [ ! "$ANDROID_PRODUCT_OUT" ]; then
|
||||
echo "Couldn't locate output files. Try running 'lunch' first." >&2
|
||||
return 1
|
||||
fi
|
||||
if [ ! -e "$ANDROID_PRODUCT_OUT/provision-device" ]; then
|
||||
echo "There is no provisioning script for the device." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if user really wants to do this.
|
||||
if [ "$1" = "--no-confirmation" ]; then
|
||||
shift 1
|
||||
else
|
||||
echo "This action will reflash your device."
|
||||
echo ""
|
||||
echo "ALL DATA ON THE DEVICE WILL BE IRREVOCABLY ERASED."
|
||||
echo ""
|
||||
read -p "Are you sure you want to do this (yes/no)? "
|
||||
if [[ "${REPLY}" != "yes" ]] ; then
|
||||
echo "Not taking any action. Exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
"$ANDROID_PRODUCT_OUT/provision-device" "$@"
|
||||
}
|
||||
|
||||
if [ "x$SHELL" != "x/bin/bash" ]; then
|
||||
case `ps -o command -p $$` in
|
||||
*bash*)
|
||||
|
Reference in New Issue
Block a user