summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-07-02 03:28:10 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-07-02 03:28:10 -0700
commitf6b68b2c49618bf8df27e993bc3df42e913180db (patch)
treec2fcefbac9ab3d7b1f763c1bee1a1c89713b338c
parent7bc0d82556d4169b4b2221a0373ca2262abebcc8 (diff)
Use a private (owned by mobile!) APT sources.list.
-rw-r--r--MobileCydia.mm6
-rw-r--r--Sources.h2
-rw-r--r--Sources.mm4
-rw-r--r--makefile2
-rw-r--r--postinst.mm33
5 files changed, 11 insertions, 36 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 0ae9485..a97fb96 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -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);
diff --git a/Sources.h b/Sources.h
index d2018c0..2defaf6 100644
--- 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
diff --git a/Sources.mm b/Sources.mm
index 8ad74a1..4cc2f9e 100644
--- a/Sources.mm
+++ b/Sources.mm
@@ -25,11 +25,13 @@
#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);
diff --git a/makefile b/makefile
index be185b6..0d5506b 100644
--- 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 $@
diff --git a/postinst.mm b/postinst.mm
index 45a7da3..35c92b1 100644
--- a/postinst.mm
+++ b/postinst.mm
@@ -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)