Created
December 7, 2012 17:02
-
-
Save lmandel/4234696 to your computer and use it in GitHub Desktop.
Change B2G UA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to change the B2G UA | |
# Based on Dave Hyland's script https://gist.github.com/2656232 | |
# Options: default, fennec, android | |
# Prereq: adb on your path | |
LOCAL_PREFS_JS=/tmp/prefs.js | |
PROFILE_DIR=$(adb shell echo -n "/data/b2g/mozilla/*.default") | |
REMOTE_PREFS_JS=${PROFILE_DIR}/prefs.js | |
rm -f ${LOCAL_PREFS_JS} | |
adb pull ${REMOTE_PREFS_JS} ${LOCAL_PREFS_JS} | |
ua="" | |
if [ "${1}" == "fennec" ] | |
then | |
echo "Changing UA to Fennec UA" | |
ua="Mozilla/5.0 (Android; Mobile; rv:20.0) Gecko/20.0 Firefox/20.0" | |
fi | |
if [ "${1}" == "android" ] | |
then | |
echo "Changing UA to Android Stock UA" | |
ua="Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19" | |
fi | |
grep -v general.useragent.override ${LOCAL_PREFS_JS} > ${LOCAL_PREFS_JS}.tmp | |
if [ "${ua}" != "" ] | |
then | |
echo 'user_pref("general.useragent.override", "'${ua}'");' >> ${LOCAL_PREFS_JS}.tmp | |
else | |
echo "Reseting B2G to default UA" | |
fi | |
set -x | |
adb push ${LOCAL_PREFS_JS}.tmp ${REMOTE_PREFS_JS} | |
adb shell stop b2g && adb shell start b2g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment