]> git.saurik.com Git - cydia.git/commitdiff
Checkpointing a bad Cydia build (why not?).
authorJay Freeman (saurik) <saurik@saurk.com>
Sun, 20 Jul 2008 13:52:22 +0000 (13:52 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 30 Sep 2010 07:08:11 +0000 (07:08 +0000)
Cydia.mm
Library/move.sh
Library/space.sh
Library/startup

index e6f81400a81e4fe620751fc6f94381ee0fd27443..b100e59b41f5725ba8626a5a3c9be8b5fa775c89 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -2157,6 +2157,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     UITextLabel *status_;
     UIPushButton *close_;
     id delegate_;
+    BOOL running_;
 }
 
 - (void) transitionViewDidComplete:(UITransitionView*)view fromView:(UIView*)from toView:(UIView*)to;
@@ -2169,6 +2170,8 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 - (void) _detachNewThreadData:(ProgressData *)data;
 - (void) detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)object title:(NSString *)title;
 
+- (BOOL) isRunning;
+
 @end
 
 @protocol ProgressViewDelegate
@@ -2339,6 +2342,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     [overlay_ addSubview:close_];
     [progress_ removeFromSuperview];
     [status_ removeFromSuperview];
+
+    [delegate_ setStatusBarShowsProgress:NO];
+    running_ = NO;
 }
 
 - (void) _detachNewThreadData:(ProgressData *)data {
@@ -2364,6 +2370,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     [overlay_ addSubview:progress_];
     [overlay_ addSubview:status_];
 
+    [delegate_ setStatusBarShowsProgress:YES];
+    running_ = YES;
+
     [transition_ transition:6 toView:overlay_];
 
     [NSThread
@@ -2473,6 +2482,10 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     [output_ scrollRectToVisible:rect animated:YES];
 }
 
+- (BOOL) isRunning {
+    return NO;
+}
+
 @end
 /* }}} */
 
@@ -4892,6 +4905,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     unsigned tag_;
 
     UIKeyboard *keyboard_;
+    UIProgressHUD *hud_;
 
     InstallView *install_;
     ChangesView *changes_;
@@ -5215,6 +5229,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 }
 
 - (void) applicationWillSuspend {
+    _trace();
     [super applicationWillSuspend];
 
     [database_ clean];
@@ -5241,36 +5256,19 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     }
 }
 
-- (void) applicationDidFinishLaunching:(id)unused {
-    _assert(pkgInitConfig(*_config));
-    _assert(pkgInitSystem(*_config, _system));
-
-    confirm_ = nil;
-    tag_ = 1;
-
-    essential_ = [[NSMutableArray alloc] initWithCapacity:4];
-    broken_ = [[NSMutableArray alloc] initWithCapacity:4];
+- (void) finish {
+    if (hud_ != nil) {
+        [self setStatusBarShowsProgress:NO];
 
-    CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
-    window_ = [[UIWindow alloc] initWithContentRect:screenrect];
-
-    [window_ orderFront: self];
-    [window_ makeKey: self];
-    [window_ _setHidden: NO];
-
-    database_ = [[Database alloc] init];
-    progress_ = [[ProgressView alloc] initWithFrame:[window_ bounds] database:database_ delegate:self];
-    [database_ setDelegate:progress_];
-    [window_ setContentView:progress_];
-
-    underlay_ = [[UIView alloc] initWithFrame:[progress_ bounds]];
-    [progress_ setContentView:underlay_];
+        [hud_ show:NO];
+        [hud_ removeFromSuperview];
+        [hud_ autorelease];
+        hud_ = nil;
+    }
 
     overlay_ = [[UIView alloc] initWithFrame:[underlay_ bounds]];
 
-    if (!bootstrap_)
-        [underlay_ addSubview:overlay_];
-
+    CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
     book_ = [[CYBook alloc] initWithFrame:CGRectMake(
         0, 0, screenrect.size.width, screenrect.size.height - 48
     ) database:database_];
@@ -5368,7 +5366,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
     manage_ = [[ManageView alloc] initWithBook:book_ database:database_];
     search_ = [[SearchView alloc] initWithBook:book_ database:database_];
 
-    [progress_ resetView];
+    if (!bootstrap_)
+        [underlay_ addSubview:overlay_];
+
     [self reloadData];
 
     if (bootstrap_)
@@ -5377,6 +5377,68 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
         [self _setHomePage];
 }
 
+- (void) reorganize {
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    //system("/usr/libexec/cydia/free.sh");
+    //[self performSelectorOnMainThread:@selector(finish) withObject:nil waitUntilDone:NO];
+    [pool release];
+}
+
+- (void) applicationSuspend:(__GSEvent *)event {
+    if (hud_ == nil && ![progress_ isRunning])
+        [super applicationSuspend:event];
+    _trace();
+}
+
+- (void) applicationDidFinishLaunching:(id)unused {
+    _assert(pkgInitConfig(*_config));
+    _assert(pkgInitSystem(*_config, _system));
+
+    confirm_ = nil;
+    tag_ = 1;
+
+    essential_ = [[NSMutableArray alloc] initWithCapacity:4];
+    broken_ = [[NSMutableArray alloc] initWithCapacity:4];
+
+    CGRect screenrect = [UIHardware fullScreenApplicationContentRect];
+    window_ = [[UIWindow alloc] initWithContentRect:screenrect];
+
+    [window_ orderFront: self];
+    [window_ makeKey: self];
+    [window_ _setHidden: NO];
+
+    database_ = [[Database alloc] init];
+    progress_ = [[ProgressView alloc] initWithFrame:[window_ bounds] database:database_ delegate:self];
+    [database_ setDelegate:progress_];
+    [window_ setContentView:progress_];
+
+    underlay_ = [[UIView alloc] initWithFrame:[progress_ bounds]];
+    [progress_ setContentView:underlay_];
+
+    [progress_ resetView];
+
+    if (
+        readlink("/Applications", NULL, 0) == -1 && errno == EINVAL ||
+        readlink("/usr/share", NULL, 0) == -1 && errno == EINVAL ||
+        readlink("/Library/Ringtones", NULL, 0) == -1 && errno == EINVAL ||
+        readlink("/Library/Wallpapers", NULL, 0) == -1 && errno == EINVAL
+    ) {
+        hud_ = [[UIProgressHUD alloc] initWithWindow:window_];
+        [hud_ setText:@"Reorganizing\nOne Minute!"];
+        [hud_ show:YES];
+        [underlay_ addSubview:hud_];
+
+        [self setStatusBarShowsProgress:YES];
+
+        [NSThread
+            detachNewThreadSelector:@selector(reorganize)
+            toTarget:self
+            withObject:nil
+        ];
+    } else
+        [self finish];
+}
+
 - (void) showKeyboard:(BOOL)show {
     CGSize keysize = [UIKeyboard defaultSize];
     CGRect keydown = {{0, [overlay_ bounds].size.height}, keysize};
index 3cbe79944d6d3adbf267c9b845f3072ceab4c5a9..635c1539f68d4c0f314ea6c5880fb08ac6063ff1 100755 (executable)
@@ -21,7 +21,7 @@ function mv_() {
     src=$1
 
     mkdir -p /var/stash
-    dst=$(mktemp -d /var/stash/$(basename "${src}").XXXXXX)
+    dst=$(mktemp -d /var/stash/"${src##*/}".XXXXXX)
 
     if [[ -e ${src} ]]; then
         chmod --reference="${src}" "${dst}"
index 953ae57996ae328677135fa2682f0ea0e675cc34..3be1f0d44bee6f9138a2083c162c6ef3e6b0f8b1 100755 (executable)
@@ -8,5 +8,5 @@ for dir in \
     /System/Library/TextInput \
     /usr/share
 do
-    . /usr/libexec/cydia/move.sh -v "${dir}"
+    . /usr/libexec/cydia/move.sh "$@" "${dir}"
 done
index 6efc471dd58d8d6932af4b629aa0642a60b1528f..7ee6cd3e54f022fd58793c37a9536a043ebe2a15 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/bash
 export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
 /usr/libexec/cydia/firmware.sh
-/usr/libexec/cydia/space.sh
 debs=/var/root/Media/Cydia/AutoInstall/*.deb
 dpkg -i ${debs}
 rm -f ${debs}