]>
Commit | Line | Data |
---|---|---|
eaa9f122 JF |
1 | #include <strings.h> |
2 | #include <Sources.h> | |
3 | ||
407564b5 JF |
4 | #include <sys/types.h> |
5 | #include <sys/sysctl.h> | |
6 | ||
608321d0 | 7 | #include <Menes/ObjectHandle.h> |
eaa9f122 JF |
8 | |
9 | _H<NSMutableDictionary> Sources_; | |
eaa9f122 JF |
10 | bool Changed_; |
11 | ||
407564b5 | 12 | _H<NSString> System_; |
eaa9f122 JF |
13 | |
14 | int main(int argc, const char *argv[]) { | |
15 | if (argc < 2 || strcmp(argv[1], "configure") != 0) | |
16 | return 0; | |
17 | ||
18 | NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); | |
19 | ||
407564b5 JF |
20 | size_t size; |
21 | sysctlbyname("kern.osversion", NULL, &size, NULL, 0); | |
22 | char *osversion = new char[size]; | |
23 | if (sysctlbyname("kern.osversion", osversion, &size, NULL, 0) != -1) | |
24 | System_ = [NSString stringWithUTF8String:osversion]; | |
eaa9f122 JF |
25 | |
26 | NSDictionary *metadata([[[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/metadata.plist"] autorelease]); | |
27 | NSUInteger version(0); | |
28 | ||
29 | if (metadata != nil) { | |
30 | Sources_ = [metadata objectForKey:@"Sources"]; | |
eaa9f122 JF |
31 | |
32 | if (NSNumber *number = [metadata objectForKey:@"Version"]) | |
33 | version = [number unsignedIntValue]; | |
34 | } | |
35 | ||
eaa9f122 JF |
36 | if (Sources_ == nil) |
37 | Sources_ = [NSMutableDictionary dictionaryWithCapacity:8]; | |
38 | ||
39 | if (version == 0) { | |
40 | CydiaAddSource(@"http://apt.thebigboss.org/repofiles/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]); | |
41 | CydiaAddSource(@"http://apt.modmyi.com/", @"stable", [NSMutableArray arrayWithObject:@"main"]); | |
42 | CydiaAddSource(@"http://cydia.zodttd.com/repo/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]); | |
43 | CydiaAddSource(@"http://repo666.ultrasn0w.com/", @"./"); | |
44 | } | |
45 | ||
46 | CydiaWriteSources(); | |
47 | ||
48 | [pool release]; | |
49 | return 0; | |
50 | } |