#!/usr/bin/python
# Script to add EnableC3State for Chameleon boot loaders
import sys
import os
vol = str(sys.argv[3])
boot = "/Extra/org.chameleon.Boot.plist"
plist = vol + boot
infile = open(plist, "r")
# check if EnableC3State has been written or not
EnableC3StateCheck = False
body = ""
for line in infile:
# if we finish the tags and haven't written EnableC3State Yet
if "" in line and EnableC3StateCheck == False:
line = " EnableC3State\n"
line += " Yes\n"
line += "\n"
EnableC3StateCheck = True
body += line
infile.close()
outfile = open(plist, "w")
outfile.write(body)
outfile.close()