blogng/blog/2012-12-06-rooting-a-nexus-7.markdown
Dhananjay Balan 58b20109cf Convert from old categories to tags
import sys
import yaml

with open(sys.argv[1]) as fp:
    data = fp.read()

if not data.find("---") == 0:
    # no head
    print("NO YAML HEAD FOUND")
    sys.exit(-1)

data = data[3:]
head_end = data.find("---")

head = data[0:head_end]
data = data[head_end+3:]

metadata = yaml.safe_load(head)

cats = metadata.pop('categories', None)
if cats != None:
    if type(cats) == list:
        tags = cats
    elif type(cats) == str:
        tags = cats.split()

    tags = list(map(lambda t: t.lower(), tags))

    metadata["tags"] = ", ".join(tags)
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    # write it
    print(f"coverted: categories to tags: {tags} - {sys.argv[1]}")
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)

if not metadata.get("tags", None):
    metadata["tags"] = "untagged"
    new_data = f"---\n{yaml.dump(metadata, default_flow_style=False)}---{data}"
    print(f"untagged: {sys.argv[1]}")
    # write it
    with open(sys.argv[1], "w") as fp:
        fp.write(new_data)
    sys.exit(0)

print("No changes needed")
2019-01-28 17:16:27 -05:00

40 lines
1.2 KiB
Markdown

---
author: dhananjayishere
comments: true
date: 2012-12-06 18:26:00
layout: post
slug: rooting-a-nexus-7
tags: android, programing, hack, rooting
title: Rooting a nexus 7
wordpress_id: 171074083
---
Lot of posts in the web about this is just bogus, all of them want you
to download a fat rootkit and click on the root.exe :-/
Being a developer device, rooting nexus 7 is easy.
1. Gain developer privilege (figure out yourself :-P)
2. Reboot to bootloader
```
$ adb reboot bootloader
```
3. Unlock the bootloader
```
$ fastboot oem unlock # Might have to be the superuser.
```
4. Download the recovery image for device from [here](http://clockworkmod.com/rommanager)
and flash it
```
$ fastboot flash recovery
```
5. Get the [superuser binary](http://forum.xda-developers.com/showthread.php?t=1538053).
6. Reboot the device and put it in the sdcard (or any storage you have,)
7. Reboot to the recovery and flash it.
```
$ adb reboot recovery
```
Note: People suggested using this to [keep root priviliges](https://play.google.com/store/apps/details?id=org.projectvoodoo.otarootkeeper&feature=search_result#?t=W251bGwsMSwxLDEsIm9yZy5wcm9qZWN0dm9vZG9vLm90YXJvb3RrZWVwZXIiXQ..) after OTA -