]> git.saurik.com Git - cydia.git/blobdiff - postinst.mm
Move WebView (Apple) category to iPhonePrivate.h.
[cydia.git] / postinst.mm
index 405b3176ecbea26888247a32fcbdbcb738b2f7a9..d96d624c0f21ed349aedb8cba193f48b7d1d63b7 100644 (file)
@@ -24,6 +24,17 @@ void Finish(const char *finish) {
     fclose(fout);
 }
 
+static bool FixProtections() {
+    for (const char *path : (const char *[]) {"/var/lib", "/var/cache", "/var/stash"}) {
+        mkdir(path, 0755);
+        if (system([[NSString stringWithFormat:@"/usr/libexec/cydia/setnsfpn %s", path] UTF8String]) != 0) {
+            fprintf(stderr, "failed to setnsfpn %s\n", path);
+            return false;
+        }
+    }
+    return true;
+}
+
 static void FixPermissions() {
     DIR *stash(opendir("/var/stash"));
     if (stash == NULL)
@@ -125,6 +136,10 @@ int main(int argc, const char *argv[]) {
 
     NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
 
+    if (kCFCoreFoundationVersionNumber >= 1000)
+        if (!FixProtections())
+            return 1;
+
     size_t size;
     sysctlbyname("kern.osversion", NULL, &size, NULL, 0);
     char *osversion = new char[size];
@@ -153,6 +168,10 @@ int main(int argc, const char *argv[]) {
 
     CydiaWriteSources();
 
+    #define OldCache_ "/var/root/Library/Caches/com.saurik.Cydia"
+    if (access(OldCache_, F_OK) == 0)
+        system("rm -rf " OldCache_);
+
     FixPermissions();
 
     if (FixApplications())