Use the Apple installer. My own installer was needed before the overhaul of the crash handler (quite a while ago).

This commit is contained in:
Steve Checkoway
2005-05-01 18:33:54 +00:00
parent 8fd08a0a2e
commit fc4e9188a8
16 changed files with 3 additions and 2195 deletions
-32
View File
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>installer</string>
<key>CFBundleGetInfoString</key>
<string>SM Installer</string>
<key>CFBundleIconFile</key>
<string>smicon.icns</string>
<key>CFBundleIdentifier</key>
<string>SM_installer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Installer</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>StCh</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
@@ -1,158 +0,0 @@
using namespace std;
#include <unistd.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <map>
#include <cerrno>
#include <cassert>
#include "StdString.h"
#include "InstallerFile.h"
#include "Processor.h"
#include "Util.h"
void HandleFile(const CString& file, const CString& dir,
const CString& archivePath)
{
CString from = dir + '/' + file;
CString to = archivePath + '/' + file;
char copy[] = "/bin/cp";
char arg[] = "-R";
MakeAllButLast(to);
if (CallTool(copy, arg, from.c_str(), to.c_str(), NULL))
{
fprintf(stderr, "Couldn't copy file from \"%s\" to \"%s\".",
from.c_str(), to.c_str());
exit(-10);
}
}
const CString GetPath(const CString& ID)
{
if (ID == "install path")
{
char cwd[MAXPATHLEN];
char path[MAXPATHLEN];
char *ptr;
size_t temp;
getwd(cwd);
printf("Enter a path (relative or absolute) to the install files\n"
"The current working directory is: %s\n"
"> ", cwd);
ptr = fgets(path, MAXPATHLEN, stdin);
if ((temp = strlen(path)))
{
if (path[temp - 1] == '\n')
path[temp - 1] = '\000';
}
assert(ptr);
while (*ptr != '\000' && (*ptr == ' ' || *ptr == '\t'))
++ptr;
if (*ptr == '/')
return ptr;
return CString(cwd) + "/" + CString(ptr);
}
fprintf(stderr, "Unknown path command, return `.'\n");
return ".";
}
void PrintUsage(int err)
{
printf("usage: BuildInstaller config [dir]\n\n"
"config: The configuration file for the installer.\n"
"dir: The output directory. It is created if it doesn't exist\n");
exit(err);
}
int main(int argc, char *argv[])
{
CString inFile, outDir;
switch (argc)
{
case 1:
printf("BuildInstaller needs to be run with at least one argument.\n");
PrintUsage(1);
case 2:
inFile = argv[1];
outDir = ".";
break;
case 3:
inFile = argv[1];
outDir = argv[2];
break;
default:
printf("BuildInstaller takes at most 2 arguments.\n");
PrintUsage(2);
}
if (inFile == "help" || inFile == "-h" || inFile == "--help")
PrintUsage(0);
outDir += "/files";
InstallerFile config(inFile);
unsigned nextLine = 0;
if (!config.ReadFile())
{
printf("Couldn't read config file, \"%s\".\n", inFile.c_str());
return 3;
}
if (mkdir_p(outDir))
{
printf("The mkdir_p call failed.\n");
return 4;
}
CString archivePath = outDir;
Processor p(archivePath, HandleFile, GetPath, NULL, false);
while (nextLine < config.GetNumLines())
p.ProcessLine(config.GetLine(nextLine), nextLine);
if (!config.WriteFile(outDir + "/config"))
{
printf("%s\n", strerror(errno));
return 7;
}
return 0;
}
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-40
View File
@@ -1,40 +0,0 @@
#import <Cocoa/Cocoa.h>
@interface Helper : NSObject
{
NSString *mPath;
}
- (id) initWithPath:(NSString *)path;
- (void) dealloc;
- (void) startHelper:(id)caller;
@end
@interface NSOpenPanel (SCCanCreateDirectories)
- (void) setCanCreateDirectories:(BOOL)b;
@end
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-188
View File
@@ -1,188 +0,0 @@
#import <sys/types.h>
#import <sys/wait.h>
#import <cstring>
#import <unistd.h>
#import <fcntl.h>
#import "Helper.h"
#import "InstallerWindowController.h"
#import "InstallerFile.h"
#import "Processor.h"
#import "Util.h"
void Error(const char *fmt, ...);
static id c;
void HandleFile(const CString& file, const CString& dir,
const CString& archivePath)
{
NSString *filePath = [NSString stringWithCString:dir];
filePath = [filePath stringByAppendingFormat:@"%s%s",
(dir == "/" ? "" : "/"), file.c_str()];
[c postMessage:filePath];
/* This is rediculus */
char path[] = "/bin/cp";
char arg[] = "-RP";
CString fromString = archivePath + '/' + file;
char from[fromString.length() + 1];
CString toString = dir + '/' + file;
char to[toString.length() + 1];
char *const arguments[] = {path, arg, from, to, NULL};
strcpy(from, fromString);
strcpy(to, toString);
MakeAllButLast(to);
int fd_dev_null = open("/dev/null", O_RDWR, 0);
if (CallTool3(true, -1, fd_dev_null, fileno(stderr), path, arguments))
[c postMessage:@"failed"];
close(fd_dev_null);
}
const CString GetPath(const CString& ID)
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:NO];
[panel setCanChooseDirectories:YES];
[panel setResolvesAliases:YES];
[panel setAllowsMultipleSelection:NO];
[panel setPrompt:@"Install"];
// Only in 10.3 and above
if ([panel respondsToSelector:@selector(setCanCreateDirectories:)])
[panel setCanCreateDirectories:YES];
[panel setTitle:@"Choose a location to install."];
int result = [panel runModalForTypes:[NSArray array]]; // No extensions
if (result != NSOKButton)
{
[c postMessage:@"Canceled install."];
[c finishedInstalling:NO];
[NSThread exit];
}
NSString *path = [panel filename]; //No need for NSOpenPanel's filenames method
[c postMessage:[NSString stringWithFormat:@"Chose file \"%@\".", path]];
return [path cString];
}
void Error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
NSString *message = [[NSString alloc] initWithFormat:[NSString stringWithCString:fmt] arguments:ap];
va_end(ap);
[c postMessage:[message autorelease]];
}
bool AskFunc(const CString& question)
{
NSString *q = [NSString stringWithCString:question.c_str()];
BOOL answer = [c askQuestion:q];
[c postMessage:q];
[c postMessage:(answer ? @"YES" : @"NO")];
return answer;
}
void Echo(const CString& message, bool loud)
{
if (!loud)
{
[c postMessage:[NSString stringWithCString:message.c_str()]];
return;
}
NSBeginCriticalAlertSheet(@"Warning", @"OK", nil, nil, [c window], c, nil, nil, NULL,
[NSString stringWithCString:message.c_str()]);
}
@implementation Helper
- (id)initWithPath:(NSString *)path
{
[super init];
mPath = [path retain];
return self;
}
- (void)dealloc
{
[mPath autorelease];
[super dealloc];
}
- (void)startHelper:(id)caller
{
c = caller;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CString configPath = [mPath cString];
//CString archivePath = configPath + "/archive.tar.gz";
CString archivePath = configPath;
BOOL success = NO;
configPath += "/config";
InstallerFile file(configPath);
try
{
do {
Processor p(archivePath, HandleFile, GetPath, AskFunc, YES);
p.SetErrorFunc(Error);
p.SetEchoFunc(Echo);
[c postMessage:@"Reading from the config file."];
if(!file.ReadFile())
{
[c postMessage:@"Couldn't read the config file"];
break;
}
unsigned nextLine = 0;
while (nextLine < file.GetNumLines())
p.ProcessLine(file.GetLine(nextLine), nextLine);
success = YES;
}
while(0);
}
catch (CString& e)
{
[c postMessage:[NSString stringWithCString:e]];
}
[c postMessage:@"Installation complete"];
[c finishedInstalling:YES];
[pool release];
}
@end
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@ -1,156 +0,0 @@
using namespace std;
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <unistd.h>
#include <cassert>
#include <fcntl.h>
#include <cstdio>
#include "StdString.h"
#include "InstallerFile.h"
const unsigned maxLineLen = 1024;
const unsigned short magicNumber = 0xBAD1;
bool InstallerFile::ReadFile(const CString& path)
{
const CString& file = (path == "" ? mPath : path);
int fd = open(file, O_RDONLY, S_IROTH);
if (fd == -1)
return false;
struct stat sb;
if (fstat(fd, &sb) == -1)
return false;
unsigned fileLength = sb.st_size;
if (fileLength <= 2)
return false;
fileLength += 1000; /* Just in case */
char buf[fileLength];
unsigned len = read(fd, buf, fileLength);
close(fd);
unsigned short temp = (buf[0] << 8) | (buf[1] & 0x00FF) ;
if (temp == magicNumber)
ReadBinary(buf + 2, len - 2);
else
ReadText(buf, len);
return mLines.size();
}
void InstallerFile::ReadBinary(const char *buf, unsigned len)
{
unsigned pos = 0;
while (pos < len)
{
if (len < pos + 2)
break;
unsigned length = *(unsigned short *)buf;
buf += 2;
pos += 2;
if (len < pos + length)
break;
mLines.push_back(CString(buf, length));
buf += length;
pos += length;
}
}
void InstallerFile::ReadText(const char *buf, unsigned len)
{
unsigned pos = 0;
while (pos < len)
{
unsigned lineLen = 0;
bool ignoreLine = false;
char line[maxLineLen];
while (lineLen < maxLineLen && pos < len)
{
++pos;
if (strspn(buf, "\r\n"))
{
++buf;
break;
}
if (!lineLen && strspn(buf, " \t")){
++buf;
continue;
}
if (!lineLen && *buf == '#')
{
ignoreLine = true;
++buf;
}
else
line[lineLen++] = *(buf++);
}
if (!lineLen || ignoreLine)
continue;
mLines.push_back(CString(line, lineLen));
}
}
bool InstallerFile::WriteFile(const CString& path)
{
/* Use buffered I/O */
FILE *fp = fopen(path, "w");
if (fp == NULL)
return false;
fwrite(&magicNumber, sizeof(magicNumber), 1, fp);
for (unsigned i=0; i<mLines.size(); ++i)
{
CString& str = mLines[i];
unsigned short length = str.length();
fwrite(&length, 1, sizeof(length), fp);
fwrite(str.c_str(), 1, length, fp);
}
return true;
}
CString InstallerFile::GetLine(unsigned line)
{
if (line >= mLines.size())
return "";
return mLines[line];
}
/*
* (c) 2003 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@ -1,52 +0,0 @@
#ifndef INSTALLER_FILE_H
#define INSTALLER_FILE_H
#include "StdString.h"
#include <cstdio>
#include <vector>
using namespace std;
class InstallerFile
{
private:
CString mPath;
vector<CString> mLines;
void ReadBinary(const char *buf, unsigned len);
void ReadText(const char *buf, unsigned len);
public:
InstallerFile(CString path) : mPath(path) { }
bool ReadFile(const CString& path = "");
bool WriteFile(const CString& path);
CString GetLine(unsigned line);
unsigned GetNumLines() { return mLines.size(); }
};
#endif
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@ -1,47 +0,0 @@
#import <Cocoa/Cocoa.h>
#import "Helper.h"
@interface InstallerWindowController : NSWindowController
{
IBOutlet NSButton *button;
IBOutlet NSTextView *textView;
IBOutlet NSTextField *questionField;
IBOutlet NSPanel *questionPanel;
BOOL installing;
Helper *helper;
BOOL finished;
}
- (void)awakeFromNib;
- (void)dealloc;
- (IBAction)pushedButton:(id)sender;
- (void)postMessage:(NSString *)message;
- (void)finishedInstalling:(BOOL)success;
- (BOOL)askQuestion:(NSString *)question;
- (IBAction)pushedQuestionButton:(id)sender;
- (void)windowWillClose:(NSNotification *)notification;
@end
/*
* (c) 2003 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@ -1,95 +0,0 @@
#import "InstallerWindowController.h"
@implementation InstallerWindowController
- (void)awakeFromNib
{
NSString *path = [[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"files"]
stringByStandardizingPath];
helper = [[Helper alloc] initWithPath:path];
finished = NO;
}
/* This whole method might be unneeded, I can't remember */
- (void)dealloc
{
[helper autorelease];
helper = nil;
}
- (IBAction)pushedButton:(id)sender
{
if (finished)
[NSApp terminate:self];
[sender setEnabled:NO];
[[[self window] standardWindowButton:NSWindowCloseButton] setEnabled:NO];
[self postMessage:@"Starting installation."];
[NSThread detachNewThreadSelector:@selector(startHelper:) toTarget:helper withObject:self];
}
- (void)postMessage:(NSString *)message
{
NSRange range;
NSString *s = [message stringByAppendingString:@"\n"];
range.location = [[textView textStorage] length];
range.length = 0;
[textView replaceCharactersInRange:range withString:s];
range.length = [s length];
[textView scrollRangeToVisible:range];
}
- (void)finishedInstalling:(BOOL)success
{
[[[self window] standardWindowButton:NSWindowCloseButton] setEnabled:YES];
if (success)
{
[button setTitle:@"Quit Installer"];
[button setEnabled:YES];
finished = YES;
}
else
[button setEnabled:YES];
}
- (BOOL)askQuestion:(NSString *)question
{
[questionField setStringValue:question];
return [NSApp runModalForWindow:questionPanel];
}
- (IBAction)pushedQuestionButton:(id)sender
{
[questionPanel orderOut:sender];
[NSApp stopModalWithCode:[sender tag]];
}
- (void)windowWillClose:(NSNotification *)notification
{
[NSApp terminate:self];
}
@end
/*
* (c) 2003 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-402
View File
@@ -1,402 +0,0 @@
using namespace std;
#include <sys/types.h>
#include <cerrno>
#include <sys/param.h>
#include <sys/wait.h>
#include <unistd.h>
#include <fcntl.h>
#include "StdString.h"
#include "Processor.h"
#include "Util.h"
bool IsAVar(const CString& var)
{
return var[0] == '$';
}
CString StripVar(const CString& var)
{
if (!IsAVar(var))
return var;
return var.substr(1, var.npos);
}
Processor::Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i)
: mDoGoto(false), mHandleFile(f), mGetPath(p), mAsk(a),
mError(Processor::DefaultError), mInstalling(i)
{
char cwd[MAXPATHLEN];
getwd(cwd);
mCWD = cwd;
mConditionals["INSTALLING"] = i;
mPath = path;
}
Processor::~Processor()
{
if (mInstalling)
unlink(mPath);
}
void Processor::ProcessLine(const CString& line, unsigned& nextLine)
{
CStringArray parts;
split(line, ":", parts);
nextLine++;
if (parts.size() == 0)
return;
#pragma mark LABEL
if (parts[0] == "LABEL")
{
printf("%u: %s\n", nextLine - 1, line.c_str());
if (parts.size() != 2)
goto error;
if (mDoGoto && parts[1] == mLabel)
{
mDoGoto = false;
mLabel = "";
}
mLabels[parts[1]] = nextLine;
return;
}
if (mDoGoto)
return;
printf("%u: %s\n", nextLine - 1, line.c_str());
#pragma mark FILE
if (parts[0] == "FILE")
{
if (parts.size() == 3)
{
CString file, dir;
if (parts[1][0] == '/')
{
file = parts[1].substr(1);
dir = "/";
}
else
{
file = parts[1];
dir = mCWD;
}
if (mInstalling)
{
if (ResolveConditional(parts[2]))
rm_rf(dir + '/' + file);
(*mHandleFile)(file, dir, mPath);
}
else
{
if (IsADirectory((dir == "/" ? dir : dir + "/" ) + file))
{
CStringArray list, dirs;
int fd = open(".", O_RDONLY, 0);
chdir(dir);
FileListingForDirectoryWithIgnore(file, list, dirs,
mIgnore);
fchdir(fd);
close(fd);
if (list.size() == 0) //empty dir or ignored dir
(*mHandleFile)(file, dir, mPath);
for (unsigned i=0; i<list.size(); ++i)
(*mHandleFile)(list[i], dir, mPath);
}
else
(*mHandleFile)(file, dir, mPath);
}
}
else if (parts.size() == 4)
{
CString iFile, iDir, fFile, fDir;
if (parts[1][0] == '/')
{
iFile = parts[1].substr(1);
iDir = "/";
}
else
{
iFile = parts[1];
iDir = mCWD;
}
if (parts[2][0] == '/')
{
fFile = parts[2].substr(1);
fFile = "/";
}
else
{
fFile = parts[2];
fDir = mCWD;
}
if (mInstalling)
{
if (ResolveConditional(parts[3]))
rm_rf(fDir + '/' + fFile);
(*mHandleFile)(fFile, fDir, mPath);
}
else
{
// Now the fun part
char temp[] = "/tmp/tmpXXXXXX";
CString dir;
size_t pos = fFile.find_last_of('/');
char arg[] = "-R";
char tool[] = "/bin/cp";
mkdtemp(temp);
dir.Format("%s/%s/%s", temp, fDir == mCWD ? "." : fDir.c_str(),
pos == fFile.npos ? "" :
fFile.substr(0, pos).c_str());
if (mkdir_p(dir))
{
fprintf(stderr, "Couldn't create directory: %s\n",
dir.c_str());
exit(-1);
}
if (CallTool(tool, arg, (iDir + "/" + iFile).c_str(),
dir.c_str(), NULL))
{
fprintf(stderr, "Couldn't copy file(s).\n");
exit(-1);
}
if (IsADirectory((iDir == "/" ? iDir : iDir + "/") + iFile))
{
CStringArray list, dirs;
int fd = open(".", O_RDONLY, 0);
chdir(dir + "/" + fDir);
FileListingForDirectoryWithIgnore(fFile, list, dirs,
mIgnore);
fchdir(fd);
close(fd);
if (list.size() == 0)
(*mHandleFile)(fFile, temp, mPath);
for (unsigned i=0; i<list.size(); ++i)
(*mHandleFile)(list[i], temp, mPath);
}
else
(*mHandleFile)(fFile, temp, mPath);
rm_rf(temp);
}
}
else
goto error;
return;
}
#pragma mark GETPATH
if (parts[0] == "GETPATH")
{
if (parts.size() != 3)
goto error;
mVars[parts[2]] = (*mGetPath)(parts[1]);
return;
}
#pragma mark CD
if (parts[0] == "CD")
{
if (parts.size() != 3)
goto error;
if (!ResolveConditional(parts[2]))
return;
CString path = ResolveVar(parts[1]);
if (path[0] == '/')
mCWD = path;
else
mCWD += "/" + path;
if (!IsADirectory(mCWD))
(*mError)("%s is not a directory.\n", mCWD.c_str());
return;
}
#pragma mark IGNORE
if (parts[0] == "IGNORE")
{
if (parts.size() != 2)
goto error;
mIgnore.insert(ResolveVar(parts[1]));
return;
}
if (!mInstalling)
return;
#pragma mark GOTO
if (parts[0] == "GOTO")
{
if (parts.size() != 2)
goto error;
if (parts[1] == "")
goto error;
mLabel = parts[1];
if (mLabels.find(mLabel) != mLabels.end())
{
mReturnStack.push(nextLine);
nextLine = mLabels[mLabel];
mLabel = "";
return;
}
mDoGoto = true;
mReturnStack.push(nextLine);
return;
}
#pragma mark IF
if (parts[0] == "IF")
{
if (parts.size() != 4)
goto error;
if (ResolveConditional(parts[1]))
mLabel = parts[2];
else
mLabel = parts[3];
if (mLabel == "")
{
return;
}
mReturnStack.push(nextLine);
if (mLabels.find(mLabel) != mLabels.end())
{
nextLine = mLabels[mLabel];
mLabel = "";
return;
}
mDoGoto = true;
return;
}
#pragma mark RETURN
if (parts[0] == "RETURN")
{
if (mReturnStack.empty())
nextLine = unsigned(-1); // quite large
else
{
nextLine = mReturnStack.top();
mReturnStack.pop();
}
return;
}
#pragma mark SETVAR
if (parts[0] == "SETVAR")
{
if (parts.size() < 3)
goto error;
CString temp = "";
for (unsigned i=2; i<parts.size(); ++i)
temp += ResolveVar(parts[i]);
mVars[parts[1]] = temp;
return;
}
#pragma mark MKDIR
if (parts[0] == "MKDIR")
{
if (parts.size() != 2)
goto error;
CString path = ResolveVar(parts[1]);
if (path[0] != '/')
path = mCWD + "/" + path;
if (mkdir_p(path))
(*mError)(strerror(errno));
return;
}
#pragma mark RM
if (parts[0] == "RM")
{
if (parts.size() != 2)
goto error;
CString path = ResolveVar(parts[1]);
if (path[0] != '/')
path = mCWD + "/" + path;
rm_rf(path);
return;
}
#pragma mark ASK
if (parts[0] == "ASK")
{
if (parts.size() != 3)
goto error;
mConditionals[parts[1]] = (*mAsk)(parts[2]);
return;
}
#pragma mark ECHO
if (parts[0] == "ECHO")
{
if (parts.size() != 3)
goto error;
(mEcho)(parts[1], ResolveConditional(parts[2]));
return;
}
error:
(*mError)("%s is an invalid command", line.c_str());
}
const CString& Processor::ResolveVar(const CString& var)
{
if (!IsAVar(var))
return var;
return mVars[StripVar(var)];
}
bool Processor::ResolveConditional(const CString& cond)
{
if (!IsAVar(cond))
return cond != "";
return mConditionals[StripVar(cond)];
}
void Processor::DefaultError(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(-1);
}
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-72
View File
@@ -1,72 +0,0 @@
#ifndef PROCESSOR_H
#define PROCESSOR_H
using namespace std;
#include <stack>
#include <map>
#include <set>
#include "StdString.h"
class Processor
{
private:
typedef void (*handleFileFunc)(const CString& file, const CString& dir,
const CString& archivePath);
typedef const CString (*getPathFunc)(const CString& ID);
typedef void (*errorFunc)(const char *fmt, ...);
typedef bool (*askFunc)(const CString& question);
typedef void (*echoFunc)(const CString& message, bool loud);
stack<unsigned> mReturnStack;
bool mDoGoto;
CString mLabel;
map<CString, bool> mConditionals;
map<CString, CString> mVars;
map<CString, unsigned> mLabels;
set<CString> mIgnore;
CString mPath;
CString mCWD;
handleFileFunc mHandleFile;
getPathFunc mGetPath;
askFunc mAsk;
errorFunc mError;
echoFunc mEcho;
bool mInstalling;
const CString& ResolveVar(const CString& var);
bool ResolveConditional(const CString& cond);
static void DefaultError(const char *fmt, ...);
public:
Processor(CString& path, handleFileFunc f, getPathFunc p, askFunc a, bool i);
~Processor();
void ProcessLine(const CString& line, unsigned& nextLine);
void SetErrorFunc(errorFunc f) { mError = f; }
void SetEchoFunc(echoFunc f) { mEcho = f; }
};
#endif
/*
* (c) 2003 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-221
View File
@@ -1,221 +0,0 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <cerrno>
#include <sys/wait.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
#include "Util.h"
void split(const CString& Source, const CString& Deliminator, vector<CString>& AddIt)
{
unsigned startpos = 0;
do
{
unsigned pos = Source.find(Deliminator, startpos);
if (pos == Source.npos) pos=Source.size();
CString AddCString = Source.substr(startpos, pos-startpos);
AddIt.push_back(AddCString);
startpos=pos+Deliminator.size();
}
while (startpos <= Source.size());
}
bool IsADirectory(const CString& path)
{
struct stat s;
if (lstat(path, &s))
return false;
return ((s.st_mode & S_IFDIR) == S_IFDIR) &&
((s.st_mode & S_IFLNK) != S_IFLNK);
}
bool DoesFileExist(const CString& path)
{
struct stat s;
return !stat(path, &s);
}
CString LastPathComponent(const CString& path)
{
unsigned pos = path.rfind('/');
if (pos == path.npos)
pos = 0;
return path.substr(pos+1);
}
void FileListingForDirectoryWithIgnore(const CString& path, CStringArray& list, CStringArray& dirs,
const set<CString>& ignore, bool ignoreDot)
{
DIR *dir = opendir(path);
dirent *entry;
if (!dir)
return;
while ((entry = readdir(dir)))
{
if (ignoreDot && entry->d_name[0] == '.')
continue;
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
continue;
if (ignore.find(LastPathComponent(path)) != ignore.end())
continue;
CString temp = path + "/";
temp += entry->d_name;
if (IsADirectory(temp))
{
dirs.push_back(temp);
FileListingForDirectoryWithIgnore(temp, list, dirs, ignore, ignoreDot);
}
else
list.push_back(temp);
}
closedir(dir);
}
int mkdir_p(const CString& path)
{
CStringArray components;
int ret = 0;
int fd = open(".", O_RDONLY, 0);
split(path, "/", components);
if (path[0] == '/')
chdir("/");
for (unsigned i=0; i<components.size(); ++i)
{
if (components[i] == "")
continue;
if ((ret = mkdir(components[i], 0777)))
{
if (errno != EEXIST)
goto err;
else
ret = 0;
}
chdir(components[i]);
}
err:
if (ret)
fprintf(stderr, "%s\n", strerror(errno));
fchdir(fd);
close(fd);
return ret;
}
int MakeAllButLast(const CString& path)
{
size_t i = path.find_last_of("/");
if (i == path.npos)
return 0;
CString dir = path.substr(0, i);
printf("%s -> %s\n", path.c_str(), dir.c_str());
return mkdir_p(dir);
}
void rm_rf(const CString& path)
{
printf("deleting %s\n", path.c_str());
if (IsADirectory(path))
{
CStringArray files, dirs;
FileListingForDirectoryWithIgnore(path, files, dirs, set<CString>(), false);
for (unsigned i=0; i<files.size(); ++i)
{
if (unlink(files[i]))
fputs(strerror(errno), stderr);
}
while (!dirs.empty())
{
if (rmdir(dirs.back()))
fputs(strerror(errno), stderr);
dirs.pop_back();
}
if (rmdir(path))
fputs(strerror(errno), stderr);
}
else if (DoesFileExist(path))
{
if (unlink(path))
fputs(strerror(errno), stderr);
}
assert(!DoesFileExist(path));
}
int CallTool3(bool blocking, int fd_in, int fd_out, int fd_err, const char *path, char *const *arguments)
{
if (!DoesFileExist(path))
throw CString("The tool \"") + path + "\" does not exist.";
pid_t pid = fork();
switch (pid)
{
case -1: /* error */
_exit(-1);
case 0: /* child */
if (fd_in > -1 && fd_in != 0)
{
dup2(fd_in, 0);
close(fd_in);
}
if (fd_out > -1 && fd_in != 1)
{
dup2(fd_out, 1);
close(fd_out);
}
if (fd_err > -1 && fd_in != 2)
{
dup2(fd_err, 2);
close(fd_err);
}
execv(path, arguments);
_exit(-1);
}
/* parent */
if (!blocking)
return 0;
int status, returnStatus;
waitpid(pid, &status, 0);
returnStatus = WEXITSTATUS(status);
return returnStatus;
}
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-43
View File
@@ -1,43 +0,0 @@
using namespace std;
#include "StdString.h"
#include <vector>
#include <set>
void split(const CString& Source, const CString& Deliminator, vector<CString>& AddIt);
bool IsADirectory(const CString& path);
bool DoesFileExist(const CString& path);
CString LastPathComponent(const CString& path);
void FileListingForDirectoryWithIgnore(const CString& path, CStringArray& list, CStringArray& dirs,
const set<CString>& ignore, bool ignoreDot = true);
int mkdir_p(const CString& path);
int MakeAllButLast(const CString& path);
void rm_rf(const CString& path);
int CallTool3(bool blocking, int fd_in, int fd_out, int fd_err, const char *path, char *const *arguments);
inline int CallTool(char *path, ...) { return CallTool3(true, -1, -1, -1, path, &path); }
inline int CallTool2(bool blocking, int fd_in, int fd_out, int fd_err, char *path, ...)
{ return CallTool3(blocking, fd_in, fd_out, fd_err, path, &path); }
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
-64
View File
@@ -1,64 +0,0 @@
#import <Carbon/Carbon.h>
enum
{
kMacOSX_10_2_8 = 0x1028
};
extern int NSApplicationMain(int argc, const char *argv[]);
int main(int argc, const char *argv[])
{
long response;
OSErr err = Gestalt(gestaltSystemVersion, &response);
CFStringRef error = NULL;
if (err != noErr)
error = CFSTR("Couldn't determine OS version.");
else if (response < kMacOSX_10_2_8)
error = CFSTR("StepMania will not run on any version of Mac OS X "
"earlier than 10.2.8.");
if (error)
{
CFStringRef OK = CFSTR("OK");
struct AlertStdCFStringAlertParamRec params = {kStdCFStringAlertVersionOne,
TRUE, FALSE, OK, NULL, NULL, kAlertStdAlertOKButton, NULL,
kWindowAlertPositionParentWindowScreen, NULL};
DialogRef dialog;
SInt16 result;
CreateStandardAlert(kAlertStopAlert, error, NULL, &params, &dialog);
AutoSizeDialog(dialog);
RunStandardAlert(dialog, NULL, &result);
CFRelease(error);
exit(0);
}
return NSApplicationMain(argc, argv);
}
/*
* (c) 2003-2004 Steve Checkoway
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+3 -8
View File
@@ -14,14 +14,9 @@ The build process has been revised yet again.
directory.
INSTALL
Build the installer, from the PBProject directory, run:
$ xcodebuild -target BuildInstaller -target Installer
Now copy the StepMania.app application from build to stepmania via:
$ cp -r build/StepMania.app ..
Next cd to the build directory and run the command:
$ ./BuildInstaller ../scripts/installer.config Installer.app/Contents/Resources
And at the prompt enter: ../..
Now Installer.app is ready to be distributed.
From the PBProject directory, run:
$ scripts/mkrelease.pl .. <version>
Build a pacakge using PackageMaker.
Steve Checkoway
[email protected]
@@ -1,108 +0,0 @@
# Usage
#
# GETPATH:ID:PATH
# ID - An identification string passed to the installer.
# PATH - The variable name into which the returned path is saved.
#
# SETVAR:VAR:ARG1[:ARG2 ...] - Only while installing.
# VAR - The variable into which the concatinated arguments are placed.
# ARG# - All arguments are resolved and concatinated to form the VAR.
#
# MKDIR:PATH - Only while installing.
# PATH - The resolved path
#
# RM:PATH - Only while installing
# PATH - Remove the resolved PATH.
#
# CD:PATH:COND
# PATH - Change directory to the resolved PATH if COND is true.
# COND - Condition. Useful with the $INSTALLING variable.
#
# FILE:PATH:COND - Install the file
# PATH - The file's path.
# COND - If true, overwrite the file
#
# FILE:PATH1:PATH2:COND -Install the file with a new name
# PATH1 - The file's initial path.
# PATH2 - The file's final path (rename).
# COND - If true, overwrite the file
#
# LABEL:LABEL - Only while installing.
# LABEL - The section's name.
#
# GOTO:LABEL - Only while installing.
# LABEL - The name of the section where processing is to continue.
#
# RETURN:NUM - Only while installing.
# - Return to the section NUM sections before the last GOTO command.
#
# IF:COND:LABEL1:LABEL2 - Only while installing.
# COND - If true, GOTO LABEL1, if false, GOTO LABEL2.
# LABEL# - The name of the sections. Leave blank to continue execution.
#
# ASK:VAR:QUESTION - Only while installing
# VAR - Where the response is saved.
# QUESTION - Ask the user a yes or no question, if yes, VAR will be set
# to true. Otherwise, VAR will be set to false.
# Some are missing but I don't feel like adding them now
#Get the install path
GETPATH:install path:PATH
CD:$PATH:YES
#Create the directory
MKDIR:StepMania
CD:StepMania:$INSTALLING
#Ignore the CVS directories
IGNORE:CVS
#Install the files
FILE:Announcers/instructions.txt:OVERWRITE
FILE:BGAnimations/instructions.txt:OVERWRITE
FILE:CDTitles/instructions.txt:OVERWRITE
RM:Characters/default
FILE:Characters/default:OVERWRITE
#FILE:Characters/instructions.txt:OVERWRITE
FILE:Courses/instructions.txt:OVERWRITE
FILE:Courses/Samples:OVERWRITE
FILE:Packages/instructions.txt:OVERWRITE
RM:NoteSkins/common/default
RM:NoteSkins/dance/MAX
RM:NoteSkins/dance/default
RM:NoteSkins/dance/flat
RM:NoteSkins/dance/note
RM:NoteSkins/dance/solo
FILE:NoteSkins/instructions.txt:OVERWRITE
FILE:NoteSkins/common/default:OVERWRITE
FILE:NoteSkins/dance/default:OVERWRITE
FILE:NoteSkins/dance/flat:OVERWRITE
FILE:NoteSkins/dance/note:OVERWRITE
FILE:NoteSkins/dance/solo:OVERWRITE
FILE:NoteSkins/pump/Classic:OVERWRITE
FILE:NoteSkins/pump/default:OVERWRITE
FILE:RandomMovies/instructions.txt:OVERWRITE
FILE:Songs/instructions.txt:OVERWRITE
RM:Themes/default
FILE:Themes/instructions.txt:OVERWRITE
FILE:Themes/default:OVERWRITE
FILE:Visualizations/instructions.txt:OVERWRITE
FILE:Data/Translation.dat:OVERWRITE
FILE:Data/AI.ini:OVERWRITE
FILE:Data/Unlocks.dat:OVERWRITE
FILE:Data/splash.png:OVERWRITE
# Don't overwrite
FILE:Docs/Stats.xml:Data/MachineProfile/Stats.xml:
RM:COPYING.txt
FILE:Docs/Copying.txt:Copying.txt:OVERWRITE
FILE:Docs/ChangeLog.txt:ChangeLog.txt:OVERWRITE
FILE:README-FIRST.html:OVERWRITE
FILE:NEWS:OVERWRITE
FILE:StepMania.app:OVERWRITE
#This needs to be at the very end of the file barring comments
LABEL:END
# Written by Steve Checkoway for StepMania
@@ -90,8 +90,6 @@
//194
19C28FACFE9D520D11CA2CBB = {
children = (
AA67BFAE0558751600EF34A6,
AA67BFCF0558751E00EF34A6,
AA67BFDF0558752500EF34A6,
AA29CE580558741A00961A51,
);
@@ -125,8 +123,6 @@
projectDirPath = "";
targets = (
AA29CC240558741A00961A51,
AA67BFA00558751600EF34A6,
AA67BFB20558751E00EF34A6,
AA67BFD30558752500EF34A6,
AA30C60F07F5E24A0066F398,
);
@@ -141,7 +137,6 @@
AA6EFDC804770AF1005F316C,
AA6EFE5704770C7E005F316C,
AA6E00FE047711FF005F316C,
AA507E4F050BA1A000F96139,
AAAE28D60522523F00D02EE9,
29B97315FDCFA39411CA2CEA,
AA6EFDBB04770A83005F316C,
@@ -150,7 +145,6 @@
AA6EFF6F04770F6A005F316C,
AA52E9BD04DBBCF400D02EE9,
AAFC803F0513A6EB00D02EE9,
AA67BFCE0558751E00EF34A6,
AA29CE570558741A00961A51,
29B97323FDCFA39411CA2CEA,
19C28FACFE9D520D11CA2CBB,
@@ -1266,28 +1260,6 @@
tabWidth = 4;
usesTabs = 1;
};
AA157B31051677F000D02EE9 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = Util.h;
path = Installer/Util.h;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA157B32051677F000D02EE9 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = Util.cpp;
path = Installer/Util.cpp;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA170C39055481660068A894 = {
containerPortal = 29B97313FDCFA39411CA2CEA;
isa = PBXContainerItemProxy;
@@ -1370,39 +1342,6 @@
settings = {
};
};
AA1C653A050C00CF0073A143 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = Processor.h;
path = Installer/Processor.h;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C653B050C00CF0073A143 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = Processor.cpp;
path = Installer/Processor.cpp;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C654B050D212D0073A143 = {
explicitFileType = sourcecode.c.c;
fileEncoding = 4;
isa = PBXFileReference;
name = main.c;
path = Installer/main.c;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C654F050D21AB0073A143 = {
children = (
AA1C6550050D21AB0073A143,
@@ -1465,50 +1404,6 @@
tabWidth = 4;
usesTabs = 1;
};
AA1C655F050D2ABC0073A143 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 30;
isa = PBXFileReference;
name = InstallerWindowController.h;
path = Installer/InstallerWindowController.h;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C6560050D2ABC0073A143 = {
explicitFileType = sourcecode.c.objc;
fileEncoding = 30;
isa = PBXFileReference;
name = InstallerWindowController.m;
path = Installer/InstallerWindowController.m;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C6565050D2D0D0073A143 = {
explicitFileType = sourcecode.c.objc;
fileEncoding = 4;
isa = PBXFileReference;
name = Helper.h;
path = Installer/Helper.h;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C6566050D2D0D0073A143 = {
explicitFileType = sourcecode.cpp.objcpp;
fileEncoding = 4;
isa = PBXFileReference;
name = Helper.mm;
path = Installer/Helper.mm;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA1C65A4050FD21F0073A143 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 30;
@@ -6375,59 +6270,6 @@
settings = {
};
};
AA507E4F050BA1A000F96139 = {
children = (
AA507E68050BC69000F96139,
AA1C6565050D2D0D0073A143,
AA1C6566050D2D0D0073A143,
AA507E65050BA55B00F96139,
AA507E64050BA55B00F96139,
AA1C655F050D2ABC0073A143,
AA1C6560050D2ABC0073A143,
AA1C654B050D212D0073A143,
AA1C653B050C00CF0073A143,
AA1C653A050C00CF0073A143,
AA157B32051677F000D02EE9,
AA157B31051677F000D02EE9,
);
isa = PBXGroup;
name = Installer;
refType = 4;
sourceTree = "<group>";
};
AA507E64050BA55B00F96139 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = InstallerFile.h;
path = Installer/InstallerFile.h;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA507E65050BA55B00F96139 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = InstallerFile.cpp;
path = Installer/InstallerFile.cpp;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA507E68050BC69000F96139 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 4;
isa = PBXFileReference;
name = BuildInstaller.cpp;
path = Installer/BuildInstaller.cpp;
refType = 4;
sourceTree = "<group>";
tabWidth = 4;
usesTabs = 1;
};
AA52E9BD04DBBCF400D02EE9 = {
explicitFileType = sourcecode.cpp;
fileEncoding = 30;
@@ -6716,357 +6558,6 @@
settings = {
};
};
AA67BFA00558751600EF34A6 = {
buildPhases = (
AA67BFA10558751600EF34A6,
AA67BFA60558751600EF34A6,
AA67BFAB0558751600EF34A6,
AA67BFAC0558751600EF34A6,
);
buildRules = (
);
buildSettings = {
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
HEADER_SEARCH_PATHS = "../src Installer";
MACOSX_DEPLOYMENT_TARGET = 10.2;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = BuildInstaller;
REZ_EXECUTABLE = YES;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost";
};
dependencies = (
);
isa = PBXNativeTarget;
name = BuildInstaller;
productInstallPath = /usr/local/bin;
productName = BuildInstaller;
productReference = AA67BFAE0558751600EF34A6;
productType = "com.apple.product-type.tool";
};
AA67BFA10558751600EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFA20558751600EF34A6,
AA67BFA30558751600EF34A6,
AA67BFA40558751600EF34A6,
AA67BFA50558751600EF34A6,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFA20558751600EF34A6 = {
fileRef = AA6EFE6204770CF7005F316C;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA30558751600EF34A6 = {
fileRef = AA507E64050BA55B00F96139;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA40558751600EF34A6 = {
fileRef = AA1C653A050C00CF0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA50558751600EF34A6 = {
fileRef = AA157B31051677F000D02EE9;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA60558751600EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFA70558751600EF34A6,
AA67BFA80558751600EF34A6,
AA67BFA90558751600EF34A6,
AA67BFAA0558751600EF34A6,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFA70558751600EF34A6 = {
fileRef = AA507E65050BA55B00F96139;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA80558751600EF34A6 = {
fileRef = AA507E68050BC69000F96139;
isa = PBXBuildFile;
settings = {
};
};
AA67BFA90558751600EF34A6 = {
fileRef = AA1C653B050C00CF0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFAA0558751600EF34A6 = {
fileRef = AA157B32051677F000D02EE9;
isa = PBXBuildFile;
settings = {
};
};
AA67BFAB0558751600EF34A6 = {
buildActionMask = 2147483647;
files = (
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFAC0558751600EF34A6 = {
buildActionMask = 2147483647;
files = (
);
isa = PBXRezBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFAE0558751600EF34A6 = {
explicitFileType = "compiled.mach-o.executable";
includeInIndex = 0;
isa = PBXFileReference;
path = BuildInstaller;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
AA67BFB20558751E00EF34A6 = {
buildPhases = (
AA67BFB30558751E00EF34A6,
AA67BFBA0558751E00EF34A6,
AA67BFBE0558751E00EF34A6,
AA67BFC50558751E00EF34A6,
AA67BFCC0558751E00EF34A6,
);
buildRules = (
);
buildSettings = {
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = NO;
HEADER_SEARCH_PATHS = "../src Installer";
INFOPLIST_FILE = "Info-Installer.plist";
MACOSX_DEPLOYMENT_TARGET = 10.2;
OTHER_CFLAGS = "-Wwrite-strings -fconstant-cfstrings";
OTHER_LDFLAGS = "";
OTHER_REZFLAGS = "";
PRODUCT_NAME = Installer;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = "-Wmost";
WRAPPER_EXTENSION = app;
};
dependencies = (
);
isa = PBXNativeTarget;
name = Installer;
productInstallPath = "$(USER_APPS_DIR)";
productName = Installer;
productReference = AA67BFCF0558751E00EF34A6;
productType = "com.apple.product-type.application";
};
AA67BFB30558751E00EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFB40558751E00EF34A6,
AA67BFB50558751E00EF34A6,
AA67BFB60558751E00EF34A6,
AA67BFB70558751E00EF34A6,
AA67BFB80558751E00EF34A6,
AA67BFB90558751E00EF34A6,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFB40558751E00EF34A6 = {
fileRef = AA6EFE6204770CF7005F316C;
isa = PBXBuildFile;
settings = {
};
};
AA67BFB50558751E00EF34A6 = {
fileRef = AA1C655F050D2ABC0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFB60558751E00EF34A6 = {
fileRef = AA1C6565050D2D0D0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFB70558751E00EF34A6 = {
fileRef = AA507E64050BA55B00F96139;
isa = PBXBuildFile;
settings = {
};
};
AA67BFB80558751E00EF34A6 = {
fileRef = AA1C653A050C00CF0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFB90558751E00EF34A6 = {
fileRef = AA157B31051677F000D02EE9;
isa = PBXBuildFile;
settings = {
};
};
AA67BFBA0558751E00EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFBB0558751E00EF34A6,
AA67BFBC0558751E00EF34A6,
AA67BFBD0558751E00EF34A6,
);
isa = PBXResourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFBB0558751E00EF34A6 = {
fileRef = AAB895E504A9057100D02EE9;
isa = PBXBuildFile;
settings = {
};
};
AA67BFBC0558751E00EF34A6 = {
fileRef = 089C165CFE840E0CC02AAC07;
isa = PBXBuildFile;
settings = {
};
};
AA67BFBD0558751E00EF34A6 = {
fileRef = AA1C654F050D21AB0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFBE0558751E00EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFBF0558751E00EF34A6,
AA67BFC00558751E00EF34A6,
AA67BFC10558751E00EF34A6,
AA67BFC20558751E00EF34A6,
AA67BFC30558751E00EF34A6,
AA67BFC40558751E00EF34A6,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFBF0558751E00EF34A6 = {
fileRef = AA1C654B050D212D0073A143;
isa = PBXBuildFile;
settings = {
COMPILER_FLAGS = "-x c";
};
};
AA67BFC00558751E00EF34A6 = {
fileRef = AA1C6560050D2ABC0073A143;
isa = PBXBuildFile;
settings = {
COMPILER_FLAGS = "-x objective-c";
};
};
AA67BFC10558751E00EF34A6 = {
fileRef = AA1C6566050D2D0D0073A143;
isa = PBXBuildFile;
settings = {
COMPILER_FLAGS = "-x objective-c++";
};
};
AA67BFC20558751E00EF34A6 = {
fileRef = AA507E65050BA55B00F96139;
isa = PBXBuildFile;
settings = {
};
};
AA67BFC30558751E00EF34A6 = {
fileRef = AA1C653B050C00CF0073A143;
isa = PBXBuildFile;
settings = {
};
};
AA67BFC40558751E00EF34A6 = {
fileRef = AA157B32051677F000D02EE9;
isa = PBXBuildFile;
settings = {
};
};
AA67BFC50558751E00EF34A6 = {
buildActionMask = 2147483647;
files = (
AA67BFC60558751E00EF34A6,
AA67BFC70558751E00EF34A6,
AA67BFC90558751E00EF34A6,
AA67BFCA0558751E00EF34A6,
AA67BFCB0558751E00EF34A6,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFC60558751E00EF34A6 = {
fileRef = 1058C7A1FEA54F0111CA2CBB;
isa = PBXBuildFile;
settings = {
};
};
AA67BFC70558751E00EF34A6 = {
fileRef = AAF33F2A04FF213100F93C24;
isa = PBXBuildFile;
settings = {
};
};
AA67BFC90558751E00EF34A6 = {
fileRef = 29B97324FDCFA39411CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
AA67BFCA0558751E00EF34A6 = {
fileRef = 29B97325FDCFA39411CA2CEA;
isa = PBXBuildFile;
settings = {
};
};
AA67BFCB0558751E00EF34A6 = {
fileRef = AAA0F7CE047AC7BF005F316C;
isa = PBXBuildFile;
settings = {
};
};
AA67BFCC0558751E00EF34A6 = {
buildActionMask = 2147483647;
files = (
);
isa = PBXRezBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
AA67BFCE0558751E00EF34A6 = {
isa = PBXFileReference;
lastKnownFileType = text.plist;
path = "Info-Installer.plist";
refType = 4;
sourceTree = "<group>";
};
AA67BFCF0558751E00EF34A6 = {
explicitFileType = wrapper.application;
includeInIndex = 0;
isa = PBXFileReference;
path = Installer.app;
refType = 3;
sourceTree = BUILT_PRODUCTS_DIR;
};
AA67BFD30558752500EF34A6 = {
buildPhases = (
AA67BFD40558752500EF34A6,