Create one or more procedure scripts with your favorite text editor.
A procedure script must be named one of the predefined names: preinstall, postinstall, preremove, or postremove.
Save your changes and quit the editor.
Complete one of the following tasks.
If you want to create class action scripts, skip to the next task, How to Write Class Action Scripts.
If you have not created your prototype file, complete the procedure How to Create a prototype File Using the pkgproto Command, and skip to Step 5.
If you have already created your prototype file, edit it and add an entry for each installation script you just created.
Build your package.
See How to Build a Package, if needed.
After you build the package, install it to confirm that it installs correctly and verify its integrity. Chapter 4, Verifying and Transferring a Package explains how to do this and provides step-by-step instructions on how to transfer your verified package to a distribution medium.