#!/usr/bin/python
#
# Script to change GraphicsEnabler to Yes for Chameleon boot loaders
#
# Copyright (C) tonymacx86 LLC

import sys
import os

vol = str(sys.argv[1])
boot = "/Extra/org.chameleon.Boot.plist"
plist = vol + boot
infile = open(plist, "r")

body = ""

for line in infile:
    # Look for GraphicsEnabler and then advance to the next line
    # and then change the line to read "<string>Yes</string>"
    if "<key>GraphicsEnabler</key>" in line:
        infile.next()
        line += "        <string>Yes</string>\n"
        
    body += line
    
infile.close()

outfile = open(plist, "w")
outfile.write(body)
outfile.close()
