Chameleon Applications

Chameleon Applications Commit Details

Date:2010-01-21 05:07:15 (14 years 3 months ago)
Author:Rekursor
Commit:20
Parents: 19
Message:Finished Freeze feature implementation! . Now will start regression tests. Binaries updated (1.0b9).
Changes:
M/trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj
M/trunk/ChameleonPrefPane/bin/OSX105/Chameleon.prefPane.zip
M/trunk/ChameleonPrefPane/bin/OSX106/Chameleon.prefPane.zip
M/trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.h
M/trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
M/trunk/ChameleonPrefPane/Sources/process.h
M/trunk/ChameleonPrefPane/English.lproj/Chameleon.xib
M/trunk/ChameleonPrefPane/README
M/trunk/ChameleonPrefPane/bin/version

File differences

trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.h
3535
3636
3737
38
38
3939
4040
4141
NSImage*mUnknownImage;
NSImage*mCDROMImage;
NSMutableDictionary*mOptionsDict;
NSMutableDictionary*mPartitionsList;
NSMutableDictionary*mPartitionsDict;
NSString*mOptionsPlistPath;
intmPreferenceFileVersion;
}
trunk/ChameleonPrefPane/Sources/ChameleonPrefPane.mm
3737
3838
3939
40
41
4042
4143
4244
......
107109
108110
109111
110
111112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
112156
113157
114158
115159
116160
161
162
163
164
117165
118166
119167
120168
121169
122170
123
171
124172
125173
126174
......
134182
135183
136184
137
185
138186
139187
140188
......
142190
143191
144192
145
146
193
147194
148
149195
150196
151197
......
292338
293339
294340
295
341
342
343
344
345
346
296347
297348
298349
......
301352
302353
303354
304
355
305356
306357
307358
......
336387
337388
338389
339
390
391
340392
341393
342394
343395
344396
345
397
398
399
400
401
402
403
404
346405
347406
348407
349408
350409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
351440
352441
353442
......
364453
365454
366455
456
367457
368458
369459
static const NSString* const keySwapHD02 = @"swapHD02";
static const NSString* const keyUseFrozenParts = @"useFrozenParts";
static const NSString* const keyPartitionsList = @"partitionsList";
static const char cPartDescSep = ';'; // partition descriptor separator
static const char* sPartDescSep = ";"; // cstring version
//--------------------------------------------------------------------------
// Static file variables
//--------------------------------------------------------------------------
PropertyList::chmodFile(sPath.c_str(), "0644", auth);
return true;
}
//--------------------------------------------------------------------------
- (void) loadFrozenParts
{
std::vector<PartitionInfo>& partList = partExtractor->editPartList(); //rw
// iterate for all entries to add
char keyPartN[32] = "";
char buffer[256]="";
int k=0;
partList.clear();
for (int i=0; i<[mPartitionsDict count]; i++)
{
// get the key
snprintf(keyPartN, sizeof(keyPartN)-1, "partition%02d",i);
NSString* obj = [mPartitionsDict objectForKey: [[NSString alloc] initWithUTF8String: keyPartN] ];
// assign this key if valid
if (obj!=nil && [obj length]>0)
{
PartitionInfo p;
// parse string
strncpy(buffer, [obj UTF8String], sizeof(buffer)-1);
k=0;
for(const char* word = strtok(buffer,";"); word; word=strtok(NULL,sPartDescSep),k++)
{
switch (k) {
case 0: // parse disk number
if (isdigit(*word)) p.disk(*word-'0');
break;
case 1: // parse partition number
if (isdigit(*word)) p.partition(*word-'0');
break;
case 2: // parse volume label
p.label(word);
case 3:
p.fsType(word);
break;
default:
break;
}
}
partList.push_back(p);
}
}
}
//--------------------------------------------------------------------------
- (void) loadPreferences
{
id oldGlobalPreferences = [ [NSDictionary dictionaryWithContentsOfFile:
kPreferencesFilePath ] retain];
mPartitionsDict = [[NSMutableDictionary alloc] init];
[mPartitionsDict retain];
if (oldGlobalPreferences!=nil)
{
mPreferenceFileVersion= [[oldGlobalPreferences objectForKey: keyPreferencesFileVersion] intValue ];
[mSwapHD01 setIntValue: [[oldGlobalPreferences objectForKey:keySwapHD01] intValue]];
[mSwapHD02 setIntValue: [[oldGlobalPreferences objectForKey:keySwapHD02] intValue]];
[mFreezeParts setIntValue: [[oldGlobalPreferences objectForKey: keyUseFrozenParts] intValue] ];
mPartitionsList = [oldGlobalPreferences objectForKey: keyUseFrozenParts];
[mPartitionsDict addEntriesFromDictionary: [oldGlobalPreferences objectForKey: keyPartitionsList] ];
}
else
{ // Create a preference plist file with Defaults values
[oldGlobalPreferences setObject: [[NSNumber alloc] initWithBool: false] forKey: keySwapHD01];
[oldGlobalPreferences setObject: [[NSNumber alloc] initWithBool: false] forKey: keySwapHD02];
[oldGlobalPreferences setObject:[[NSNumber alloc] initWithBool: false] forKey: keyUseFrozenParts];
[oldGlobalPreferences setObject: [[NSMutableDictionary alloc] initWithCapacity:64] forKey: keyPartitionsList];
[oldGlobalPreferences setObject: mPartitionsDict forKey: keyPartitionsList];
// Save the preferences file
[ self savePreferences:oldGlobalPreferences ];
mOptionsDict = [[NSMutableDictionary alloc] init];
[mOptionsDict addEntriesFromDictionary:oldGlobalPreferences];
[mOptionsDict retain];
if (mPartitionsList!=nil) [mPartitionsList retain];
if (mPartitionsDict!=nil) [mPartitionsDict retain];
[oldGlobalPreferences release];
}
//--------------------------------------------------------------------------
{
partExtractor->swapHD(iSrc, iDst);
}
partExtractor->extractPartitions();
if ([mFreezeParts intValue]==0)
partExtractor->extractPartitions();
else
[self loadFrozenParts ];
[ self selectDefaultPartition];
}
- (void) doSwapHD: (int) val save: (bool) doSave src: (int) isrc dst: (int) idst
{
if( val>0) //on
if( val>0 && ![mFreezeParts intValue]) //on
{
[self swapDisks: true src:isrc dst:idst ];
}
{
bool val = !![sender intValue];
[mOptionsDict setObject: [NSNumber numberWithBool: val] forKey: keyUseFrozenParts];
[self savePreferences :mOptionsDict];
[self savePreferences: mOptionsDict];
[self onSwapHD: nil];
}
//--------------------------------------------------------------------------
- (IBAction)onInjectPartsToFreeze: (id)sender
{
// TODO generate the parts list in preferences proplist
int size = partExtractor ? partExtractor->partList().size() : 0;
if (!size)
{ // nothing to inject
NSRunAlertPanel(@"Inject Partitions to Freeze Configuration",
@"No current partitions to inject, did you check boot config file ?",@"OK", nil,nil);
return;
}
// generate the parts list in preferences proplist
NSInteger n = NSRunAlertPanel(@"Inject Partitions to Freeze Configuration",
@"Are you sure you want to overwrite your Freeze settings with current partition list ?",
@"OK", @"Cancel",nil);
if (n==1)
{
// populate the dictionary with the current partitions
// empty dictionary and update key in parent:
[mOptionsDict removeObjectForKey: keyPartitionsList];
[mPartitionsDict removeAllObjects ];
// iterate for all entries to add
char partDesc[256]="";
char keyPartN[32] = "";
for (int i=0; i< size; i++)
{
const PartitionInfo& p =partExtractor->partList()[i];
// format the partition key and descriptor string
snprintf(keyPartN, sizeof(keyPartN)-1, "partition%02d",i);
snprintf(partDesc, sizeof(partDesc)-1, "%d%c%d%c%s%c%s",
p.disk(), cPartDescSep,
p.partition(), cPartDescSep,
p.label().c_str(), cPartDescSep,
p.fsType().c_str());
// write it to the dictionary
NSString * key = [[NSString alloc] initWithUTF8String: keyPartN];
NSString * desc = [[NSString alloc] initWithUTF8String: partDesc];
[mPartitionsDict setObject: desc forKey: key];
}
[mOptionsDict setObject: mPartitionsDict forKey: keyPartitionsList];
[self savePreferences: mOptionsDict];
}
}
//--------------------------------------------------------------------------
}
}
//--------------------------------------------------------------------------
- (IBAction)onShutdown: (id)sender
{
NSInteger n = NSRunAlertPanel(@"Shutting Down OS X",
trunk/ChameleonPrefPane/Sources/process.h
9292
9393
9494
95
96
97
98
95
96
97
9998
10099
101100
const char* szRenamed=NULL);
int getListCount() const {return (int) _partList.size();}
const std::vector<PartitionInfo>& partList() const
{
return _partList;
}
const std::vector<PartitionInfo>& partList() const {return _partList;}
std::vector<PartitionInfo>& editPartList() {return _partList;}
// get the index in the internal partlist of the hd(n,m) partition specified by the input string
// return -1 if no match, >=0 if a match happens
int getIndexFromHdStringSpec(const char*);
trunk/ChameleonPrefPane/ChameleonPrefPane.xcodeproj/project.pbxproj
77
88
99
10
1011
1112
1213
......
3435
3536
3637
38
3739
3840
3941
......
163165
164166
165167
168
166169
167170
168171
......
243246
244247
245248
249
246250
247251
248252
objects = {
/* Begin PBXBuildFile section */
0143D924110806E000D290B4 /* version in Resources */ = {isa = PBXBuildFile; fileRef = 0143D923110806E000D290B4 /* version */; };
01466A931104062500088464 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01466A921104062500088464 /* Security.framework */; };
01466C2A110408CC00088464 /* SecurityInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01466C29110408CC00088464 /* SecurityInterface.framework */; };
01466C381104091400088464 /* SecurityFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01466C371104091400088464 /* SecurityFoundation.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
0143D923110806E000D290B4 /* version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = version; path = ../../../../../devl/OSX/chameleonApplications/trunk/ChameleonPrefPane/bin/version; sourceTree = SOURCE_ROOT; };
01466A921104062500088464 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
01466C29110408CC00088464 /* SecurityInterface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SecurityInterface.framework; path = System/Library/Frameworks/SecurityInterface.framework; sourceTree = SDKROOT; };
01466C371104091400088464 /* SecurityFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SecurityFoundation.framework; path = System/Library/Frameworks/SecurityFoundation.framework; sourceTree = SDKROOT; };
32DBCFA10370C40200C91783 /* Other Sources */ = {
isa = PBXGroup;
children = (
0143D923110806E000D290B4 /* version */,
01CB09D91107727D00A56FC3 /* CREDITS */,
32DBCFA20370C41700C91783 /* StartupPrefPane_Prefix.pch */,
01A40F74110550F4002A74CD /* CHANGES */,
01CB09641107654A00A56FC3 /* MacOSX.png in Resources */,
01CB09651107654A00A56FC3 /* Windows.png in Resources */,
01CB09DA1107727D00A56FC3 /* CREDITS in Resources */,
0143D924110806E000D290B4 /* version in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
trunk/ChameleonPrefPane/bin/version
1
1
1.0b8-2
1.0b9
trunk/ChameleonPrefPane/README
1010
1111
1212
13
14
13
14
15
1516
1617
1718
1819
1920
21
22
23
24
25
26
27
28
29
30
2031
2132
2233
2334
24
35
The persistent configuration file is a all users level preferences property list
located in In /Library/Preferences/com.chameleon.prefPane.plist.
The swap diskk fix option might be use if your disk order from chameleon is different from what diskutil list returns
Idealy we should not need this fix, but as for now, I don't know another way to do it
The swap disk fix option might be use if your disk order from chameleon is different
from what diskutil list returns.
Ideally we should not need this fix, but as for now, I don't know another way to do it
In /Library/Preferences/com.chameleon.prefPane.plist:
you can insert a 'forceBootConfigPath' key with your com.apple.Boot,plist file path:
So if automatic detection does not work, then force your com.apple.Boot.plist path here.
Freeze Partitions (lock the partition list and prevent autodetection to happen)
You can also decide to freeze the partitions to prevent automatic detection,
if disk order is not matching after the boot or if you don't want the list to change
each time that a usb key is inserted, then use this feature.
For it to work, you will need first to click on:
Settings/Boot Selector Fixes/Inject Parts In Freeze File
Then all your automatically detected current partitions are injected in the pref. file,
all you need to do is to manually edit them to change their disk id/partition id
(2 first parameters in the pref. file under the partitionList key)
Troubleshooting
If the panel sees your com.apple.boot.plist in the status box, but the boot selection
seem to have no effect, it might be that you have more than one bootConfig file
and that the chameleon booter does not load the one that the panel selected,
see upper to force the bootConfig to match the one loaded by the chameleon booter.
see upper to force the bootConfig to match the one loaded by the chameleon booter.
trunk/ChameleonPrefPane/English.lproj/Chameleon.xib
1212
1313
1414
15
15
1616
1717
1818
......
8585
8686
8787
88
88
8989
9090
9191
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="172"/>
<integer value="174"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="98357325">
<int key="NSCellFlags">72482368</int>
<int key="NSCellFlags2">138544128</int>
<string key="NSContents">V1.0 b8, by Rekursor</string>
<string key="NSContents">V1.0 b9, by Rekursor</string>
<object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">11</double>

Archive Download the corresponding diff file

Revision: 20