- 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/", @"./");
+ #define OldCache_ "/var/root/Library/Caches/com.saurik.Cydia"
+ if (access(OldCache_, F_OK) == 0)
+ system("rm -rf " OldCache_);
+
+ #define NewCache_ "/var/mobile/Library/Caches/com.saurik.Cydia"
+ system("cd /; su -c 'mkdir -p " NewCache_ "' mobile");
+ if (access(NewCache_ "/lists", F_OK) != 0 && errno == ENOENT)
+ system("cp -at " NewCache_ " /var/lib/apt/lists");
+ system("chown -R 501.501 " NewCache_);
+
+ #define OldLibrary_ "/var/lib/cydia"
+
+ #define NewLibrary_ "/var/mobile/Library/Cydia"
+ system("cd /; su -c 'mkdir -p " NewLibrary_ "' mobile");
+
+ #define Cytore_ "/metadata.cb0"
+
+ #define CYDIA_LIST "/etc/apt/sources.list.d/cydia.list"
+ unlink(CYDIA_LIST);
+ [[NSString stringWithFormat:@
+ "deb http://apt.saurik.com/ ios/%.2f main\n"
+ "deb http://apt.thebigboss.org/repofiles/cydia/ stable main\n"
+ "deb http://cydia.zodttd.com/repo/cydia/ stable main\n"
+ "deb http://apt.modmyi.com/ stable main\n"
+ , kCFCoreFoundationVersionNumber] writeToFile:@ CYDIA_LIST atomically:YES];
+
+ if (access(NewLibrary_ Cytore_, F_OK) != 0 && errno == ENOENT) {
+ if (access(NewCache_ Cytore_, F_OK) == 0)
+ system("mv -f " NewCache_ Cytore_ " " NewLibrary_);
+ else if (access(OldLibrary_ Cytore_, F_OK) == 0)
+ system("mv -f " OldLibrary_ Cytore_ " " NewLibrary_);
+ chown(NewLibrary_ Cytore_, 501, 501);