Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
SetLockBitAtomSample.r
/* |
File: SetLockBitAtomSample.r |
Contains: Install application "TheProgram" into the "Root directory and lock the file. |
For this sample, I use TeachText as the program to install and lock. |
Demonstrates implementation of an action atom. |
You can build the script with the following lines: |
rez -o "SetLockBitAtomSample" -t 'bjbc' -c 'bjbc' "SetLockBitAtomSample.r" |
setfile -a i "SetLockBitAtomSample" |
scriptcheck -p "SetLockBitAtomSample" |
Written by: Rich Kubota |
Copyright: Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
8/18/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 |
*/ |
#include "Types.r" |
#include "InstallerTypes.r" |
/* 'inaa' code resource definition */ |
#define aaCodeID 10000 |
/* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */ |
#define kScriptCheckSetsDate 0x01 |
/* Definitions for the file spec atoms (specifications for source and destination files) */ |
#define fsSourceProgram 2000 |
#define fsTargetProgram 2001 |
/* This is the name of the source disk */ |
#define ProgramDisk "Program Disk:" |
/* where we want to install our file. */ |
#define TargetPath ":" |
/* Definition for the package. */ |
#define pkTheProgram 3000 |
/* Definition for the file atom */ |
#define faProgram 4000 |
/* Definition for the package comment resource */ |
#define cmtTheProgram 5000 |
/* Definitions for the action atom resources */ |
#define aaSetLockBit 6000 |
/* June 16, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */ |
/* this value to a LongInt seconds value needed by the Installer. */ |
#define currentReleaseDate 6161992 |
#define currentVersion 100 /* Version 1.0 goes in the 'icmt' rsrc */ |
#define iconTheProgram 5100 |
/************************** Easy Install Rule resources **********************************/ |
/***************************** Package Resources ************************************************/ |
resource 'inpk' (pkTheProgram) { |
format0 { |
ShowsOnCustom, /* Package appears in the Custom Install display */ |
Removable, /* Package can be removed */ |
dontForceRestart, /* no need to restart */ |
cmtTheProgram, /* package's 'icmt' resource id */ |
0, /* Package size (filled in by ScriptCheck) */ |
"TheProgram", { /* package name for package that shows on custom */ |
'infa', faProgram; |
'inaa', aaSetLockBit; |
} |
} |
}; |
/***************************** Comments ************************************************/ |
resource 'icmt' (cmtTheProgram) { |
currentReleaseDate, |
currentVersion, |
iconTheProgram, |
"This package contains TheProgram. " |
}; |
resource 'ICON' (iconTheProgram) { |
$"0430 4000 0A50 A000 0B91 1002 0822 0803" |
$"1224 0405 2028 0209 4010 0111 800C 00A1" |
$"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08" |
$"04E0 000C 08E0 000A 10E0 0009 08C0 0006" |
$"0487 FE04 0288 0104 0188 0084 0088 0044" |
$"0088 0044 0088 00C4 0110 0188 0228 0310" |
$"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A" |
$"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E", |
}; |
/********************************************* File Specs ******************************************/ |
/* Source File Specs */ |
resource 'infs' (fsSourceProgram) { |
'APPL', /* File Type */ |
'ttxt', /* Creator */ |
kScriptCheckSetsDate, /* ScriptCheck fills in the creation date */ |
noSearchForFile, /* Do not search the source disk for the file */ |
TypeCrMustMatch, /* file type and creator on source disk must match */ |
ProgramDisk"TeachText" /* Path to the file */ |
}; |
/* Target File Specs */ |
resource 'infs' (fsTargetProgram) { |
'APPL', /* File Type */ |
'ttxt', /* Creator */ |
0, /* creation date not needed for target file specs */ |
noSearchForFile, /* Do not search the target disk for the file */ |
TypeCrMustMatch, /* not needed for target file specs */ |
TargetPath"TeachText" /* destination Path */ |
}; |
/******************************************** File Atoms ************************************************/ |
resource 'infa' (faProgram) { |
format0 { |
delRemove, /* Delete the file if remove (option-custom) is clicked */ |
delInstall, /* Delete the target before copying new one */ |
copy, /* Copy the file to the destination */ |
leaveAloneIfNewer, /* do not Install this version, if newer one exists */ |
noKeepExisting, /* Always replace an existing copy */ |
copyIfNewOrUpdate, /* Copy whether the target file exists or not */ |
rsrcFork, dataFork, /* Copy both forks of the file */ |
fsTargetProgram, /* TARGET file spec for this file */ |
fsSourceProgram, /* SOURCE file spec for this file */ |
0, /* atom size (filled in by ScriptCheck) */ |
"" /* Atom Description (Installer will use file name) */ |
}; |
}; |
resource 'inaa' (aaSetLockBit) { |
format0 { |
actAfter, |
dontActOnRemove, |
actOnInstall, |
'infn', |
aaCodeID, |
fsTargetProgram, /* pass in the 'infs' resource ID of the file to lock */ |
"Set Locked Bit of Target file based on target infs resource ID" |
} |
}; |
INCLUDE "SetLockBit.rsrc" 'infn' (10000) AS 'infn' (aaCodeID, $$Attributes); |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-07-22