X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/49cc457aa95e5bb3f5b461c607ab4e0d8f94b499..ca0a920d902e70044e20bbd4efd993e5d63789e7:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index 95e5a40d..86e6a6f2 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -678,7 +678,6 @@ static const NSString *UI_; static int Finish_; static bool RestartSubstrate_; -static bool UpgradeCydia_; static NSArray *Finishes_; #define SpringBoard_ "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist" @@ -4090,11 +4089,17 @@ class CydiaLogCleaner : delock_ = nil; + pkgPackageManager::OrderResult result(manager_->DoInstall(statusfd_)); + NSString *oextended(@"/var/lib/apt/extended_states"); NSString *nextended(Cache("extended_states")); - pkgPackageManager::OrderResult result(manager_->DoInstall(statusfd_)); - system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/mv -f %@ %@", nextended, oextended] UTF8String]); - system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/chown 0:0 %@", oextended] UTF8String]); + + struct stat info; + if (stat([nextended UTF8String], &info) != -1 && (info.st_mode & S_IFMT) == S_IFREG) { + system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/mv -f %@ %@", nextended, oextended] UTF8String]); + system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/chown 0:0 %@", oextended] UTF8String]); + } + unlink([nextended UTF8String]); symlink([oextended UTF8String], [nextended UTF8String]); @@ -5125,8 +5130,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { issues_ = [NSMutableArray arrayWithCapacity:4]; - UpgradeCydia_ = false; - for (Package *package in packages) { pkgCache::PkgIterator iterator([package iterator]); NSString *name([package id]); @@ -5238,9 +5241,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [removes addObject:name]; } - if ([name isEqualToString:@"cydia"]) - UpgradeCydia_ = true; - substrate_ |= DepSubstrate(policy->GetCandidateVer(iterator)); substrate_ |= DepSubstrate(iterator.CurrentVer()); } @@ -5531,31 +5531,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) reloadSpringBoard { - if (kCFCoreFoundationVersionNumber > 700) { // XXX: iOS 6.x + if (kCFCoreFoundationVersionNumber >= 700) // XXX: iOS 6.x system("/bin/launchctl stop com.apple.backboardd"); - sleep(15); - system("/usr/bin/killall backboardd SpringBoard sbreload"); - return; - } - - pid_t pid(ExecFork()); - if (pid == 0) { - if (setsid() == -1) - perror("setsid"); - - pid_t pid(ExecFork()); - if (pid == 0) { - execl("/usr/libexec/cydia/cydo", "cydo", "/usr/bin/sbreload", NULL); - perror("sbreload"); - - exit(0); - } ReapZombie(pid); - - exit(0); - } ReapZombie(pid); - + else + system("/bin/launchctl stop com.apple.SpringBoard"); sleep(15); - system("/usr/bin/killall backboardd SpringBoard sbreload"); + system("/usr/bin/killall backboardd SpringBoard"); } - (void) close { @@ -9296,12 +9277,7 @@ _end - (void) _uicache { _trace(); - - if (UpgradeCydia_ && Finish_ > 0) - system("/usr/libexec/cydia/cydo /bin/su -c /usr/bin/uicache mobile"); - else - system("/usr/bin/uicache"); - + system("/usr/bin/uicache"); _trace(); } @@ -9374,15 +9350,7 @@ _end @synchronized (self) { for (Package *broken in (id) broken_) { [broken remove]; - NSString *id = [broken id]; - - system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /bin/rm -f" - " /var/lib/dpkg/info/%@.prerm" - " /var/lib/dpkg/info/%@.postrm" - " /var/lib/dpkg/info/%@.preinst" - " /var/lib/dpkg/info/%@.postinst" - " /var/lib/dpkg/info/%@.extrainst_" - , id, id, id, id, id] UTF8String]); + system([[NSString stringWithFormat:@"/usr/libexec/cydia/cydo /usr/libexec/cydia/fixhalf.sh %@", [broken id]] UTF8String]); } [self resolve];