]> git.saurik.com Git - cydia.git/blobdiff - postinst.mm
Steal more entitlements from MobileSafari: I want Nitro.
[cydia.git] / postinst.mm
index f55db811f38a5481083656dbae8f3fac406f4e43..70a87f1a84c75222d040cc85494f1247044e8fcf 100644 (file)
@@ -1,15 +1,16 @@
 #include <strings.h>
 #include <Sources.h>
 
-#include <UIKit/UIKit.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
 #include <CydiaSubstrate/CydiaSubstrate.h>
 #include "CyteKit/PerlCompatibleRegEx.hpp"
 
 _H<NSMutableDictionary> Sources_;
-_H<NSString> CydiaSource_;
 bool Changed_;
 
-_H<NSString> Firmware_;
+_H<NSString> 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];