Merge "Add the ability to unlock the bootloader before doing anything else"
diff --git a/clear-factory-images-variables.sh b/clear-factory-images-variables.sh
index a92586a..2c625a7 100644
--- a/clear-factory-images-variables.sh
+++ b/clear-factory-images-variables.sh
@@ -12,12 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-unset XLOADER
-unset XLOADERSRC
unset BOOTLOADER
unset BOOTLOADERFILE
unset BOOTLOADERSRC
-unset TWINBOOTLOADERS
unset BUILD
unset CDMARADIO
unset DEVICE
@@ -28,4 +25,8 @@
unset RADIOSRC
unset SLEEPDURATION
unset SRCPREFIX
+unset UNLOCKBOOTLOADER
unset VERSION
+unset TWINBOOTLOADERS
+unset XLOADER
+unset XLOADERSRC
diff --git a/generate-factory-images-common.sh b/generate-factory-images-common.sh
index 3e07e3e..b7c959f 100644
--- a/generate-factory-images-common.sh
+++ b/generate-factory-images-common.sh
@@ -97,6 +97,12 @@
# limitations under the License.
EOF
+if test "$UNLOCKBOOTLOADER" = "true"
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
+fastboot oem unlock
+EOF
+fi
if test "$ERASEALL" = "true"
then
cat >> tmp/$PRODUCT-$VERSION/flash-all.sh << EOF
@@ -166,6 +172,12 @@
PATH=%PATH%;"%SYSTEMROOT%\System32"
EOF
+if test "$UNLOCKBOOTLOADER" = "true"
+then
+cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF
+fastboot oem unlock
+EOF
+fi
if test "$ERASEALL" = "true"
then
cat >> tmp/$PRODUCT-$VERSION/flash-all.bat << EOF