Skip to content

Instantly share code, notes, and snippets.

@bboa
Last active March 21, 2017 13:13
Show Gist options
  • Save bboa/2aa85c617174ae918e6de19da1a9c11a to your computer and use it in GitHub Desktop.
Save bboa/2aa85c617174ae918e6de19da1a9c11a to your computer and use it in GitHub Desktop.
#! /system/bin/sh
# Script will check and restore entries in /system/etc/hosts file.
(
HOST[0000]=localhost
HOST[0001]=alog.umeng.com
HOST[0002]=alog.umeng.co
HOST[0003]=aider.meizu.com
HOST[0004]=apis-meizu.dianhua.cn
HOST[0005]=api-app.meizu.com
HOST[0006]=api-theme.meizu.com
HOST[0007]=api.v.meizu.com
HOST[0008]=cal.meizu.com
HOST[0009]=client.meizu.com
HOST[0010]=common.meizu.com
HOST[0011]=exception.uxip.meizu.com
HOST[0012]=findphone.meizu.com
HOST[0013]=financial.res.meizu.com
HOST[0014]=g.meizu.com
HOST[0015]=hmma.baidu.com
HOST[0016]=i3.res.meizu.com
HOST[0017]=image.res.meizu.com
HOST[0018]=img.wdjimg.com
HOST[0019]=input.shouji.sogou.com
HOST[0020]=kss.ksyun.com
HOST[0021]=music.meizu.com
HOST[0022]=mystore.meizu.com
HOST[0023]=openapi.baidu.com
HOST[0024]=p.meizu.com
HOST[0025]=pay.meizu.com
HOST[0026]=passport.360.cn
HOST[0027]=r3.mo.baidu.com
HOST[0028]=r6.mo.baidu.com
HOST[0029]=safe.res.meizu.com
HOST[0030]=sync.meizu.com
HOST[0031]=u.meizu.com
HOST[0032]=uxip.meizu.com
HOST[0033]=vop.baidu.com
for h in ${HOST[*]}; do ! grep -q [[:blank:]]${h}$ /system/etc/hosts && fix_list="${fix_list} ${h}"; done
if [ ! "${fix_list}" = "" ]; then [ ! -w /system/etc/hosts ] && mount -o remount,rw /system && restore_sysro=1 || exit
for f in ${fix_list}; do echo "127.0.0.1 ${f}" >> /system/etc/hosts; done; chmod 0644 /system/etc/hosts
[ "${restore_sysro}" -eq "1" ] && mount -o remount,ro /system; fi ) &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment