summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MobileCydia.mm38
-rw-r--r--[l---------]Sources.list/cydia.list1
-rw-r--r--postinst.mm9
3 files changed, 28 insertions, 20 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index abc1643..c6b8204 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -90,6 +90,7 @@
#include <sys/mount.h>
#include <sys/reboot.h>
+#include <dirent.h>
#include <fcntl.h>
#include <notify.h>
#include <dlfcn.h>
@@ -3758,24 +3759,25 @@ class CydiaLogCleaner :
return [self popErrorWithTitle:title] || !success;
}
-- (bool) _isEtceteraAptSourcesListDirectoryCydiaListSymbolicallyLinkedToMobileCachesCydiaSourceList {
- char target[1024];
- ssize_t length(readlink("/etc/apt/sources.list.d/cydia.list", target, sizeof(target) - 1));
- if (length == -1)
- return false;
- if (length >= sizeof(target))
- return false;
- target[length] = '\0';
- return strcmp(target, "/var/mobile/Library/Caches/com.saurik.Cydia/sources.list") == 0;
-}
-
- (bool) popErrorWithTitle:(NSString *)title forReadList:(pkgSourceList &)list {
- if ([self popErrorWithTitle:title forOperation:list.ReadMainList()])
- return true;
- if (![self _isEtceteraAptSourcesListDirectoryCydiaListSymbolicallyLinkedToMobileCachesCydiaSourceList])
- if ([self popErrorWithTitle:title forOperation:list.Read(SOURCES_LIST)])
- return true;
- return false;
+ list.Reset();
+
+ bool error(false);
+
+ if (access("/etc/apt/sources.list", F_OK) == 0)
+ error |= [self popErrorWithTitle:title forOperation:list.ReadAppend("/etc/apt/sources.list")];
+
+ std::string base("/etc/apt/sources.list.d");
+ if (DIR *sources = opendir(base.c_str())) {
+ while (dirent *source = readdir(sources))
+ if (source->d_name[0] != '.' && source->d_namlen > 5 && strcmp(source->d_name + source->d_namlen - 5, ".list") == 0 && strcmp(source->d_name, "cydia.list") != 0)
+ error |= [self popErrorWithTitle:title forOperation:list.ReadAppend((base + "/" + source->d_name).c_str())];
+ closedir(sources);
+ }
+
+ error |= [self popErrorWithTitle:title forOperation:list.ReadAppend(SOURCES_LIST)];
+
+ return error;
}
- (void) reloadDataWithInvocation:(NSInvocation *)invocation {
@@ -10413,8 +10415,6 @@ int main(int argc, char *argv[]) {
_assert(errno == ENOENT);
}
- system("/usr/libexec/cydia/cydo /bin/ln -sf /var/mobile/Library/Caches/com.saurik.Cydia/sources.list /etc/apt/sources.list.d/cydia.list");
-
/* APT Initialization {{{ */
_assert(pkgInitConfig(*_config));
_assert(pkgInitSystem(*_config, _system));
diff --git a/Sources.list/cydia.list b/Sources.list/cydia.list
index 2c62ba7..e69de29 120000..100644
--- a/Sources.list/cydia.list
+++ b/Sources.list/cydia.list
@@ -1 +0,0 @@
-/var/mobile/Library/Caches/com.saurik.Cydia/sources.list \ No newline at end of file
diff --git a/postinst.mm b/postinst.mm
index e69f9c2..a204b81 100644
--- a/postinst.mm
+++ b/postinst.mm
@@ -207,6 +207,15 @@ int main(int argc, const char *argv[]) {
#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_);