]> git.saurik.com Git - cydia.git/commitdiff
Use a private (owned by mobile!) APT sources.list.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 10:28:10 +0000 (03:28 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 2 Jul 2015 10:28:10 +0000 (03:28 -0700)
MobileCydia.mm
Sources.h
Sources.mm
makefile
postinst.mm

index 0ae9485f306a47ff5e08fbf0ef2986e2a65b5a71..a97fb96cd2f30536a901d28a2251292c6439582d 100644 (file)
@@ -3773,6 +3773,8 @@ class CydiaLogCleaner :
 - (bool) popErrorWithTitle:(NSString *)title forReadList:(pkgSourceList &)list {
     if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
         return true;
+    if ([self popErrorWithTitle:title forOperation:list.Read(SOURCES_LIST)])
+        return true;
     return false;
 }
 
@@ -9064,7 +9066,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
         }
     }
 
-    _root(CydiaWriteSources());
+    CydiaWriteSources();
 }
 
 // Navigation controller for the queuing badge.
@@ -10454,7 +10456,7 @@ int main(int argc, char *argv[]) {
     } broken = nil;
     /* }}} */
 
-    _root(CydiaWriteSources());
+    CydiaWriteSources();
 
     _trace();
     mkdir("/var/mobile/Library/Cydia", 0755);
index d2018c041cf7a8fe79451bd8acf6ca1c68f166d0..2defaf6b36889b58462a84d700db5e977a3e2210 100644 (file)
--- a/Sources.h
+++ b/Sources.h
@@ -28,4 +28,6 @@ void CydiaWriteSources();
 void CydiaAddSource(NSDictionary *source);
 void CydiaAddSource(NSString *href, NSString *distribution, NSArray *sections = nil);
 
+#define SOURCES_LIST "/var/mobile/Library/Caches/com.saurik.Cydia/sources.list"
+
 #endif//Sources_H
index 8ad74a15ed0a1ac190fc5afb140ecd387a516df7..4cc2f9e927d43db7ef8d867c5422e681a7e787ff 100644 (file)
 
 #include <cstdio>
 
+#include "Sources.h"
+
 extern _H<NSMutableDictionary> Sources_;
 extern bool Changed_;
 
 void CydiaWriteSources() {
-    FILE *file(fopen("/etc/apt/sources.list.d/cydia.list", "w"));
+    FILE *file(fopen(SOURCES_LIST, "w"));
     _assert(file != NULL);
 
     fprintf(file, "deb http://apt.saurik.com/ ios/%.2f main\n", kCFCoreFoundationVersionNumber);
index be185b62b2f36af47f17ddbac45fcfec51e84a07..0d5506b5b962f1213f7df8c6195af1f727657e3c 100644 (file)
--- a/makefile
+++ b/makefile
@@ -141,7 +141,7 @@ cydo: cydo.cpp
        $(cycc) -std=c++11 $(filter %.cpp,$^) $(flags) $(link) -Wno-deprecated-writable-strings
        @ldid -T0 -S $@
 
-postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
+postinst: postinst.mm CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
        $(cycc) -std=c++11 $(filter %.mm,$^) $(flags) $(link) -framework CoreFoundation -framework Foundation -framework UIKit
        @ldid -T0 -S $@
 
index 45a7da37d7f38e3a259346784c775637095a4be4..35c92b1ce04299c366647984457b0dec842a0b42 100644 (file)
@@ -171,11 +171,6 @@ static bool FixApplications() {
     }
 }
 
-_H<NSMutableDictionary> Sources_;
-bool Changed_;
-
-_H<NSString> System_;
-
 int main(int argc, const char *argv[]) {
     if (argc < 2 || strcmp(argv[1], "configure") != 0)
         return 0;
@@ -195,33 +190,7 @@ int main(int argc, const char *argv[]) {
         }
     }
 
-    size_t size;
-    sysctlbyname("kern.osversion", NULL, &size, NULL, 0);
-    char *osversion = new char[size];
-    if (sysctlbyname("kern.osversion", osversion, &size, NULL, 0) != -1)
-        System_ = [NSString stringWithUTF8String:osversion];
-
-    NSDictionary *metadata([[[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/metadata.plist"] autorelease]);
-    NSUInteger version(0);
-
-    if (metadata != nil) {
-        Sources_ = [metadata objectForKey:@"Sources"];
-
-        if (NSNumber *number = [metadata objectForKey:@"Version"])
-            version = [number unsignedIntValue];
-    }
-
-    if (Sources_ == nil)
-        Sources_ = [NSMutableDictionary dictionaryWithCapacity:8];
-
-    if (version == 0) {
-        CydiaAddSource(@"http://apt.thebigboss.org/repofiles/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
-        CydiaAddSource(@"http://apt.modmyi.com/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
-        CydiaAddSource(@"http://cydia.zodttd.com/repo/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
-        CydiaAddSource(@"http://repo666.ultrasn0w.com/", @"./");
-    }
-
-    CydiaWriteSources();
+    unlink("/etc/apt/sources.list.d/cydia.list");
 
     #define OldCache_ "/var/root/Library/Caches/com.saurik.Cydia"
     if (access(OldCache_, F_OK) == 0)