-
Notifications
You must be signed in to change notification settings - Fork 14
/
wipeDevice.sh
executable file
·62 lines (52 loc) · 1.57 KB
/
wipeDevice.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# Created by Sujay Davalgi
#
# Wipes data on the selected device
#
# Usage: ./wipeDevice.sh [<Device Serial>]
# Command line Arguments (Optional):
# $1 - Input the device serial
# If the serial number is not provided, it will display the list of attached devices to pick from
. ./library/mainFunctions.sh
. ./library/textFormatting.sh
. ./library/deviceOperations.sh
if [ $# -lt 1 ]; then
getDeviceChoice
else
buildDeviceSnArray
deviceSerial="$1"
fi
displaySelectedDevice $deviceSerial
if [ "$( isAdbDevice $deviceSerial )" == "true" ]; then
# if [ $( isGoogleDevice $deviceSerial ) == "true" ]; then
echo -n -e " Wait for device to reboot in bootloader..."
adb -s $deviceSerial wait-for-device reboot bootloader &
# read waiting
wait $!
echo -e " Done"
sleep 7s
buildDeviceSnArray
# else
# echo -e " You are trying to wipe other than Google device. Please check...\n"
# fi
fi
if [ "$( isFastbootDevice $deviceSerial )" == "true" ]; then
echo -e "\n Wait for the device to complete wipe data and reboot..."
# fastboot -s $deviceSerial oem recovery:wipe_data
fastboot -s $deviceSerial -w &
#wait $!
sleep 2s
fastboot -s $deviceSerial reboot-bootloader &
#wait $!
sleep 2s
fastboot -s $deviceSerial reboot
#echo -e "\n Wait for device to reboot and complete the data wipe\n"
#read waiting
#fastboot reboot
echo " "
elif [[ "$( isAdbDevice $deviceSerial )" == "true" || "$( isRecoveryDevice $deviceSerial )" == "true" ]]; then
echo -e "\n Device is not in Fastboot mode\n"
else
echo -e "\n Unable to determine the device state \n"
fi