all: MobileCydia
clean:
- rm -f MobileCydia
+ rm -f MobileCydia postinst
rm -rf Objects/ Images/
Objects/%.o: %.c $(header)
CydiaAppliance: CydiaAppliance.mm
$(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
-debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst $(images) $(shell find MobileCydia.app) cydia.control
+postinst: postinst.mm Sources.mm Sources.h CyteKit/stringWithUTF8Bytes.mm CyteKit/stringWithUTF8Bytes.h CyteKit/UCPlatform.h
+ $(cycc) $(filter %.mm,$^) $(flags) -framework CoreFoundation -framework Foundation -framework UIKit -lpcre
+
+debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia preinst postinst $(images) $(shell find MobileCydia.app) cydia.control
sudo rm -rf _
mkdir -p _/var/lib/cydia
mkdir -p _/DEBIAN
./control.sh cydia.control _ >_/DEBIAN/control
- cp -a preinst _/DEBIAN/
+ cp -a preinst postinst _/DEBIAN/
find _ -exec touch -t "$$(date -j -f "%s" +"%Y%m%d%H%M.%S" "$$(git show --format='format:%ct' | head -n 1)")" {} ';'
--- /dev/null
+#include <strings.h>
+#include <Sources.h>
+
+#include <UIKit/UIKit.h>
+#include <CydiaSubstrate/CydiaSubstrate.h>
+#include "CyteKit/PerlCompatibleRegEx.hpp"
+
+_H<NSMutableDictionary> Sources_;
+_H<NSString> CydiaSource_;
+bool Changed_;
+
+_H<NSString> Firmware_;
+
+int main(int argc, const char *argv[]) {
+ if (argc < 2 || strcmp(argv[1], "configure") != 0)
+ return 0;
+
+ NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
+
+ Pcre pattern("^([0-9]+\\.[0-9]+)");
+
+ if (pattern([[UIDevice currentDevice] systemVersion]))
+ Firmware_ = pattern[1];
+
+ 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];
+
+ 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();
+
+ [pool release];
+ return 0;
+}