-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotorola.sh
60 lines (47 loc) · 1.44 KB
/
motorola.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
#!/bin/sh
fastbootCheck=$(fastboot devices)
if [ -z "$fastbootCheck" ]; then
echo "Put your device in fastboot mode (i.e. power off, and then"
echo "press the power and volume down buttons simultaneously)."
exit 1
fi
unlockData=$(fastboot oem get_unlock_data 2>&1)
unlockKey=$(echo ${unlockData} | sed "s/ (bootloader) //g" | sed "s/\.//g" | grep -o "^\S*")
phoneSN=$(echo ${unlockKey} | awk -F'#' '{print $1}')
phonePUID=$(echo ${unlockKey} | awk -F'#' '{print $4}')
phoneHash=$(echo ${unlockKey} | awk -F'#' '{print $3}')
url="https://motorola-global-portal.custhelp.com/cc/productRegistration/unlockPhone/$phoneSN/$phonePUID/$phoneHash/"
echo "First log in at the Motorola website if you have not already:"
echo ""
echo " https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a"
echo ""
echo "Now visit:"
echo ""
echo " $url"
echo ""
echo "Or use the unlock key: $unlockKey"
echo ""
fastboot reboot-bootloader > /dev/null 2>&1
echo ""
echo -n "Enter the unlock code: "
read unlockCode
echo ""
echo "About to run"
echo ""
echo " $ fastboot oem unlock $unlockCode"
echo ""
echo -n "Do you wish to continue? (y/n) "
read confirm
echo ""
if [ "$confirm" != "y" ]; then
echo "Aborted"
exit 1
fi
fastbootCheck=$(fastboot devices)
if [ -z "$fastbootCheck" ]; then
echo "Your device is not in fastboot mode"
exit 1
fi
echo "Wait for your device to fully reboot"
echo ""
fastboot oem unlock ${unlockCode} > /dev/null 2>&1