def install_or_upgrade(self, ipaPath, cmd="Install", options=None, handler=None, *args): afc = AFCClient(self.lockdown) afc.set_file_contents("/" + os.path.basename(ipaPath), open(ipaPath, "rb").read()) cmd = {"Command": cmd, "PackagePath": os.path.basename(ipaPath)} if options: cmd.update(options) self.service.sendPlist(cmd) # print "%s : " % (cmd, bundleID) print "%s : %s\n" % (cmd, self.watch_completion(handler, args))
def mobile_install(lockdown,ipaPath): #Start afc service & upload ipa afc = AFCClient(lockdown) afc.set_file_contents("/" + os.path.basename(ipaPath), open(ipaPath,'rb').read()) mci = lockdown.startService("com.apple.mobile.installation_proxy") #print mci.sendPlist({"Command":"Archive","ApplicationIdentifier": "com.joystickgenerals.STActionPig"}) mci.sendPlist({"Command":"Install", #"ApplicationIdentifier": "com.gotohack.JBChecker", "PackagePath": os.path.basename(ipaPath)}) while True: z = mci.recvPlist() if not z: break completion = z.get('PercentComplete') if completion: print 'Installing, %s: %s %% Complete' % (ipaPath, z['PercentComplete']) if z.get('Status') == 'Complete': print "Installation %s\n" % z['Status'] break