-
-
Save jhbush/4b672ad2bd802ab9d8886c0655743959 to your computer and use it in GitHub Desktop.
Python implementation of: seedutil enroll <program>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
''' Python implementation of "seedutil enroll <program>" ''' | |
import os | |
import objc | |
from Foundation import NSBundle, NSClassFromString | |
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework') | |
functions = [ | |
('_stringForSeedProgram_', '@I'), | |
('_setSeedProgramPref', '@I'), | |
('_setCatalogForSeedProgram', '@I'), | |
('_setHelpFeedbackMenuEnabled', '@I'), | |
('_setSeedOptOutUIDisabled', '@I'), | |
('_createFeedbackAssistantSymlink','@'), | |
] | |
objc.loadBundleFunctions(SeedingBundle, globals(), functions) | |
seedProgramManager = NSClassFromString('SDSeedProgramManager') | |
def enrollInSeedProgram(program): | |
if program < 4: | |
print "Seeding: Enrolling in seed program: %s" % seedProgramManager._stringForSeedProgram_(program) | |
seedProgramManager._setSeedProgramPref_(program) | |
if seedProgramManager._setCatalogForSeedProgram_(program) != 0: | |
seedProgramManager._setHelpFeedbackMenuEnabled_((program | 2) == 3) | |
seedProgramManager._setSeedOptOutUIDisabled_(0) | |
if ((program | 2) == 3): | |
seedProgramManager._createFeedbackAssistantSymlink() | |
else: | |
print "Seeding: Got invalid seed program: %d", program | |
if __name__ == "__main__": | |
print "\n[ 1 ] Customer Seed" | |
print "[ 2 ] Developer Seed" | |
print "[ 3 ] Public Beta Seed\n" | |
while True: | |
try: | |
program = int(raw_input("Select target program: ")) | |
if program < 1 or program > 3: | |
sys.stdout.write("\033[F\033[K") | |
else: | |
break; | |
except: | |
sys.stdout.write("\033[F\033[K") | |
enrollInSeedProgram(program) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment