[37448] users/rhwood/Pallet

rhwood at macports.org rhwood at macports.org
Sun Jun 8 02:01:57 PDT 2008


Revision: 37448
          http://trac.macosforge.org/projects/macports/changeset/37448
Author:   rhwood at macports.org
Date:     2008-06-08 02:01:56 -0700 (Sun, 08 Jun 2008)

Log Message:
-----------
Sync a number of changes with SVN
BUILDS, RUNS, FAILS TO WORK
Launcher -> PalletHelper
Fix absolute paths (#15524)
Build for current OS instead of 10.4u (possible fix for #15525)
Remove older unused reference materials

Modified Paths:
--------------
    users/rhwood/Pallet/AuthorizedExecutable.h
    users/rhwood/Pallet/AuthorizedExecutable.m
    users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj
    users/rhwood/Pallet/PortAuthority.m

Added Paths:
-----------
    users/rhwood/Pallet/PalletHelper.h
    users/rhwood/Pallet/PalletHelper.m

Modified: users/rhwood/Pallet/AuthorizedExecutable.h
===================================================================
--- users/rhwood/Pallet/AuthorizedExecutable.h	2008-06-08 08:38:25 UTC (rev 37447)
+++ users/rhwood/Pallet/AuthorizedExecutable.h	2008-06-08 09:01:56 UTC (rev 37448)
@@ -38,9 +38,11 @@
 
 #import <Foundation/Foundation.h>
 #import <Security/Authorization.h>
+#import <SecurityFoundation/SFAuthorization.h>
 
 @interface AuthorizedExecutable : NSObject {
 
+	SFAuthorization *authorization;
     AuthorizationRef authorizationRef;
     NSMutableArray* arguments;
 	NSDictionary* environment;

Modified: users/rhwood/Pallet/AuthorizedExecutable.m
===================================================================
--- users/rhwood/Pallet/AuthorizedExecutable.m	2008-06-08 08:38:25 UTC (rev 37447)
+++ users/rhwood/Pallet/AuthorizedExecutable.m	2008-06-08 09:01:56 UTC (rev 37448)
@@ -1,14 +1,14 @@
 /*
  File: AuthorizedExecutable.m
-
+ 
  Created by David Love on Thu Jul 18 2002.
  Copyright (c) 2002 Cashmere Software, Inc.
  Released to Steven J. Burr on August 21, 2002, under the Gnu General Public License.
-
+ 
  See the header file, AuthorizedExecutable.h for more information on the license.
+ 
+ */
 
-*/
-
 #import <Security/AuthorizationTags.h>
 #import "AuthorizedExecutable.h"
 
@@ -94,18 +94,28 @@
     AuthorizationRights rights;
     AuthorizationItem items[1];
     OSStatus err = errAuthorizationSuccess;
-
+	
     if (! [self isExecutable])
     {
         return false;
     }
+	
+	items[0].name = "org.macports.pallet.helper";
+	items[0].value = 0;
+	items[0].valueLength = 0;		
+	items[0].flags = 0;
+	rights.count=1;
+	rights.items = items;
 
+	if (authorization == NULL) {
+		authorization = [SFAuthorization authorization];
+	}
     if (authorizationRef == NULL)
     {
         err = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment,
                                   kAuthorizationFlagDefaults, &authorizationRef);
-     }
-
+	}
+	
     if (err == errAuthorizationSuccess)
     {
         // There should be one item in the AuthorizationItems array for each
@@ -116,7 +126,7 @@
         // they should hold a pointer to a C string containing the path to
         // the tool you want to execute, and the length of the C string path.
         // There needs to be one item for each tool you want to execute.
-		items[0].name = "org.macports.pallet	";
+		items[0].name = "org.macports.pallet";
 		items[0].value = 0;
 		items[0].valueLength = 0;		
         items[0].flags = 0;
@@ -246,12 +256,12 @@
     if ([[self delegate] respondsToSelector:@selector(captureOutput:forExecutable:)])
     {
         [[self delegate] performSelector:@selector(captureOutput:forExecutable:) 
-						 withObject:str withObject:self];
+							  withObject:str withObject:self];
     }
     else
     {
         [output replaceCharactersInRange:NSMakeRange([output length], 0) 
-				withString:str];
+							  withString:str];
     }
 }
 
@@ -263,8 +273,8 @@
     if ([[self delegate] respondsToSelector:@selector(captureStdOut:forExecutable:)])
     {
         [[self delegate] performSelector:@selector(captureStdOut:forExecutable:) 
-							withObject:str 
-							withObject:self];
+							  withObject:str 
+							  withObject:self];
     }
     else
     {
@@ -280,8 +290,8 @@
     if ([[self delegate] respondsToSelector:@selector(captureStdErr:forExecutable:)])
     {
         [[self delegate] performSelector:@selector(captureStdErr:forExecutable:) 
-							withObject:str 
-							withObject:self];
+							  withObject:str 
+							  withObject:self];
     }
     else
     {
@@ -315,10 +325,10 @@
 	NSString *outputString;
 	
 	NS_DURING
-		outputString = [NSString stringWithCString:[data bytes] length:[data length]];
-		return outputString;	
+	outputString = [NSString stringWithCString:[data bytes] length:[data length]];
+	return outputString;	
 	NS_HANDLER
-		return @"WARNING:  Unable to decode output for display.\n";
+	return @"WARNING:  Unable to decode output for display.\n";
 	NS_ENDHANDLER
 	;
 }
@@ -334,7 +344,7 @@
     else
     {
         [self logStdOut:[NSString stringWithCString:[inData bytes] 
-			    length:[inData length]]];
+											 length:[inData length]]];
         [stdoutHandle readInBackgroundAndNotify];
     }
 }
@@ -371,20 +381,20 @@
         NSPipe *stdinPipe = nil;
         NSPipe *stdoutPipe = nil;
         //NSPipe *stderrPipe = nil;
-
+		
         [output setString:@""];
-
+		
         if (! [self isExecutable])
         {
             [self log:
-                NSLocalizedString(@"I can't find the tool I use to run an authorized command. You'll need to reinstall this application\n",@"This warning is issued if the user tries to start this task and the Launcher can't be found or isn't executable")];
+			 NSLocalizedString(@"I can't find the tool I use to run an authorized command. You'll need to reinstall this application\n",@"This warning is issued if the user tries to start this task and the Launcher can't be found or isn't executable")];
 			return;
         }
-
+		
 		if ([self mustBeAuthorized] && ! [self isAuthorized])
 		{
 			[self log:
-				NSLocalizedString(@"You must authorize yourself before you can run this command.\n",@"This warning is issued if the user tries to start this task when the mustBeAuthorized flag is set and the user isn't authorized")];
+			 NSLocalizedString(@"You must authorize yourself before you can run this command.\n",@"This warning is issued if the user tries to start this task when the mustBeAuthorized flag is set and the user isn't authorized")];
 			return;
 		}
         err = AuthorizationMakeExternalForm(authorizationRef, &extAuth);
@@ -393,57 +403,55 @@
             [self log:[NSString stringWithFormat:@"TODO: Unknown error in AuthorizationMakeExternalForm: (%d)\n", err]];
             return;
         }
-
+		
         NS_DURING
-            stdoutPipe = [NSPipe pipe];
-            stdinPipe = [NSPipe pipe];
-            //stderrPipe = [NSPipe pipe];
-
-            stdinHandle = [stdinPipe fileHandleForWriting];
-            [stdinHandle retain];
-            stdoutHandle = [stdoutPipe fileHandleForReading];
-            [stdoutHandle retain];
-            //stderrHandle = [stderrPipe fileHandleForReading];
-            //[stderrHandle retain];
-
-            [[NSNotificationCenter defaultCenter] 
-						addObserver:self 
-						selector:@selector(captureStdOut:)
-						name:NSFileHandleReadCompletionNotification
-						object:stdoutHandle];
+		stdoutPipe = [NSPipe pipe];
+		stdinPipe = [NSPipe pipe];
+		//stderrPipe = [NSPipe pipe];
+		
+		stdinHandle = [stdinPipe fileHandleForWriting];
+		[stdinHandle retain];
+		stdoutHandle = [stdoutPipe fileHandleForReading];
+		[stdoutHandle retain];
+		//stderrHandle = [stderrPipe fileHandleForReading];
+		//[stderrHandle retain];
+		
+		[[NSNotificationCenter defaultCenter] addObserver:self 
+												 selector:@selector(captureStdOut:)
+													 name:NSFileHandleReadCompletionNotification
+												   object:stdoutHandle];
 #ifdef UNDEF
-            [[NSNotificationCenter defaultCenter] 
-						addObserver:self selector:@selector(captureStdErr:)
-						name:NSFileHandleReadCompletionNotification
-						object:stderrHandle];
+		[[NSNotificationCenter defaultCenter] addObserver:self
+												 selector:@selector(captureStdErr:)
+													 name:NSFileHandleReadCompletionNotification
+												   object:stderrHandle];
 #endif
-            [stdoutHandle readInBackgroundAndNotify];
-            //[stderrHandle readInBackgroundAndNotify];
-
-            task = [[NSTask alloc] init];
-            [task retain];
-            [task setStandardOutput:stdoutPipe];
-            [task setStandardInput:stdinPipe];
-			//my change:
-			[task setStandardError:stdoutPipe];
-            //[task setStandardError:stderrPipe];
-
-            [task setLaunchPath:[self authExecutable]];
-			NSLog(@"Launching %@", [self authExecutable]);
-            [task setArguments:[self arguments]];
-			NSLog(@"Setting arguments");
-			[task setEnvironment:[self environment]];
-			NSLog(@"Setting environment");
-            [task launch];
-			NSLog(@"Launched Launcher");
-            [self writeData:[NSData dataWithBytes:&extAuth 
-				  length:sizeof(AuthorizationExternalForm)]];
-
+		[stdoutHandle readInBackgroundAndNotify];
+		//[stderrHandle readInBackgroundAndNotify];
+		
+		task = [[NSTask alloc] init];
+		[task retain];
+		[task setStandardOutput:stdoutPipe];
+		[task setStandardInput:stdinPipe];
+		//my change:
+		[task setStandardError:stdoutPipe];
+		//[task setStandardError:stderrPipe];
+		
+		[task setLaunchPath:[self authExecutable]];
+		NSLog(@"Launching %@", [self authExecutable]);
+		[task setArguments:[self arguments]];
+		NSLog(@"Setting arguments");
+		[task setEnvironment:[self environment]];
+		NSLog(@"Setting environment");
+		[task launch];
+		NSLog(@"Launched Launcher");
+		[self writeData:[NSData dataWithBytes:&extAuth 
+									   length:sizeof(AuthorizationExternalForm)]];
+		NSLog(@"Sent Auth Tags");
         NS_HANDLER
-            [self log:[NSString stringWithFormat:@"Failed while trying to launch helper program"]];
-            [self stop];
+		[self log:[NSString stringWithFormat:@"Failed while trying to launch helper program"]];
+		[self stop];
         NS_ENDHANDLER
-        ;
     }
 }
 
@@ -453,20 +461,20 @@
 - (void)stop
 {
 	int status;
-
+	
     if (stdoutHandle)
     {
         [[NSNotificationCenter defaultCenter] 
-			removeObserver:self
-			name:NSFileHandleReadCompletionNotification
-			object:stdoutHandle];
+		 removeObserver:self
+		 name:NSFileHandleReadCompletionNotification
+		 object:stdoutHandle];
     }
     if (stderrHandle)
     {
         [[NSNotificationCenter defaultCenter] 
-			removeObserver:self
-			name:NSFileHandleReadCompletionNotification
-			object:stderrHandle];
+		 removeObserver:self
+		 name:NSFileHandleReadCompletionNotification
+		 object:stderrHandle];
     }
     if ([task isRunning])
     {
@@ -487,12 +495,12 @@
     stdinHandle = nil;
     //stderrHandle = nil;
 	if ([[self delegate]
-				respondsToSelector:@selector(executableFinished:withStatus:)])
+		 respondsToSelector:@selector(executableFinished:withStatus:)])
 	{
 		[[self delegate]
-				performSelector:@selector(executableFinished:withStatus:)
-					 withObject:self
-					 withObject:[NSNumber numberWithInt:status]];
+		 performSelector:@selector(executableFinished:withStatus:)
+		 withObject:self
+		 withObject:[NSNumber numberWithInt:status]];
 	}	
 }
 

Modified: users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj
===================================================================
--- users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj	2008-06-08 08:38:25 UTC (rev 37447)
+++ users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj	2008-06-08 09:01:56 UTC (rev 37448)
@@ -8,14 +8,18 @@
 
 /* Begin PBXBuildFile section */
 		480062BF0B597D9A005F27E4 /* PAStatusTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 480062BE0B597D9A005F27E4 /* PAStatusTransformer.m */; };
+		4808C5790DFBD4FF0003D3B7 /* SecurityFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4808C5780DFBD4FF0003D3B7 /* SecurityFoundation.framework */; };
+		4808C57A0DFBD4FF0003D3B7 /* SecurityFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4808C5780DFBD4FF0003D3B7 /* SecurityFoundation.framework */; };
 		481B84120BA254A4000D1385 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4854CE0F0B420D8C00950EE4 /* Security.framework */; };
 		4820065B0CF916F6009EAF35 /* Installed.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 482006590CF916F6009EAF35 /* Installed.tiff */; };
 		4820065C0CF916F7009EAF35 /* Outdated.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4820065A0CF916F6009EAF35 /* Outdated.tiff */; };
 		4828C6310AD7B84D002AF0DD /* TaskWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4828C6300AD7B84D002AF0DD /* TaskWrapper.m */; };
 		483A5E460B57A50900712840 /* MPPortsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 483A5E450B57A50900712840 /* MPPortsController.m */; };
+		48416EFD0D8D31B000E104BD /* PalletHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 48416EFB0D8D31B000E104BD /* PalletHelper.m */; };
+		48416F6C0D8D37BE00E104BD /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4854CE0F0B420D8C00950EE4 /* Security.framework */; };
+		48416F6D0D8D37BE00E104BD /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
 		4844B92B0AD91F5800A4A4DB /* UserDefaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4844B92A0AD91F5800A4A4DB /* UserDefaults.plist */; };
 		4875A7410B468DEB00FDDC21 /* ApplicationIconBusy.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4875A7400B468DEB00FDDC21 /* ApplicationIconBusy.icns */; };
-		4875A77A0B46955800FDDC21 /* Launcher in Resources */ = {isa = PBXBuildFile; fileRef = 48ACD78B0B42846B00D34B4C /* Launcher */; };
 		4875A9520B4839AA00FDDC21 /* outdated.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4875A9510B4839AA00FDDC21 /* outdated.gif */; };
 		4875A9540B4839C000FDDC21 /* active.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4875A9530B4839C000FDDC21 /* active.gif */; };
 		4875A9560B4839D700FDDC21 /* installed.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4875A9550B4839D700FDDC21 /* installed.gif */; };
@@ -23,15 +27,10 @@
 		487EB9270B4533BC001B0F72 /* Launcher.c in Sources */ = {isa = PBXBuildFile; fileRef = 48BBCE7D0B41B2450063A19F /* Launcher.c */; };
 		487EB9280B4533CB001B0F72 /* getpath.c in Sources */ = {isa = PBXBuildFile; fileRef = 48BBCE870B41B37F0063A19F /* getpath.c */; };
 		487EB9490B453786001B0F72 /* AuthorizedExecutable.m in Sources */ = {isa = PBXBuildFile; fileRef = 487EB9480B453786001B0F72 /* AuthorizedExecutable.m */; };
-		48A284020C608C9800D1AC4B /* MPInterp.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD13180BBE6C24002B0D0E /* MPInterp.m */; };
-		48A284030C608C9800D1AC4B /* MPObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD131A0BBE6C24002B0D0E /* MPObject.m */; };
 		48AA3F9D0C93F85800C6AC60 /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48AA3F950C93F85800C6AC60 /* MacPorts.framework */; };
 		48AA3F9E0C93F85800C6AC60 /* MacPorts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48AA3F950C93F85800C6AC60 /* MacPorts.framework */; };
 		48AB404E0CEDB033000BA2E3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 48AB404D0CEDB033000BA2E3 /* Localizable.strings */; };
 		48ACD7930B4284A400D34B4C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4854CE0F0B420D8C00950EE4 /* Security.framework */; };
-		48B63D820BCA40760028248A /* CFLib.c in Sources */ = {isa = PBXBuildFile; fileRef = 48B63D810BCA40760028248A /* CFLib.c */; };
-		48C570FC0C46287D002EC172 /* MPAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD13150BBE6C24002B0D0E /* MPAgent.m */; };
-		48C570FD0C46287D002EC172 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD130A0BBE6B02002B0D0E /* main.m */; };
 		48D470190AD6867C00352CE9 /* PortAuthority.m in Sources */ = {isa = PBXBuildFile; fileRef = 48D470180AD6867C00352CE9 /* PortAuthority.m */; };
 		48D470790AD6CFFB00352CE9 /* MPToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 48D470780AD6CFFB00352CE9 /* MPToolbar.m */; };
 		48D470C90AD7256700352CE9 /* Remove.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 48D470C70AD7256600352CE9 /* Remove.tiff */; };
@@ -42,10 +41,9 @@
 		48D471FB0AD7A99500352CE9 /* Install.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 48D471FA0AD7A99500352CE9 /* Install.tiff */; };
 		48D4721F0AD7B10600352CE9 /* ApplicationIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 48D4721E0AD7B10600352CE9 /* ApplicationIcon.icns */; };
 		48D5EF700BDE169B003EE169 /* Tcl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48EE4F7C0B515B7D0066DCBA /* Tcl.framework */; };
+		48D62BF20D96680800E4D086 /* PalletHelper in Resources */ = {isa = PBXBuildFile; fileRef = 482C61C90BD225F400F7AC59 /* PalletHelper */; };
 		48EE4F7D0B515B7D0066DCBA /* Tcl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48EE4F7C0B515B7D0066DCBA /* Tcl.framework */; };
 		48F00D280BD773D500F2E7D8 /* IFVerticallyExpandingTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 48F00D270BD773D500F2E7D8 /* IFVerticallyExpandingTextField.m */; };
-		48F8D5810C0994AE0058A4EF /* MPInterp.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD13180BBE6C24002B0D0E /* MPInterp.m */; };
-		48F8D5820C0994AE0058A4EF /* MPObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD131A0BBE6C24002B0D0E /* MPObject.m */; };
 		8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
 		8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
 		8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
@@ -53,12 +51,12 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
-		4875A8BD0B46FE9000FDDC21 /* PBXContainerItemProxy */ = {
+		48D62BC10D9665D700E4D086 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
 			proxyType = 1;
-			remoteGlobalIDString = 48ACD78A0B42846B00D34B4C;
-			remoteInfo = Launcher;
+			remoteGlobalIDString = 482C61C80BD225F400F7AC59;
+			remoteInfo = PalletHelper;
 		};
 /* End PBXContainerItemProxy section */
 
@@ -73,14 +71,16 @@
 		32CA4F630368D1EE00C91783 /* Port Authority_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Port Authority_Prefix.pch"; sourceTree = "<group>"; };
 		480062BD0B597D9A005F27E4 /* PAStatusTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PAStatusTransformer.h; sourceTree = "<group>"; };
 		480062BE0B597D9A005F27E4 /* PAStatusTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PAStatusTransformer.m; sourceTree = "<group>"; };
-		482006590CF916F6009EAF35 /* Installed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Installed.tiff; path = /Users/rhwood/Developer/Pallet/Pallet/Installed.tiff; sourceTree = "<absolute>"; };
-		4820065A0CF916F6009EAF35 /* Outdated.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Outdated.tiff; path = /Users/rhwood/Developer/Pallet/Pallet/Outdated.tiff; sourceTree = "<absolute>"; };
+		4808C5780DFBD4FF0003D3B7 /* SecurityFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SecurityFoundation.framework; path = /System/Library/Frameworks/SecurityFoundation.framework; sourceTree = "<absolute>"; };
+		482006590CF916F6009EAF35 /* Installed.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Installed.tiff; sourceTree = "<group>"; };
+		4820065A0CF916F6009EAF35 /* Outdated.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Outdated.tiff; sourceTree = "<group>"; };
 		4828C62F0AD7B84D002AF0DD /* TaskWrapper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TaskWrapper.h; sourceTree = "<group>"; };
 		4828C6300AD7B84D002AF0DD /* TaskWrapper.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TaskWrapper.m; sourceTree = "<group>"; };
 		482C61C90BD225F400F7AC59 /* PalletHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PalletHelper; sourceTree = BUILT_PRODUCTS_DIR; };
-		482C61D40BD2286700F7AC59 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Helper/main.m; sourceTree = "<group>"; };
 		483A5E440B57A50900712840 /* MPPortsController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPPortsController.h; sourceTree = "<group>"; };
 		483A5E450B57A50900712840 /* MPPortsController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPPortsController.m; sourceTree = "<group>"; };
+		48416EFA0D8D31B000E104BD /* PalletHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PalletHelper.h; path = /Users/Shared/Developer/MacPorts/Repository/users/rhwood/Pallet/PalletHelper.h; sourceTree = "<absolute>"; };
+		48416EFB0D8D31B000E104BD /* PalletHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PalletHelper.m; path = /Users/Shared/Developer/MacPorts/Repository/users/rhwood/Pallet/PalletHelper.m; sourceTree = "<absolute>"; };
 		4844B92A0AD91F5800A4A4DB /* UserDefaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = UserDefaults.plist; sourceTree = "<group>"; };
 		4854CE0F0B420D8C00950EE4 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
 		4854CE6A0B42107000950EE4 /* Launcher_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Launcher_Prefix.pch; sourceTree = "<group>"; };
@@ -96,19 +96,8 @@
 		48ACD7D10B42855600D34B4C /* Launcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Launcher.h; sourceTree = "<group>"; };
 		48ACD7D20B42855600D34B4C /* Launcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Launcher.m; sourceTree = "<group>"; };
 		48AFB8B70BA4E20300896AF1 /* Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Debug.h; sourceTree = "<group>"; };
-		48B63D810BCA40760028248A /* CFLib.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = CFLib.c; sourceTree = "<group>"; };
 		48BBCE7D0B41B2450063A19F /* Launcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Launcher.c; sourceTree = "<group>"; };
 		48BBCE870B41B37F0063A19F /* getpath.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = getpath.c; sourceTree = "<group>"; };
-		48C571A30C465ADE002EC172 /* PalletHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PalletHelper.h; path = Helper/PalletHelper.h; sourceTree = "<group>"; };
-		48C571A40C465ADE002EC172 /* PalletHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PalletHelper.m; path = Helper/PalletHelper.m; sourceTree = "<group>"; };
-		48CD130A0BBE6B02002B0D0E /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
-		48CD13140BBE6C24002B0D0E /* MPAgent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPAgent.h; sourceTree = "<group>"; };
-		48CD13150BBE6C24002B0D0E /* MPAgent.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPAgent.m; sourceTree = "<group>"; };
-		48CD13160BBE6C24002B0D0E /* MPAgentProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPAgentProtocol.h; sourceTree = "<group>"; };
-		48CD13170BBE6C24002B0D0E /* MPInterp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPInterp.h; sourceTree = "<group>"; };
-		48CD13180BBE6C24002B0D0E /* MPInterp.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPInterp.m; sourceTree = "<group>"; };
-		48CD13190BBE6C24002B0D0E /* MPObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPObject.h; sourceTree = "<group>"; };
-		48CD131A0BBE6C24002B0D0E /* MPObject.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPObject.m; sourceTree = "<group>"; };
 		48D470170AD6867B00352CE9 /* PortAuthority.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PortAuthority.h; sourceTree = "<group>"; };
 		48D470180AD6867C00352CE9 /* PortAuthority.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PortAuthority.m; sourceTree = "<group>"; };
 		48D470770AD6CFFB00352CE9 /* MPToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbar.h; sourceTree = "<group>"; };
@@ -123,7 +112,6 @@
 		48EE4F7C0B515B7D0066DCBA /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = /System/Library/Frameworks/Tcl.framework; sourceTree = "<absolute>"; };
 		48F00D180BD7738000F2E7D8 /* IFVerticallyExpandingTextField.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IFVerticallyExpandingTextField.h; sourceTree = "<group>"; };
 		48F00D270BD773D500F2E7D8 /* IFVerticallyExpandingTextField.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = IFVerticallyExpandingTextField.m; sourceTree = "<group>"; };
-		48F8D5700C098C870058A4EF /* PalletHelperProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PalletHelperProtocol.h; path = Helper/PalletHelperProtocol.h; sourceTree = "<group>"; };
 		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
 		8D1107320486CEB800E47090 /* Pallet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pallet.app; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
@@ -133,8 +121,11 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				48416F6D0D8D37BE00E104BD /* Cocoa.framework in Frameworks */,
+				48416F6C0D8D37BE00E104BD /* Security.framework in Frameworks */,
 				48D5EF700BDE169B003EE169 /* Tcl.framework in Frameworks */,
 				48AA3F9E0C93F85800C6AC60 /* MacPorts.framework in Frameworks */,
+				4808C57A0DFBD4FF0003D3B7 /* SecurityFoundation.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -155,6 +146,7 @@
 				481B84120BA254A4000D1385 /* Security.framework in Frameworks */,
 				48EE4F7D0B515B7D0066DCBA /* Tcl.framework in Frameworks */,
 				48AA3F9D0C93F85800C6AC60 /* MacPorts.framework in Frameworks */,
+				4808C5790DFBD4FF0003D3B7 /* SecurityFoundation.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -186,6 +178,7 @@
 				48AA3F950C93F85800C6AC60 /* MacPorts.framework */,
 				48EE4F7C0B515B7D0066DCBA /* Tcl.framework */,
 				4854CE0F0B420D8C00950EE4 /* Security.framework */,
+				4808C5780DFBD4FF0003D3B7 /* SecurityFoundation.framework */,
 				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
 			);
 			name = "Linked Frameworks";
@@ -214,7 +207,6 @@
 		29B97314FDCFA39411CA2CEA /* Port Authority */ = {
 			isa = PBXGroup;
 			children = (
-				48CD13020BBE6B02002B0D0E /* MPTool */,
 				080E96DDFE201D6D7F000001 /* Classes */,
 				29B97315FDCFA39411CA2CEA /* Other Sources */,
 				29B97317FDCFA39411CA2CEA /* Resources */,
@@ -227,13 +219,8 @@
 		29B97315FDCFA39411CA2CEA /* Other Sources */ = {
 			isa = PBXGroup;
 			children = (
-				48F8D5700C098C870058A4EF /* PalletHelperProtocol.h */,
-				48C571A30C465ADE002EC172 /* PalletHelper.h */,
-				48C571A40C465ADE002EC172 /* PalletHelper.m */,
-				482C61D40BD2286700F7AC59 /* main.m */,
 				48F00D270BD773D500F2E7D8 /* IFVerticallyExpandingTextField.m */,
 				48F00D180BD7738000F2E7D8 /* IFVerticallyExpandingTextField.h */,
-				48B63D810BCA40760028248A /* CFLib.c */,
 				48ACD7D10B42855600D34B4C /* Launcher.h */,
 				48AFB8B70BA4E20300896AF1 /* Debug.h */,
 				48ACD7D20B42855600D34B4C /* Launcher.m */,
@@ -242,6 +229,8 @@
 				4854CE6A0B42107000950EE4 /* Launcher_Prefix.pch */,
 				32CA4F630368D1EE00C91783 /* Port Authority_Prefix.pch */,
 				29B97316FDCFA39411CA2CEA /* main.m */,
+				48416EFA0D8D31B000E104BD /* PalletHelper.h */,
+				48416EFB0D8D31B000E104BD /* PalletHelper.m */,
 			);
 			name = "Other Sources";
 			sourceTree = "<group>";
@@ -280,21 +269,6 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
-		48CD13020BBE6B02002B0D0E /* MPTool */ = {
-			isa = PBXGroup;
-			children = (
-				48CD13140BBE6C24002B0D0E /* MPAgent.h */,
-				48CD13150BBE6C24002B0D0E /* MPAgent.m */,
-				48CD13160BBE6C24002B0D0E /* MPAgentProtocol.h */,
-				48CD13170BBE6C24002B0D0E /* MPInterp.h */,
-				48CD13180BBE6C24002B0D0E /* MPInterp.m */,
-				48CD13190BBE6C24002B0D0E /* MPObject.h */,
-				48CD131A0BBE6C24002B0D0E /* MPObject.m */,
-				48CD130A0BBE6B02002B0D0E /* main.m */,
-			);
-			path = MPTool;
-			sourceTree = "<group>";
-		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -341,7 +315,7 @@
 			buildRules = (
 			);
 			dependencies = (
-				4875A8BE0B46FE9000FDDC21 /* PBXTargetDependency */,
+				48D62BC20D9665D700E4D086 /* PBXTargetDependency */,
 			);
 			name = Pallet;
 			productInstallPath = "$(HOME)/Applications";
@@ -373,7 +347,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				4875A77A0B46955800FDDC21 /* Launcher in Resources */,
+				48D62BF20D96680800E4D086 /* PalletHelper in Resources */,
 				8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
 				8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
 				48D470C90AD7256700352CE9 /* Remove.tiff in Resources */,
@@ -401,10 +375,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				48F8D5820C0994AE0058A4EF /* MPObject.m in Sources */,
-				48C570FC0C46287D002EC172 /* MPAgent.m in Sources */,
-				48F8D5810C0994AE0058A4EF /* MPInterp.m in Sources */,
-				48C570FD0C46287D002EC172 /* main.m in Sources */,
+				48416EFD0D8D31B000E104BD /* PalletHelper.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -422,15 +393,12 @@
 			buildActionMask = 2147483647;
 			files = (
 				8D11072D0486CEB800E47090 /* main.m in Sources */,
-				48A284020C608C9800D1AC4B /* MPInterp.m in Sources */,
-				48A284030C608C9800D1AC4B /* MPObject.m in Sources */,
 				48D470190AD6867C00352CE9 /* PortAuthority.m in Sources */,
 				48D470790AD6CFFB00352CE9 /* MPToolbar.m in Sources */,
 				4828C6310AD7B84D002AF0DD /* TaskWrapper.m in Sources */,
 				487EB9490B453786001B0F72 /* AuthorizedExecutable.m in Sources */,
 				483A5E460B57A50900712840 /* MPPortsController.m in Sources */,
 				480062BF0B597D9A005F27E4 /* PAStatusTransformer.m in Sources */,
-				48B63D820BCA40760028248A /* CFLib.c in Sources */,
 				48F00D280BD773D500F2E7D8 /* IFVerticallyExpandingTextField.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -438,10 +406,10 @@
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXTargetDependency section */
-		4875A8BE0B46FE9000FDDC21 /* PBXTargetDependency */ = {
+		48D62BC20D9665D700E4D086 /* PBXTargetDependency */ = {
 			isa = PBXTargetDependency;
-			target = 48ACD78A0B42846B00D34B4C /* Launcher */;
-			targetProxy = 4875A8BD0B46FE9000FDDC21 /* PBXContainerItemProxy */;
+			target = 482C61C80BD225F400F7AC59 /* PalletHelper */;
+			targetProxy = 48D62BC10D9665D700E4D086 /* PBXContainerItemProxy */;
 		};
 /* End PBXTargetDependency section */
 
@@ -634,14 +602,15 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_MODEL_TUNING = "";
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					"DEBUGGING=1",
 					"$(inherited)",
 				);
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
 				PREBINDING = NO;
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Debug;
@@ -654,7 +623,6 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = NO;
 				GCC_WARN_UNUSED_VARIABLE = NO;
 				PREBINDING = YES;
-				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
 				VERSIONING_SYSTEM = "apple-generic";
 			};
 			name = Release;

Added: users/rhwood/Pallet/PalletHelper.h
===================================================================
--- users/rhwood/Pallet/PalletHelper.h	                        (rev 0)
+++ users/rhwood/Pallet/PalletHelper.h	2008-06-08 09:01:56 UTC (rev 37448)
@@ -0,0 +1,45 @@
+//
+//  PalletHelper.h
+//  Pallet
+//
+//  Created by Randall Hansen Wood on 16/3/2008.
+//  Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#include <Cocoa/Cocoa.h>
+#include <Security/Authorization.h>
+#include <MacPorts/MacPorts.h>
+#include <sys/param.h>
+#include <mach-o/dyld.h>
+#include <sys/stat.h>
+
+#define BUFSIZE 4096
+
+enum {
+    cmdAuthorized,
+    cmdNotAuthorized,
+    cmdStatusUndetermined,
+    cmdNotOwnedByRoot
+};
+
+/* wrap things in a class, not because it makes sense, but because thats how I think */
+ at interface MPPalletHelper: NSObject
+{
+	NSString *_pathToSelf;
+	AuthorizationExternalForm *_externalAuthorization;
+	AuthorizationRef *_authorization;
+}
+
+-(Boolean)exec:(NSString *)portName withTarget:(NSString *)target;
+
+-(Boolean)getAuthorization;
+
+-(NSString *)pathToSelf;
+-(Boolean)isAuthorized;
+-(Boolean)repairSelf;
+-(Boolean)relaunchToRepairSelf;
+
+-(NSArray *)arguments;
+-(Boolean)hasArgument:(NSString *)argument;
+
+ at end

Added: users/rhwood/Pallet/PalletHelper.m
===================================================================
--- users/rhwood/Pallet/PalletHelper.m	                        (rev 0)
+++ users/rhwood/Pallet/PalletHelper.m	2008-06-08 09:01:56 UTC (rev 37448)
@@ -0,0 +1,194 @@
+//
+//  PalletHelper.m
+//  Pallet
+//
+//  Created by Randall Hansen Wood on 16/3/2008.
+//  Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "PalletHelper.h"
+
+ at implementation MPPalletHelper
+
+- (id)init {
+	self = [super init];
+	if (self) {
+	}
+	return self;
+}
+
+- (Boolean)exec:(NSString *)portName withTarget:(NSString *)target {
+	NSDictionary *ports;
+	NSEnumerator *portsEnumerator;
+	id port;
+	
+	ports = [[MPMacPorts sharedInstance] search:portName];
+	portsEnumerator = [ports objectEnumerator];
+	while (port = [portsEnumerator nextObject]) {
+		[port exec:target];
+	}
+	return TRUE;
+}
+
+- (NSString *)pathToSelf {
+	if (_pathToSelf == NULL) {
+		size_t path_size = MAXPATHLEN;
+		char* path = malloc(path_size);
+		
+		if (path && _NSGetExecutablePath(path, &path_size) == -1)
+		{
+			/* Try again with actual size */
+			path = realloc(path, path_size + 1);
+			if (path && _NSGetExecutablePath(path, &path_size) != 0)
+			{
+				free(path);
+				path = NULL;
+			}
+		}
+		_pathToSelf = [NSString stringWithUTF8String:path];
+	}
+	return _pathToSelf;
+}
+
+- (Boolean)repairSelf {
+	AuthorizationRef authorization;
+	NSString *pathToBundleResources;
+	NSFileManager *fileManager;
+	Boolean resultSelf = FALSE;
+	Boolean resultBundleResources = FALSE;
+	
+	if ([self pathToSelf] != NULL) {
+		pathToBundleResources = [[self pathToSelf] stringByDeletingLastPathComponent];
+		fileManager = [NSFileManager defaultManager];
+		if (AuthorizationCopyPrivilegedReference(&authorization, kAuthorizationFlagDefaults) 
+			== errAuthorizationSuccess) {
+			// 493 is the decimal representation of the octal value 755
+			resultSelf = [fileManager changeFileAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+															@"root",
+															NSFileOwnerAccountName,
+															@"493",
+															NSFilePosixPermissions]
+													atPath:[self pathToSelf]];
+#ifndef DEBUGGING //Do not set ownership of the resources directory since this will break XCode
+			resultBundleResources = [fileManager changeFileAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
+																	   @"root",
+																	   NSFileOwnerAccountName,
+																	   @"493",
+																	   NSFilePosixPermissions]
+															   atPath:pathToBundleResources];
+#endif //DEBUGGING
+		} else {
+			NSLog(@"ERROR: Unable to authenticate as administrator.");
+		}
+	} else {
+		NSLog(@"ERROR: Unable to determine path to setuid tool.");
+	}
+	if (resultSelf && resultBundleResources) {
+		NSLog(@"Self repair succeeded.");
+	} else if (resultSelf) {
+		NSLog(@"WARNING: Unable to secure Resources folder.");
+	} else {
+		NSLog(@"ERROR: Self repair failed. Please ensure that you are running Pallet from a volume that you can modify.");
+	}
+	return resultSelf;
+}
+
+- (Boolean)relaunchToRepairSelf {
+	if ([self pathToSelf] != NULL) {
+		int status;
+		int result = EXIT_FAILURE;
+		FILE *commPipe = NULL;
+		char *arguments[] = { "--self-repair", NULL };
+		NSLog(@"Running self-repair...");
+		if (AuthorizationExecuteWithPrivileges(*_authorization,
+											   [[self pathToSelf] UTF8String],
+											   kAuthorizationFlagDefaults,
+											   arguments,
+											   &commPipe)) {
+			/* Read from stdin and write to commPipe. */
+			fwrite(&_externalAuthorization, 1, sizeof(_externalAuthorization),commPipe);
+			/* Flush any remaining output. */
+			fflush(commPipe);
+			
+			/* Close the communication pipe to let the child know we are done. */
+			fclose(commPipe);
+			
+			/* Wait for the child of AuthorizationExecuteWithPrivileges to exit. */
+			if (wait(&status) != -1 && WIFEXITED(status))
+			{
+				result = WEXITSTATUS(status);
+			}
+		}
+		return result;
+	}
+	return FALSE;
+}
+
+- (Boolean)getAuthorization {
+	NSLog(@"%@", @"ga: starting");
+
+	if ((read(0, &_externalAuthorization, sizeof(_externalAuthorization)) == sizeof(_externalAuthorization)) &&
+		(AuthorizationCreateFromExternalForm(_externalAuthorization, _authorization) == errAuthorizationSuccess)) {
+		NSLog(@"%@", @"ga: got it");
+
+		return TRUE;
+	}
+	NSLog(@"%@", @"ga: no go");
+	return FALSE;
+}
+
+- (Boolean)isAuthorized {
+    AuthorizationItem right = { "org.macports.pallet.helper", 0, NULL, 0 };
+    AuthorizationRights rights = { 1, &right };
+    AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagExtendRights;
+    bool result = getuid() == geteuid();
+	
+    if(!result) {
+        result = AuthorizationCopyRights(*_authorization,
+										 &rights,
+                                         kAuthorizationEmptyEnvironment,
+                                         flags,
+										 NULL) == errAuthorizationSuccess;
+    }
+    return result;
+}
+
+- (NSArray *)arguments {
+	return [[NSProcessInfo processInfo] arguments];
+}
+
+- (Boolean)hasArgument:(NSString *)argument {
+	return [[self arguments] containsObject:argument];
+}
+
+ at end
+
+
+int main(int argc, char * const *argv) {
+
+	MPPalletHelper *helper;
+	
+	helper = [[MPPalletHelper alloc] init];
+	int result = 1;
+	
+	if ([helper getAuthorization]) {
+		NSLog(@"%@", @"authorized");
+		if ([[helper arguments] count] == 2 && [helper hasArgument:@"--self-repair"]) {
+			NSLog(@"%@", @"repairing");
+			result = [helper repairSelf];
+		} else if (geteuid() != 0) {
+			NSLog(@"%@", @"relaunching to repair");
+			result = [helper relaunchToRepairSelf];
+		} else {
+			if (![helper isAuthorized]) {
+				seteuid(geteuid());
+			}
+			NSLog(@"%@", @"helping");
+			result = [helper exec:[[helper arguments] objectAtIndex:1] withTarget:[[helper arguments] objectAtIndex:2]];
+		}
+		NSLog(@"%@", @"done");
+		exit(result);
+	}
+	NSLog(@"%@", @"Failed to read authorization from stdin\n");
+	exit(result);
+}

Modified: users/rhwood/Pallet/PortAuthority.m
===================================================================
--- users/rhwood/Pallet/PortAuthority.m	2008-06-08 08:38:25 UTC (rev 37447)
+++ users/rhwood/Pallet/PortAuthority.m	2008-06-08 09:01:56 UTC (rev 37448)
@@ -70,7 +70,7 @@
 	//[status setStringValue:@""];
 	// Setup the port task
 	portIsRunning = NO;
-	launcher = [[NSBundle mainBundle] pathForResource:@"Launcher" ofType:nil];
+	launcher = [[NSBundle mainBundle] pathForResource:@"PalletHelper" ofType:nil];
 	agentTask = [[AuthorizedExecutable alloc] initWithExecutable:launcher];
 	authPortTask = [[AuthorizedExecutable alloc] initWithExecutable:launcher];
 	killTask = [[AuthorizedExecutable alloc] initWithExecutable:launcher];
@@ -185,11 +185,17 @@
 															 @"Status for [MPAuthority installPort] method"),
 		port]];
 	NSLog([status stringValue]);
+	[self launchAuthorizedExecutableWithArguments:[NSArray arrayWithObjects:
+												   port,
+												   @"install",
+												   nil]];
+	/*
 	[self launchAuthorizedExecutableWithArguments:[NSArray arrayWithObjects:macPortsPort,
 		@"-dv",
 		@"install",
 		port,
 		nil]];
+	 */
 }
 
 - (IBAction)reinstallPort:(id)sender
@@ -275,7 +281,7 @@
 	[status setStringValue:NSLocalizedStringWithDefaultValue(@"statusSetIndex",
 															 @"Localizable",
 															 [NSBundle mainBundle],
-															 @"Reading list of ports...(one less NSString)",
+															 @"Reading list of ports...",
 															 @"Status while setting Index")
 		];
 	[progressIndicator startAnimation:nil];

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080608/a62328f5/attachment-0001.htm 


More information about the macports-changes mailing list