X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/eaa9f1224cce97bf2568e914b7f3e7efe3dc5505..a1bb38f9e6fbdafa64560a97ff55e2f27b1e82a3:/postinst.mm?ds=sidebyside diff --git a/postinst.mm b/postinst.mm index f55db811..70a87f1a 100644 --- a/postinst.mm +++ b/postinst.mm @@ -1,15 +1,16 @@ #include #include -#include +#include +#include + #include #include "CyteKit/PerlCompatibleRegEx.hpp" _H Sources_; -_H CydiaSource_; bool Changed_; -_H Firmware_; +_H System_; int main(int argc, const char *argv[]) { if (argc < 2 || strcmp(argv[1], "configure") != 0) @@ -17,25 +18,22 @@ int main(int argc, const char *argv[]) { NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]); - Pcre pattern("^([0-9]+\\.[0-9]+)"); - - if (pattern([[UIDevice currentDevice] systemVersion])) - Firmware_ = pattern[1]; + 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"]; - CydiaSource_ = [metadata objectForKey:@"CydiaSource"]; if (NSNumber *number = [metadata objectForKey:@"Version"]) version = [number unsignedIntValue]; } - if (CydiaSource_ == nil) - CydiaSource_ = @"apt.saurik.com"; - if (Sources_ == nil) Sources_ = [NSMutableDictionary dictionaryWithCapacity:8];