Skip to content

Instantly share code, notes, and snippets.

@veez21
Created May 2, 2018 07:10
Show Gist options
  • Save veez21/57efc6fda9b873e689b2ff788a219fe9 to your computer and use it in GitHub Desktop.
Save veez21/57efc6fda9b873e689b2ff788a219fe9 to your computer and use it in GitHub Desktop.
Check MIUI Firmware (Global Stable) updates for Redmi Note 4X (Snapdragon)
#!/system/bin/sh
# veez21 @ xda-developers
echo -n "Testing internet connection "
ping -q -c 1 -W 1 en.miui.com 2>/dev/null >/dev/null && echo "- OK" || { echo "- Error"; exit 1; }
curdev=$(getprop ro.product.device)
[ -n "$1" -a "$1" != "-u" ] && curdev=$1
DB=/cache/devices.list
DBlink=https://github.com/veez21/xiaomi_devices_list/raw/master/devices.list
[ ! -s $DB -o "$1" == "-u" ] && echo "Updating device list" && wget -q -O $DB $DBlink
echo "Device: $curdev"
num=$(grep "${curdev}=" $DB); num=${num#*=}
[ -z "$num" ] && echo $curdev not supported && exit 1
link=$(wget -q -O - http://en.miui.com/download-${num}.html | grep http://bigota.d.miui.com | head -n1 2>/dev/null) # & spinner "Getting Latest Stable MIUI"
link=${link#*href=}; link=${link%%>*}
link=$(echo $link | tr -d '"')
name=${link##*'/'}
echo "Latest: $name"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment