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