Skip to content

Instantly share code, notes, and snippets.

@eliperelman
Created October 28, 2014 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliperelman/c34a4e1cb36d9cf8ba30 to your computer and use it in GitHub Desktop.
Save eliperelman/c34a4e1cb36d9cf8ba30 to your computer and use it in GitHub Desktop.
Enable/disable NSPR Logging
#!/bin/sh
# Alias this script for easier experience
# Usage:
# ./nspr.sh on
# ./nspr.sh off
NSPR="export NSPR_LOG_MODULES=ObserverService:5"
OPTION=$1
DISK_DEVICE=`adb shell mount | grep '/system' | awk '{ print $1 }'`
adb shell "mount -o remount,rw $DISK_DEVICE /system"
adb pull /system/bin/b2g.sh .
LINE2=`sed '2q;d' b2g.sh`
if [ "$OPTION" = "on" ] && [ "$LINE2" != "$NSPR" ]; then
sed -i "2i$NSPR" b2g.sh
elif [ "$OPTION" = "off" ] && [ "$LINE2" = "$NSPR" ]; then
sed -i '2d' b2g.sh
fi
adb push b2g.sh /system/bin/b2g.sh
rm b2g.sh
adb shell chmod 755 /system/bin/b2g.sh
adb shell chown root.shell /system/bin/b2g.sh
adb reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment