5 #include <sys/sysctl.h>
7 #include <CydiaSubstrate/CydiaSubstrate.h>
8 #include "CyteKit/PerlCompatibleRegEx.hpp"
10 _H<NSMutableDictionary> Sources_;
11 _H<NSString> CydiaSource_;
16 int main(int argc, const char *argv[]) {
17 if (argc < 2 || strcmp(argv[1], "configure") != 0)
20 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
23 sysctlbyname("kern.osversion", NULL, &size, NULL, 0);
24 char *osversion = new char[size];
25 if (sysctlbyname("kern.osversion", osversion, &size, NULL, 0) != -1)
26 System_ = [NSString stringWithUTF8String:osversion];
28 NSDictionary *metadata([[[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/metadata.plist"] autorelease]);
29 NSUInteger version(0);
31 if (metadata != nil) {
32 Sources_ = [metadata objectForKey:@"Sources"];
33 CydiaSource_ = [metadata objectForKey:@"CydiaSource"];
35 if (NSNumber *number = [metadata objectForKey:@"Version"])
36 version = [number unsignedIntValue];
39 if (CydiaSource_ == nil)
40 CydiaSource_ = @"apt.saurik.com";
43 Sources_ = [NSMutableDictionary dictionaryWithCapacity:8];
46 CydiaAddSource(@"http://apt.thebigboss.org/repofiles/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
47 CydiaAddSource(@"http://apt.modmyi.com/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
48 CydiaAddSource(@"http://cydia.zodttd.com/repo/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
49 CydiaAddSource(@"http://repo666.ultrasn0w.com/", @"./");