#!/usr/bin/python␊ |
# Script to add Instant Menu for Chameleon boot loaders␊ |
# Copyright (C) tonymacx86 LLC␊ |
␊ |
import sys␊ |
import os␊ |
␊ |
vol = str(sys.argv[3])␊ |
boot = "/Extra/org.chameleon.Boot.plist"␊ |
plist = vol + boot␊ |
infile = open(plist, "r")␊ |
# check if Instant Menu has been written or not␊ |
InstantMenuCheck = False␊ |
␊ |
body = ""␊ |
␊ |
for line in infile:␊ |
# if Timeout is there, advance the next line to␊ |
# read past it, and then change the lines to read␊ |
# "<key>Instant Menu<\key>" and "<string>Yes</string>"␊ |
if "<key>Timeout</key>" in line:␊ |
line = infile.next()␊ |
line = " <key>Instant Menu</key>\n"␊ |
line += " <string>Yes</string>\n"␊ |
InstantMenuCheck = True␊ |
␊ |
# if we finish the tags and haven't written Instant Menu Yet␊ |
if "</dict>" in line and InstantMenuCheck == False:␊ |
line = " <key>Instant Menu</key>\n"␊ |
line += " <string>Yes</string>\n"␊ |
line += "</dict>\n"␊ |
InstantMenuCheck = True␊ |
␊ |
body += line␊ |
␊ |
infile.close()␊ |
␊ |
outfile = open(plist, "w")␊ |
outfile.write(body)␊ |
outfile.close()␊␊ |