home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Technical Docs / Misc Technical Docs / Installer 3.1Scripting Docs / Script Example.r < prev    next >
Encoding:
Text File  |  1990-04-27  |  26.1 KB  |  627 lines  |  [TEXT/MPS ]

  1. /* This is a sample Installer 3.1 Script.  It demonstrates the use of Easy Install to make        */
  2. /* decisions about what to install based on the machine type, memory size, etc.                    */
  3.  
  4. /* I have included at least one of each script resource type, with the exception of             */
  5. /* the boot block atom ('inbb').                                                                */
  6.  
  7.  
  8. /* If you include these two files within the script file, you dont' need them on the rez line    */
  9. #include "Types.r"                    /* for the ICON resources                                     */
  10. #include "InstallerTypes.r"            /* for the rest of the script resources                     */
  11.  
  12. /* You can build the script with the following two lines:
  13.         rez -o "PaintWorx™ Script" -t 'cfbj' -c 'cfbj' "Script Example.r"
  14.         setfile -a i "PaintWorx™ Script"
  15.         
  16.         scriptcheck -p "PaintWorx™ Script"
  17. */
  18.  
  19.  
  20. #define kHaveScriptCheckFillInDate    0x01    /* insert this value in 'infs' to have ScriptCheck fill in date */
  21.  
  22.  
  23. /* Symbolic definitions for script resources make the scripts easier to read and easier to         */
  24. /* combine with other scripts.  Note:  For the different script resource such as 'inpk',         */
  25. /* 'infs', 'inra', etc. the #defines obviously must be unique within one particular resource    */
  26. /* but we could have an 'inpk' 1000 and 'inra' 1000.  BUT, for clarity, I define each resource    */
  27. /* types with different base values, starting from 1000, 2000, etc.                                */
  28.  
  29.  
  30. /* Definitions for the easy install rules */
  31. #define rlCheckMemSize            1000
  32. #define rlCheckAuditTrail        1001
  33. #define rlOutputMemSizeError    1002
  34. #define rlCheckHardDisk            1003
  35. #define rlCheckFDHD                1004
  36. #define rlOtherDisk                1005
  37. #define rlDescrBaseStuff        1006
  38. #define rlDescrAlmostEvery        1007
  39. #define rlDescrEverything        1008
  40.  
  41. /* Definitions for the assertions we will set and use in the rules */
  42. #define asDoTheInstall                2000
  43. #define asInstallEverything            2001
  44. #define asInstallAlmostEverything    2002
  45. #define asInstallBaseStuff            2003
  46.  
  47. /* Defines for the file spec atoms.  These tell where we expect to find the files on the source    */
  48. /* disks and where we want them installed on the target disk.                                    */
  49.  
  50. #define fsSourcePaintProgram    3000
  51. #define fsSourceExampleFile        3001
  52. #define fsSourceDocumentFile    3002
  53. #define    fsSourceExtrasRsrcs        3003
  54.  
  55. #define fsTargetPaintProgram    3004
  56. #define fsTargetExampleFile        3005
  57. #define fsTargetDocumentFile    3006
  58.  
  59. #define fsTargetSystem            3007
  60.  
  61. /* These are the names of the 2 source disk where we get files from                                */
  62. #define ProgramDisk "Program Disk:"
  63. #define ExtrasDisk    "Extras Disk:"
  64.  
  65. /* This is the target path into which we want to install our files.                                */
  66. #define TargetPath    ":PaintWorx™ Application:"
  67.  
  68.  
  69. /* Definitions for the packages.                                                                  */
  70. #define pkBaseStuff                4000
  71. #define pkExamples                4001
  72. #define pkExtraDocuments        4002
  73.  
  74. #define pkBaseFilesRsrcs        4003
  75. #define pkExampleFiles            4004
  76. #define pkDocumentFiles            4005
  77.  
  78. /* Defines for the package comment resources                                                    */
  79. #define cmtBaseStuff            5000
  80. #define cmtExamples                5001
  81. #define cmtExtraDocuments        5002
  82.     
  83. /* April 5, 1990 is the current release date to put in 'icmt' rsrcs. ScriptCheck will convert     */
  84. /* this value to a LongInt seconds value neede by the Installer.                                */
  85.  
  86. #define currentReleaseDate        4051990        
  87. #define currentVersion            300                    /* Version 3.0 goes in the 'icmt' rsrc        */
  88.  
  89. #define iconPaintWorx            5100
  90.  
  91.  
  92. /* Defines for the resource atoms                                                                 */
  93. #define raNewColorDA            6000
  94. #define raSpecialColorRsrc        6001
  95. #define raOldRsrcToDelete        6002
  96.  
  97. /* Defines for the file atoms                                                                     */
  98. #define faPaintProgram            7000
  99. #define faExampleFile            7001
  100. #define faDocumentFile            7002
  101.  
  102. /* Definitions for the audit trail atoms that we check and install.  These audit trail atoms    */
  103. /* allow us to leave a "trail" in the target system file that can tell us anything we want.        */
  104. /* In this case, the audit atoms will tell us which versions of our software we have installed  */
  105. /* previously on this target volume.                                                             */
  106.  
  107. /* Remember: Apple has reserved all lower case audit selectors.                                    */
  108.  
  109. #define auditPaintWorx            'PWRX'
  110. #define auditInstalledVer1        1
  111. #define auditInstalledVer2        2
  112. #define auditInstalledVer3        3
  113.  
  114. /* This define is for the actual 'inat' audit trail atom we'll install                             */
  115. #define atPaintWorxVer3            8000
  116.  
  117. /************************** Easy Install Rule resources follow **********************************/
  118.  
  119. /* The 'infr' and 'inrl' Easy Install script resources allow a very natural, programatic        */
  120. /* structure in writing Easy Install logic.  See the "Technical Reference to Writing Scripts"    */
  121. /* for more details on this topic.                                                                */
  122.  
  123.  
  124. /* I will present the pseudo-code for the framework logic and then present the actual 'infr'    */
  125. /* resource.  This pseudo-code is just to help explain the framework and is commented out         */
  126.  
  127. /* The pickFirst rule groups in the framework correspond to IF-THEN-ELSE type constructs, where */
  128. /* a maximum of 1 action can be taken for the group:                                            */
  129. /*    IF expression THEN                                                                            */
  130. /*        action                                                                                    */
  131. /*    ELSE IF expression THEN                                                                        */
  132. /*        action                                                                                    */
  133. /*    ELSE …                                                                                        */
  134.     
  135. /* The pickAll rule groups in the framework correspond to IF-THEN type constructs, where        */
  136. /* up to all of the actions can be taken for the group:                                            */
  137. /*    IF expression THEN                                                                            */
  138. /*        action                                                                                    */
  139. /*    IF expression THEN                                                                            */
  140. /*        action                                                                                    */
  141. /*    IF …                                                                                        */
  142.  
  143. #if false 
  144. IF (Memory >= 2MB) THEN                    /* say our product only runs on 2MB systems */
  145.     DoTheInstall 
  146. ELSE IF (Audit trail says we installed Version 1, 2, or 3 of our software before) THEN
  147.     DoTheInstall                        /* Note: even if the system we're running on only has 1MB of memory     */
  148.                                         /* we will still update the software because it was installed on the     */
  149.                                         /* disk previously.  This allows an administrator to update a volume    */
  150.                                         /* using a machine that doesn't have the 2MB requirement.                */
  151. ELSE
  152.     Output Memory Too Small Error
  153.     
  154.  
  155. /* We make our decisions about what packages to install based on the size of the target volume.     */
  156. IF DoTheInstall & (Target Volume >= HD) THEN
  157.     InstallEverything
  158. ELSE IF DoTheInstall & (Target Volume >= FDHD) THEN
  159.     InstallAlmostEverything
  160. ELSE IF DoTheInstall & (Target Volume = Floppy) THEN
  161.     InstallBaseStuff
  162.  
  163.  
  164. IF DoTheInstall & (Installing BaseStuff, AlmostEverything, or Everything) THEN
  165.     Add User Description for the BaseStuff part
  166. IF DoTheInstall & (Installing AlmostEverything or Everything) THEN
  167.     Add User Description for the AlmostEverything part
  168. IF DoTheInstall & (Installing Everything) THEN
  169.     Add User Description for the Everything part
  170.     
  171.     
  172. #endif
  173.  
  174. resource 'infr' (1) {    /* The framework groups the rules into a logical order of execution */
  175.     format0  {{
  176.         pickFirst,    {rlCheckMemSize, rlCheckAuditTrail, rlOutputMemSizeError},    /* Select only one of these three rules */
  177.         pickFirst,    {rlCheckHardDisk, rlCheckFDHD, rlOtherDisk},                /* Select only one of these three rules */
  178.         pickAll,     {rlDescrBaseStuff, rlDescrAlmostEvery, rlDescrEverything}     /* Select zero to three of these rules  */
  179.     }};
  180. };
  181.  
  182.  
  183. resource 'inrl' (rlCheckMemSize) {
  184.     format0 {{
  185.         checkMinMemory {2},                        /* If the system has at least 2MB memory, then add this assertion                 */
  186.         addAssertion {{asDoTheInstall}}            /* An assertion is essentially a variable, adding it makes the variable true     */
  187.     }};
  188. };
  189.  
  190. resource 'inrl' (rlCheckAuditTrail) {
  191.     format0 {{
  192.         
  193.         /* checkAnyAuditRec looks in the target file (the System file in this case) and sees if any of the values     */
  194.         /* for the audit selector exist.  Our audit selector in this case is auditPaintWorx and we want to see if    */
  195.         /* any of the values auditInstalledVer1 … 3 are present.  If so, we add assert that we want to DoTheInstal    */
  196.         
  197.         checkAnyAuditRec {fsTargetSystem, auditPaintWorx, 
  198.                             {auditInstalledVer1, auditInstalledVer2, auditInstalledVer3}},
  199.         addAssertion {{asDoTheInstall}}
  200.     }};
  201. };
  202.  
  203. resource 'inrl' (rlOutputMemSizeError) {
  204.     format0 {{
  205.         /* These two lines of error messages will be output on the Easy Install screen if this rule */
  206.         /* is fired.  It is fired only if neither of the two other rules in this pickFirst group    */
  207.         /* do NOT fire.                                                                                */
  208.         
  209.         reportError {"To use PaintWorx™ 3.0 you need:\n\n"},        /* up to 4 lines of error reporting may be     */
  210.         reportError {"• At least 2 Megabytes of Memory\n"}                    /* displayed in the Easy Install screen.     */
  211.     }};
  212. };
  213.  
  214.  
  215. resource 'inrl' (rlCheckHardDisk) {
  216.     format0 {{
  217.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above */
  218.         checkTgtVolSize {hardDisk, hardDisk},            /* HD is 10MB or greater */
  219.         addAssertion {{asInstallEverything}},            /* Assert the variable that says what we're installing */
  220.         addPackages {{pkBaseFilesRsrcs, pkExampleFiles, pkDocumentFiles}}    /* These 3 packages include everything that */
  221.                                                                             /* we want to install.                         */
  222.     }};
  223. };
  224.  
  225. resource 'inrl' (rlCheckFDHD) {
  226.     format0 {{
  227.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above             */
  228.         checkTgtVolSize {hdFloppy, hdFloppy},            /* FDHD is defined as hdFloppy in InstallerTypes.r             */
  229.         addAssertion {{asInstallAlmostEverything}},        /* Assert the variable that says what we're installing         */
  230.         addPackages {{pkBaseFilesRsrcs, pkExampleFiles}}    /* For a FDHD, we don't install as much as a Hard Disk     */
  231.     }};
  232. };
  233.  
  234. resource 'inrl' (rlOtherDisk) {
  235.     format0 {{
  236.         checkAllAssertions {{asDoTheInstall}},            /* Make sure we made the decision to Install above                 */
  237.         checkTgtVolSize {floppy, floppy},                /* Are we installing onto a floppy?                                */
  238.         addAssertion {{asInstallBaseStuff}},            /* Assert the variable that says what we're installing             */
  239.         addPackages {{pkBaseFilesRsrcs}}                /* For a floppy, we're only installing the program, no extras    */
  240.     }};
  241. };
  242.  
  243.  
  244. resource 'inrl' (rlDescrBaseStuff) {
  245.     format0 {{
  246.         /* If we're installing anything, we want to present this message in Easy Install screen */
  247.         /* We make this decision by checking the assertions that may have been set previously    */
  248.         
  249.         checkAnyAssertion {{asInstallBaseStuff, asInstallAlmostEverything, asInstallEverything}},
  250.         
  251.         addUserDescription {"Version 3.0 of:\n"},                    /* message to appear in Easy Install screen */
  252.         addUserDescription {"• PaintWorx™ application software\n"}    /* can be up to 4 lines of text.            */
  253.     }};
  254. };
  255.  
  256. resource 'inrl' (rlDescrAlmostEvery) {
  257.     format0 {{
  258.         /* We add this description if we're installing the example stuff.  Again we look at the assertions     */
  259.         /* set to decide whether to add the description or not.                                                */
  260.         checkAnyAssertion {{asInstallAlmostEverything, asInstallEverything}},
  261.         addUserDescription {"• PaintWorx™ example pictures\n"}
  262.     }};
  263. };
  264.  
  265. resource 'inrl' (rlDescrEverything) {
  266.     format0 {{
  267.         checkAllAssertions {{asInstallEverything}},
  268.         addUserDescription {"• PaintWorx™ extra documentation\n"}
  269.     }};
  270. };
  271.  
  272.  
  273.  
  274. /***************************** Package Resources ************************************************/
  275.  
  276. /* These first three packages are ShowsOnCustom packages; that means that they are displayed    */
  277. /* and are selectable in the Custom Install screen.                                                */
  278.  
  279. resource 'inpk' (pkBaseStuff) {
  280.     format0 {
  281.         ShowsOnCustom,                 /* Package appears in the Custom Install display         */
  282.         Removable,                    /* Package can be removed                                 */
  283.         cmtBaseStuff,                 /* Package 'icmt' resource ID                            */
  284.         0,                            /* Package size (filled in by ScriptCheck)                */
  285.         "PaintWorx™ application software", {    /* Package Name                                */
  286.             'inpk', pkBaseFilesRsrcs;
  287.         }
  288.     }
  289. };
  290.  
  291. resource 'inpk' (pkExamples) {
  292.     format0 {
  293.         ShowsOnCustom,                 /* Package appears in the Custom Install display         */
  294.         Removable,                    /* Package can be removed                                 */
  295.         cmtExamples,                 /* Package 'icmt' resource ID                            */
  296.         0,                            /* Package size (filled in by ScriptCheck)                */
  297.         "PaintWorx™ example pictures", {    /* Package Name                                    */
  298.             'inpk', pkExampleFiles;
  299.         }
  300.     }
  301. };
  302.  
  303. resource 'inpk' (pkExtraDocuments) {
  304.     format0 {
  305.         ShowsOnCustom,                 /* Package appears in the Custom Install display         */
  306.         Removable,                    /* Package can be removed                                 */
  307.         cmtExtraDocuments,             /* Package 'icmt' resource ID                            */
  308.         0,                            /* Package size (filled in by ScriptCheck)                */
  309.         "PaintWorx™ extra documentation", {        /* Package Name                                */
  310.             'inpk', pkDocumentFiles;
  311.         }
  312.     }
  313. };
  314.  
  315. /* Comment resources for each of those three ShowsOnCustom packages                         */
  316.  
  317. resource 'icmt' (cmtBaseStuff) {
  318.     currentReleaseDate,
  319.     currentVersion,
  320.     iconPaintWorx,
  321.     "This package contains the PaintWorx™ application software. "
  322. };
  323.  
  324. resource 'icmt' (cmtExamples) {
  325.     currentReleaseDate,
  326.     currentVersion,
  327.     iconPaintWorx,
  328.     "This package contains the PaintWorx™ example files. "
  329.     "These pictures show you the power of the software and "
  330.     "the amazing things YOU can do (if you own a graphic artist). "
  331. };
  332.  
  333. resource 'icmt' (cmtExtraDocuments) {
  334.     currentReleaseDate,
  335.     currentVersion,
  336.     iconPaintWorx,
  337.     "This package contains the PaintWorx™ documentation. "
  338.     "This is great late-night reading when your life is "
  339.     "really getting boring. "
  340. };
  341.  
  342. resource 'ICON' (iconPaintWorx) {
  343.         $"0001 0000 0002 8000 0004 4000 0008 2000"
  344.         $"0010 7000 0020 F800 0041 FC00 0083 FA00"
  345.         $"0102 F100 0205 E080 0409 C040 0802 8020"
  346.         $"1001 0010 2002 0008 4000 3F04 8008 4082"
  347.         $"4010 8041 2031 3022 1039 C814 081E 7F8F"
  348.         $"0402 3007 0201 0007 0100 8007 0080 6007"
  349.         $"0040 1FE7 0020 021F 0010 040F 0008 0800"
  350.         $"0004 1000 0002 2000 0001 4000 0000 80"
  351. };
  352.  
  353.  
  354. /* This next three packages were created because they are used a couple of times by the rules        */
  355. /* that add packages.  By grouping all of these things into packages this way, instead of making     */
  356. /* each package above list all the individual package components, we reduce the    chance of            */
  357. /* accidently forgetting to include say one 'inra' resource somewhere.                                */
  358.  
  359. resource 'inpk' (pkBaseFilesRsrcs) {
  360.     format0 {
  361.         notShowsOnCustom,             /* Package does not appear in the Custom Install display                 */
  362.         Removable,                    /* Package can be removed                                                 */
  363.         0,                             /* do not need an 'icmt' for a package that does not show on custom     */
  364.         0,                            /* Package size (filled in by ScriptCheck)                                */
  365.         "", {                        /* do not need an package name for package that does not show on custom    */
  366.             'infa', faPaintProgram;
  367.             'inra', raNewColorDA;
  368.             'inra', raSpecialColorRsrc;
  369.              'inra', raOldRsrcToDelete;
  370.             'inat', atPaintWorxVer3;    /* We want to install the audit trail atom when the program is installed */
  371.         }
  372.     }
  373. };
  374.  
  375. resource 'inpk' (pkExampleFiles) {
  376.     format0 {
  377.         notShowsOnCustom,             /* Package does not appear in the Custom Install display                 */
  378.         Removable,                    /* Package can be removed                                                 */
  379.         0,                             /* do not need an 'icmt' for a package that does not show on custom     */
  380.         0,                            /* Package size (filled in by ScriptCheck)                                */
  381.         "", {                        /* do not need an package name for package that does not show on custom    */
  382.             'infa', faExampleFile;
  383.         }
  384.     }
  385. };
  386.  
  387. resource 'inpk' (pkDocumentFiles) {
  388.     format0 {
  389.         notShowsOnCustom,             /* Package does not appear in the Custom Install display                 */
  390.         Removable,                    /* Package can be removed                                                 */
  391.         0,                             /* do not need an 'icmt' for a package that does not show on custom     */
  392.         0,                            /* Package size (filled in by ScriptCheck)                                */
  393.         "", {                        /* do not need an package name for package that does not show on custom    */
  394.             'infa', faDocumentFile;
  395.         }
  396.     }
  397. };
  398.  
  399.  
  400. /********************************************* File Specs ***************************************************/
  401.  
  402. /* These resource tell where we expect files on the source disks and where to install them on the target     */
  403.  
  404. /* Source File Specs */
  405. resource 'infs' (fsSourcePaintProgram) {
  406.     'APPL',                                        /* File Type                                             */
  407.     'PWRX',                                        /* File Creator                                            */
  408.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date        */
  409.     noSearchForFile,                            /* Do not search the source disk for the file            */
  410.     TypeCrMustMatch,                            /* The file type and creator on source disk must match     */
  411.     ProgramDisk"PaintWorx™"                        /* Path where to find the file                            */
  412. };
  413.  
  414. resource 'infs' (fsSourceExampleFile) {
  415.     'pdoc',                                        /* File Type                                             */
  416.     'PWRX',                                        /* File Creator                                            */
  417.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date        */
  418.     noSearchForFile,                            /* Do not search the source disk for the file            */
  419.     TypeCrMustMatch,                            /* The file type and creator on source disk must match     */
  420.     ExtrasDisk"Examples:Example Picture"        /* Path where to find the file                            */
  421. };
  422.  
  423. resource 'infs' (fsSourceDocumentFile) {
  424.     'ttro',                                        /* File Type (teachtext doc)                            */
  425.     'ttxt',                                        /* File Creator                                            */
  426.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date        */
  427.     noSearchForFile,                            /* Do not search the source disk for the file            */
  428.     TypeCrMustMatch,                            /* The file type and creator on source disk must match     */
  429.     ExtrasDisk"Documents:Info File"                /* Path where to find the file                            */
  430. };
  431.  
  432. resource 'infs' (fsSourceExtrasRsrcs) {
  433.     'ZSYS',                                        /* File Type                                             */
  434.     'MACS',                                        /* File Creator                                            */
  435.     kHaveScriptCheckFillInDate,                    /* ScriptCheck tool will fill in the creation date        */
  436.     noSearchForFile,                            /* Do not search the source disk for the file            */
  437.     TypeCrMustMatch,                            /* The file type and creator on source disk must match     */
  438.     ProgramDisk"System Folder:System"            /* Path where to find the file                            */
  439. };
  440.  
  441.  
  442. /* Target File Specs */
  443.  
  444. resource 'infs' (fsTargetPaintProgram) {
  445.     'APPL',                                        /* File Type                                            */
  446.     'PWRX',                                        /* File Creator                                            */
  447.     0,                                            /* not needed for target file specs                        */
  448.     noSearchForFile,                            /* Do not search the target disk for the file            */
  449.     TypeCrMustMatch,                            /* not needed for target file specs                         */
  450.     TargetPath"PaintWorx™"                        /* Path to install the file into                        */
  451. };
  452.  
  453. resource 'infs' (fsTargetExampleFile) {
  454.     'pdoc',                                        /* File Type                                            */
  455.     'PWRX',                                        /* File Creator                                            */
  456.     0,                                            /* not needed for target file specs                        */
  457.     noSearchForFile,                            /* Do not search the target disk for the file            */
  458.     TypeCrMustMatch,                            /* not needed for target file specs                         */
  459.     TargetPath"Examples:Example Picture"        /* Path to install the file into                        */
  460. };
  461.  
  462. resource 'infs' (fsTargetDocumentFile) {
  463.     'ttro',                                        /* File Type                                            */
  464.     'ttxt',                                        /* File Creator                                            */
  465.     0,                                            /* not needed for target file specs                        */
  466.     noSearchForFile,                            /* Do not search the target disk for the file            */
  467.     TypeCrMustMatch,                            /* not needed for target file specs                         */
  468.     TargetPath"Documents:Info File"                /* Path to install the file into                        */
  469. };
  470.  
  471. resource 'infs' (fsTargetSystem) {
  472.     'ZSYS',                                        /* File Type                                            */
  473.     'MACS',                                        /* File Creator                                            */
  474.     0,                                            /* not needed for target file specs                        */
  475.     noSearchForFile,                            /* Do not search the target disk for the file            */
  476.     TypeCrMustMatch,                            /* not needed for target file specs                         */
  477.     "Blessed:System"                            /* Path to install the file into                        */
  478. };
  479.  
  480.  
  481.  
  482. /******************************************** File Atoms ************************************************/
  483.  
  484. /* The file atoms define the details of installing files - which forks, update only, etc.                */
  485.  
  486. resource 'infa' (faPaintProgram) {
  487.     format0 {
  488.         delRemove,                        /* Delete the file if remove is clicked                     */
  489.         delInstall,                     /* Delete the target before copying new one                 */
  490.         copy,                             /* Copy the file to the destination                            */
  491.         noLeaveAloneIfNewer,             /* Install this version, if newer one exists, still install */
  492.         noKeepExisting,                 /* Always replace an existing copy                            */
  493.         noUpdateOnly,                    /* Copy whether the target file exists or not                 */
  494.         rsrcFork, dataFork,                /* Copy both forks of the file                                */
  495.         fsTargetPaintProgram,            /* TARGET file spec for this file                             */
  496.         fsSourcePaintProgram,             /* SOURCE file spec for this file                            */
  497.         0,                                /* atom size (filled in by ScriptCheck)                        */
  498.         ""                                /* Atom Description (for a file Installer will use file name */
  499.     };                                    /*                   which is what we want in this case)    */
  500. };
  501.  
  502. resource 'infa' (faExampleFile) {
  503.     format0 {
  504.         delRemove,                        /* Delete the file if remove is clicked                     */
  505.         delInstall,                     /* Delete the target before copying new one                 */
  506.         copy,                             /* Copy the file to the destination                            */
  507.         noLeaveAloneIfNewer,             /* Install this version, if newer one exists, still install */
  508.         noKeepExisting,                 /* Always replace an existing copy                            */
  509.         noUpdateOnly,                    /* Copy whether the target file exists or not                 */
  510.         rsrcFork, dataFork,                /* Copy both forks of the file                                */
  511.         fsTargetExampleFile,            /* TARGET file spec for this file                             */
  512.         fsSourceExampleFile,             /* SOURCE file spec for this file                            */
  513.         0,                                /* atom size (filled in by ScriptCheck)                        */
  514.         ""                                /* Atom Description (for a file Installer will use file name */
  515.     };                                    /*                   which is what we want in this case)    */
  516. };
  517.  
  518. resource 'infa' (faDocumentFile) {
  519.     format0 {
  520.         delRemove,                        /* Delete the file if remove is clicked                     */
  521.         delInstall,                     /* Delete the target before copying new one                 */
  522.         copy,                             /* Copy the file to the destination                            */
  523.         noLeaveAloneIfNewer,             /* Install this version, if newer one exists, still install */
  524.         noKeepExisting,                 /* Always replace an existing copy                            */
  525.         noUpdateOnly,                    /* Copy whether the target file exists or not                 */
  526.         rsrcFork, dataFork,                /* Copy both forks of the file                                */
  527.         fsTargetDocumentFile,            /* TARGET file spec for this file                             */
  528.         fsSourceDocumentFile,             /* SOURCE file spec for this file                            */
  529.         0,                                /* atom size (filled in by ScriptCheck)                        */
  530.         ""                                /* Atom Description (for a file Installer will use file name */
  531.     };                                    /*                   which is what we want in this case)    */
  532. };
  533.  
  534.  
  535. /********************************** Resource Atoms **************************************************/
  536.  
  537. /* The resource atoms specify the details of the resource we want to install into system.  In         */
  538. /* we can specify resource we want to delete also (eg: outdate resources)                            */
  539.  
  540. resource 'inra' (raNewColorDA) {
  541.     format0 {
  542.         delRemove,                        /* Delete rsrc if remove is clicked                     */
  543.         delInstall,                     /* Delete target before copying new rsrc                */
  544.         copy,                             /* Copy rsrc to destination                                */
  545.         tgtRequired,                     /* Target file MUST already exist on to do the install     */
  546.         noKeepExisting,                 /* Always replace the rsrc                                */
  547.         noUpdateOnly,                     /* Copy whether or not target rsrc already exists        */
  548.         evenIf,                            /* Do it even if the target rsrc is protected            */
  549.         srcNeedExist,                    /* Rsrc needs to exist on source disk                    */
  550.         noByID,                            /* Use NAME to find the rsrc                            */
  551.         nameMustMatch,                    /* Resource name must match our specification            */
  552.         fsTargetSystem,                    /* Target file spec to install rsrc into                */
  553.         fsSourceExtrasRsrcs,            /* Source file spec where to get rsrc                    */
  554.         'DRVR',                            /* Resource type                                        */
  555.         0,                                 /* Resource source id                                    */
  556.         0,                                /* Resource target id                                    */
  557.         0,                                /* atom size (filled in by ScriptCheck)                    */
  558.         "Desk Accessory: New Color",    /* Atom description                                        */                            
  559.         "\0x00New Color"                /* Resource name                                        */
  560.     };
  561. };
  562.  
  563. resource 'inra' (raSpecialColorRsrc) {
  564.     format0 {
  565.         delRemove,                        /* Delete rsrc if remove is clicked                     */
  566.         delInstall,                     /* Delete target before copying new rsrc                */
  567.         copy,                             /* Copy rsrc to destination                                */
  568.         tgtRequired,                     /* Target file MUST already exist on to do the install     */
  569.         noKeepExisting,                 /* Always replace the rsrc                                */
  570.         noUpdateOnly,                     /* Copy whether or not target rsrc already exists        */
  571.         evenIf,                            /* Do it even if the target rsrc is protected            */
  572.         srcNeedExist,                    /* Rsrc needs to exist on source disk                    */
  573.         byID,                            /* Use ID to find the rsrc                                */
  574.         notNameMustMatch,                /* Resource name need not match our specification        */
  575.         fsTargetSystem,                    /* Target file spec to install rsrc into                */
  576.         fsSourceExtrasRsrcs,            /* Source file spec where to get rsrc                    */
  577.         'pcol',                            /* Resource type                                        */
  578.         128,                            /* Resource source id                                    */
  579.         128,                            /* Resource target id                                    */
  580.         0,                                /* atom size (filled in by ScriptCheck)                    */
  581.         "",                                /* Atom description (we don't want one for this rsrc -    */
  582.                                         /* Installer will say "Reading from System")            */
  583.         ""                                /* Resource name                                        */
  584.     };
  585. };
  586.  
  587. /* This next resource atom deletes an obsolete resource (if it exists in the target file)         */
  588.  
  589. resource 'inra' (raOldRsrcToDelete) {
  590.     format0 {
  591.         delRemove,                        /* Delete rsrc if remove is clicked                     */
  592.         delInstall,                     /* Delete target before copying new rsrc                */
  593.         noCopy,                         /* Do NOT copy rsrc to destination (we're deleting it)    */
  594.         tgtRequired,                     /* Target file MUST already exist on to do the install     */
  595.         noKeepExisting,                 /* Always replace the rsrc                                */
  596.         noUpdateOnly,                     /* Copy whether or not target rsrc already exists        */
  597.         evenIf,                            /* Do it even if the target rsrc is protected            */
  598.         srcNeedNotExist,                /* Rsrc does not need to exist on source disk            */
  599.         byID,                            /* Use NAME to find the rsrc                            */
  600.         notNameMustMatch,                /* Resource name need not match our specification        */
  601.         fsTargetSystem,                    /* Target file spec to install rsrc into                */
  602.         0,                                /* Do not need a source file spec for a delete atom        */
  603.         'pbit',                            /* Resource type                                        */
  604.         0,                                /* Resource source id                                    */
  605.         128,                            /* Resource target id                                    */
  606.         0,                                /* atom size (filled in by ScriptCheck)                    */
  607.         "",                                /* Atom description                                        */                            
  608.         ""                                /* Resource name                                        */
  609.     };
  610. };
  611.  
  612.  
  613. /********************************************* Audit Trail Atoms ********************************/
  614.  
  615. /* This audit trail atoms are installed into the target system file and allow us to be smart     */
  616. /* when we go to update our software.  We can check the audit in the Easy Install screen and     */
  617. /* know what to update in the future.                                                            */
  618.  
  619. resource 'inat' (atPaintWorxVer3) { 
  620.     format0 {
  621.         fsTargetSystem,                    /* Target file where to install the audit atom            */
  622.         auditPaintWorx,                 /* Audit atom selector.                                    */
  623.         auditInstalledVer3                /* Value to place in the audit trail for this selector     */
  624.     };
  625. };
  626.  
  627.