#!/usr/bin/python
# Script to add EnableC2State 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 EnableC2State has been written or not
EnableC2StateCheck = False
body = ""
for line in infile:
# if we finish the tags and haven't written EnableC2State Yet
if "" in line and EnableC2StateCheck == False:
line = " EnableC2State\n"
line += " Yes\n"
line += "\n"
EnableC2StateCheck = True
body += line
infile.close()
outfile = open(plist, "w")
outfile.write(body)
outfile.close()