mirror of
https://github.com/tihmstar/futurerestore.git
synced 2024-12-22 17:35:29 +00:00
properly selecting correct buildidentity now
This commit is contained in:
parent
74c63d725b
commit
485b0912fc
|
@ -567,7 +567,7 @@ char *futurerestore::getLatestFirmwareUrl(){
|
|||
|
||||
void futurerestore::loadLatestBaseband(){
|
||||
char * manifeststr = getLatestManifest();
|
||||
char *pathStr = getPathOfElementInManifest("BasebandFirmware", manifeststr);
|
||||
char *pathStr = getPathOfElementInManifest("BasebandFirmware", manifeststr, getConnectedDeviceModel(), 0);
|
||||
info("downloading Baseband\n\n");
|
||||
if (downloadPartialzip(getLatestFirmwareUrl(), pathStr, _basebandPath = BASEBAND_TMP_PATH))
|
||||
reterror(-32, "could not download baseband\n");
|
||||
|
@ -576,7 +576,7 @@ void futurerestore::loadLatestBaseband(){
|
|||
|
||||
void futurerestore::loadLatestSep(){
|
||||
char * manifeststr = getLatestManifest();
|
||||
char *pathStr = getPathOfElementInManifest("SEP", manifeststr);
|
||||
char *pathStr = getPathOfElementInManifest("SEP", manifeststr, getConnectedDeviceModel(), 0);
|
||||
info("downloading SEP\n\n");
|
||||
if (downloadPartialzip(getLatestFirmwareUrl(), pathStr, _sepPath = SEP_TMP_PATH))
|
||||
reterror(-33, "could not download SEP\n");
|
||||
|
@ -688,20 +688,20 @@ plist_t futurerestore::loadPlistFromFile(const char *path){
|
|||
return ret;
|
||||
}
|
||||
|
||||
char *futurerestore::getPathOfElementInManifest(const char *element, const char *manifeststr){
|
||||
char *futurerestore::getPathOfElementInManifest(const char *element, const char *manifeststr, const char *model, int isUpdateInstall){
|
||||
char *pathStr = NULL;
|
||||
ptr_smart<plist_t> buildmanifest(NULL,plist_free);
|
||||
|
||||
plist_from_xml(manifeststr, (uint32_t)strlen(manifeststr), &buildmanifest);
|
||||
|
||||
if (plist_t buildidentities = plist_dict_get_item(buildmanifest._p, "BuildIdentities"))
|
||||
if (plist_t firstIdentitie = plist_array_get_item(buildidentities, 0))
|
||||
if (plist_t manifest = plist_dict_get_item(firstIdentitie, "Manifest"))
|
||||
if (plist_t identity = getBuildidentity(buildmanifest._p, model, isUpdateInstall))
|
||||
if (plist_t manifest = plist_dict_get_item(identity, "Manifest"))
|
||||
if (plist_t elem = plist_dict_get_item(manifest, element))
|
||||
if (plist_t info = plist_dict_get_item(elem, "Info"))
|
||||
if (plist_t path = plist_dict_get_item(info, "Path"))
|
||||
if (plist_get_string_val(path, &pathStr), pathStr)
|
||||
goto noerror;
|
||||
|
||||
reterror(-31, "could not get %s path\n",element);
|
||||
noerror:
|
||||
return pathStr;
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
static char *getNonceFromAPTicket(const char* apticketPath);
|
||||
static plist_t loadPlistFromFile(const char *path);
|
||||
static void saveStringToFile(const char *str, const char *path);
|
||||
static char *getPathOfElementInManifest(const char *element, const char *manifeststr);
|
||||
static char *getPathOfElementInManifest(const char *element, const char *manifeststr, const char *model, int isUpdateInstall);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ int main(int argc, const char * argv[]) {
|
|||
futurerestore client;
|
||||
if (!client.init()) reterror(-3,"can't init, no device found\n");
|
||||
|
||||
try {
|
||||
if (apticketPaths.size()) client.loadAPTickets(apticketPaths);
|
||||
|
||||
if (!((apticketPaths.size() && ipsw)
|
||||
|
@ -178,6 +179,11 @@ int main(int argc, const char * argv[]) {
|
|||
if (flags & FLAG_WAIT){
|
||||
client.waitForNonce();
|
||||
}
|
||||
} catch (int error) {
|
||||
err = error;
|
||||
printf("[Error] Fail code=%d\n",err);
|
||||
goto error;
|
||||
}
|
||||
|
||||
try {
|
||||
res = client.doRestore(ipsw, flags & FLAG_UPDATE);
|
||||
|
|
Loading…
Reference in a new issue