Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KonradIT/40a1f8104890587fd6c0 to your computer and use it in GitHub Desktop.
Save KonradIT/40a1f8104890587fd6c0 to your computer and use it in GitHub Desktop.
#/bin/bash
#
chmod +x ./adblinux
chmod +x ./fastbootlinux
# LG G Watch Utility for Linux and OSX
# Ported from RootsJunky
# Lets check what platform we are running on
# We will check what we are running on and then set some variables for some funtimes
function platform
{ platform=`uname`
if [ $(uname -p) = 'powerpc' ]; then
echo "[-] PowerPC is not supported."
exit 1
fi
if [ "$platform" = 'Darwin' ]; then
ADB="./adbosx"
FASTBOOT="./fastbootosx"
version="OS X"
else
ADB="./adblinux"
FASTBOOT="./fastbootlinux"
version="Linux"
fi
}
platform
echo "__________________________________________________"
echo "[*] Simple LG G Watch Tool"
echo "[*] Linux / OSX Version"
echo "[*] Remember to chmod +x this script"
echo "Modded by XDA @konradit, Twitter: @konrad_it"
echo "--------------------------------------------------"
echo "What would you like to do:"
echo "Your choices are:"
echo "- unlock (unlocks the bootloader)"
echo "- relock (relocks the bootloader)"
echo "- root (roots a G watch WITH unlocked BL)"
echo "- checkroot (checks if root has been correctly installed)"
echo "- restore (restore stock sysimg and recovery)"
echo "- twrp (installs TWRP recovery)"
echo "- shell (ADB shell)"
echo "- bootanim2pc (pulls the bootanimation zip file to current directory)"
echo "enter your choice"
read choice
if [ "$choice" = "unlock" ]; then
echo "--------------------------------------------------------------------------------"
echo "[*] Before continuing, ensure USB debugging is enabled,"
echo "[*] device settings/about then click on build number 10 times"
echo "[*] back to settings/developer options enable usb debugging"
echo "[*] have the Universal drivers installed and your G Watch"
echo "[*] connected via USB charging dock to the computer"
echo "[*] WARNING THIS WILL FACTORY RESET YOUR DEVICE"
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
sudo $ADB kill-server
sudo $ADB devices
echo "[*] Device found."
sudo $ADB reboot bootloader
echo "--------------------------------------------------------------------------------"
echo "[*] on the next screen you see the unlock No. press the little"
echo "[*] arrow at the bottom of screen to yes then press the circle"
echo "[*] when its done you will be back in boot menu"
echo "[*] and it will say unlocked."
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to Continue"
read \n
sudo $FASTBOOT oem unlock
echo "--------------------------------------------------------------------------------"
echo "[*] First boot will take up to 10 minutes and boot twice."
echo "--------------------------------------------------------------------------------"
sudo $FASTBOOT reboot
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "relock" ]; then
echo "--------------------------------------------------------------------------------"
echo "[*] Before continuing, ensure USB debugging is enabled,"
echo "[*] device settings/about then click on build number 10 times"
echo "[*] back to settings/developer options enable usb debugging"
echo "[*] have the Universal drivers installed and your G Watch"
echo "[*] connected via USB charging dock to the computer"
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
sudo $ADB kill-server
sudo $ADB devices
sudo $ADB reboot bootloader
sudo $FASTBOOT oem lock
echo "--------------------------------------------------------------------------------"
echo "[*] First boot will take up to 5 minutes"
echo "--------------------------------------------------------------------------------"
echo "[*] press any key to reboot the device once locked."
echo "Press ENTER to Continue"
read \n
sudo $FASTBOOT reboot
echo "DONE"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "root" ]; then
echo "--------------------------------------------------------------------------------"
echo "[*] PLEASE JUST USE THE RESTORE OPTION"
echo "[*] IT IS PRE ROOTED THANKS TO CHAINFIRE and SUPERSU.ZIP"
echo "--------------------------------------------------------------------------------"
echo "[*] Big thanks to Chainfire rooting Lollipop"
echo "[*] Make sure USB Debugging is enabled on your watch"
echo "[*] this will Temp boot Twrp recovery image"
echo "[*] Then just flash wear-supersu.zip from recovery"
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
echo "[*]"
echo "[*] waiting 4 device"
sudo $ADB devices
echo "[*] pushing Wear supersu.zip now...."
sudo $ADB push Wear-SuperSU-v2.40.zip /sdcard/Download
sudo $ADB reboot bootloader
sudo $FASTBOOT devices
sudo $FASTBOOT boot openrecovery-twrp-2.8.5.0-dory.img
echo ---------------------------------------------------------------------------
echo "[*] once Twrp boots click install then nav to download"
echo "[*] folder and select wear supersu file and flash it"
echo "[*] next reboot and test root with terminal"
echo "[*] to test root on your watch open a commadn window"
echo "[*] type = adb shell"
echo "[*] type = su"
echo "[*] if it returns"
echo "[*] root@dory #"
echo "[*] then you have root access"
echo ---------------------------------------------------------------------------------
echo "DONE"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "restore" ]; then
echo "--------------------------------------------------------------------------------"
echo "[*] Restore G watch to stock to fix a brick or just return to stock"
echo "[*] After restore runs you will boot to recovery where you can either"
echo "[*] reboot the device or do a factory reset"
echo "[*] Before continuing, ensure your LG G Watch is in"
echo "[*] Fastboot mode and connected via USB with the drivers installed."
echo "--------------------------------------------------------------------------------"
echo "[*] To Get into bootloader mode you have to press a pen"
echo "[*] into the back reset button and wait for the device to restart."
echo "[*] as soon as you see the LG logo press both the top left and"
echo "[*] bottom right corners of the screen repeatedly while still holding"
echo "[*] the reset button and the bootloader screen will pop up."
echo "[*] release the pen holding the reset button and you are in bootloader."
echo "--------------------------------------------------------------------------------"
echo "[*] Another option to enter bootloader mode is to open a command"
echo " type adb reboot bootloader. only if the device is on."
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
sudo $ADB kill-server
sudo $ADB reboot bootloader
sudo $FASTBOOT devices
sudo $FASTBOOT flash system 22Dsystem.img
sudo $FASTBOOT flash boot 22Dboot.img
sudo $FASTBOOT flash recovery 22Drecovery.img
echo "--------------------------------------------------------------------------------"
echo "[*] Press the arrow bottom right to scroll to recovery"
echo "[*] then the circle to boot recovery to factory reset"
echo "[*] in recovery you will see a android guy on his back"
echo "[*] press the top left and bottom right of screen again"
echo "[*] to enter recovery menu. now scroll up and down adn swipe"
echo "[*] right to select. when done in recovery just reboot."
echo "--------------------------------------------------------------------------------"
echo "[*] If you dont want to factory reset just press the circle button"
echo "[*] I recommend fastory resetting device at this time."
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "twrp" ] ; then
echo "--------------------------------------------------------------------------------"
echo "[*] This will flash Team win / TWRP recovery"
echo "[*] to your device from fastboot."
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
echo "[*] waiting four device"
sudo $ADB devices
echo "[*] device found"
sudo $ADB reboot bootloader
sudo $FASTBOOT flash recovery openrecovery-twrp-2.8.5.0-dory.img
echo "--------------------------------------------------------------------------------"
echo "[*] your device is on the boot menu screen now scoll to Recovery"
echo "[*] with arrow buttons and select with circle to boot to recovery"
echo "--------------------------------------------------------------------------------"
echo "[*] If you want to keep TWRP recovery installed after"
echo "[*] a reboot select reboot then system and choose yes"
echo "[*] to keeping TWRP recovery."
echo "--------------------------------------------------------------------------------"
echo "[*] RootJunky OUT"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "checkroot" ] ; then
echo "--------------------------------------------------------------------------------"
echo "[*] This will check root status on your watch!"
echo "--------------------------------------------------------------------------------"
echo "Press ENTER to start"
read \n
echo "[*] waiting four device"
sudo $ADB devices
echo "[*] device found"
echo "A shell will be opened, please type 'su' into it"
echo "If it returns root_AT_dory go grab a beer because you are now rooted!"
sudo $ADB shell
echo "[*] RootJunky OUT"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "shell" ] ; then
echo "--------------------------------------------------------------------------------"
echo "[*] Watch shell over USB ADB!"
echo "--------------------------------------------------------------------------------"
echo "[*] waiting for device"
sudo $ADB devices
echo "[*] device found"
echo "Tip: use 'su' for scripting as root"
echo "Type exit two times to stop the shell"
sudo $ADB shell
echo "[*] RootJunky OUT"
echo "Press ENTER to exit"
read \n
exit
elif [ "$choice" = "bootanim2pc" ] ; then
echo "--------------------------------------------------------------------------------"
echo "[*] Pull the bootanimation to PC to modify it!"
echo "--------------------------------------------------------------------------------"
echo "[*] waiting for device"
sudo $ADB devices
echo "[*] device found"
sudo $ADB pull /system/media/bootanimation.zip
echo "[*] RootJunky OUT"
echo "Press ENTER to exit"
read \n
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment