summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2013-02-06 14:12:31 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2013-02-06 14:14:17 +0000
commit4975f170949298759cf6faa7b81bb364e7df3c61 (patch)
tree9a493cc9df05830e7e130382d77a57f6a17c1483
parent7f9e55ed1a0297c7fd41c333438cccbd2115195c (diff)
Use MobileInstallation framework to fix caches.v1.1.6
-rw-r--r--extrainst_.mm35
-rw-r--r--extrainst_.xml10
2 files changed, 31 insertions, 14 deletions
diff --git a/extrainst_.mm b/extrainst_.mm
index 2554c0e..9a6a679 100644
--- a/extrainst_.mm
+++ b/extrainst_.mm
@@ -43,6 +43,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <dlfcn.h>
#include "csstore.hpp"
@@ -99,24 +100,30 @@ bool FinishCydia(const char *finish) {
}
void FixCache(NSString *home, NSString *plist) {
- printf("attempting to fix weather app issue:\n");
+ printf("attempting to fix weather app issue, please wait...\n");
DeleteCSStores([home UTF8String]);
unlink([plist UTF8String]);
- system("launchctl stop com.apple.mobile.installd");
- system("launchctl start com.apple.mobile.installd");
-
- printf("waiting for application/icon cache rebuild...\n");
- printf("this will timeout (harmlessly) after 90 seconds\n");
-
- for (unsigned i(0); i != 90; ++i) {
- if (i != 0 && (i % 10) == 0)
- printf("after %i seconds, still waiting for rebuild...\n", i);
- if ([[NSMutableDictionary dictionaryWithContentsOfFile: plist] objectForKey: @"User"] != nil)
- break;
- sleep(1);
- }
+ bool succeeded(false);
+
+ if (void *MobileInstallation$ = dlopen("/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation", RTLD_GLOBAL | RTLD_LAZY)) {
+ int (*MobileInstallation$_MobileInstallationRebuildMap)(CFBooleanRef, CFBooleanRef, CFBooleanRef);
+ MobileInstallation$_MobileInstallationRebuildMap = reinterpret_cast<int (*)(CFBooleanRef, CFBooleanRef, CFBooleanRef)>(dlsym(MobileInstallation$, "_MobileInstallationRebuildMap"));
+ if (MobileInstallation$_MobileInstallationRebuildMap != NULL) {
+ if (int error = MobileInstallation$_MobileInstallationRebuildMap(kCFBooleanTrue, kCFBooleanTrue, kCFBooleanTrue))
+ printf("failed to rebuild cache (but we gave it a good try); error #%d\n", error);
+ else {
+ printf("successfully rebuilt application information cache.\n");
+ succeeded = true;
+ }
+ } else
+ printf("unable to find _MobileInstallationRebuildMap symbol.\n");
+ } else
+ printf("unable to load MobileInstallation library.\n");
+
+ if (!succeeded)
+ printf("this is not a problem: it will be regenerated as the device boots\n");
if (!FinishCydia("reboot"))
printf("you must reboot to finalize your cache.\n");
diff --git a/extrainst_.xml b/extrainst_.xml
new file mode 100644
index 0000000..0829339
--- /dev/null
+++ b/extrainst_.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.private.mobileinstall.allowedSPI</key>
+ <array>
+ <string>RebuildMaps</string>
+ </array>
+</dict>
+</plist>