Pacman environments are defined by a simple language with syntax as follows. The language is made from atoms. An atom may either be
Here is an example to give you an idea of what it looks like.
# # Sample of Pacman syntax. Each such file defines a "package". # platformGE('linux-redhat-7.1') # Require Red-Hat linux greater than or equal to 7.1 platformLE('linux-redhat-7.3') # ...and less than or equal to 7.3. gccVersionGT('2.8') # tests for "native" gcc version greater than 2.8 which('configure'); which('make'); which('gcc') download('http://xxxx/something.tar.gz') untarzip('something.tar.gz') cd('$PAC_TARBALLROOT') # cd into the unzipped tarball shell('./configure') # configure some software shell('./make') # make some software cd() # cd back package('Pacman:nedit | versionGE("1.0")') # Requires another package at this point. # # Set up a workspace # workspace("Bob's Sandbox",'BOB_LOCATION',1000,'bob','groupwrite') { yes('OK to send email?'); mail('youssef@bu.edu','hi') OR message('No email sent.') } setenv ('BOB_HOME','~bob') # set an environment variable that will be part of a users's setup setenvTemp ('BOB_TEMP','~bob/tmp') # set a temporary environment variable message('Success!')Such scripts must be put into text files with pacman extensions as in Sample.pacman. Each such file defines a "package."
You can think of a program like Sample.pacman as defining a sequence of conditions which Pacman may (or may not) be able to establish. If all of these conditions are established, in order, then "Sample" is "installed." Pacman automatically keeps track of these conditions over time and automatically has the ability to correctly "undo everything that was done."
Before listing all of the (more than 160) atoms, there are a few general points to keep in mind:
{ yes('OK to send email?'); mail('youssef@bu.edu','hi') OR message('No email sent.') }has the effect of first asking the question. If the installer answers yes, the email is sent. If the installer answers no, then the alternative branch is attempted, the message is 'No email send.' is displayed, and the installation continues.
setenv('FOO','BAR')rather than
shell('setenv FOO BAR')In the second case (since shell commands are executed as sub-processes), the shell command will have no effect and would also fail unless the installer was installing from the c-shell. Another non-obvious reason has to do with gaining the trust of someone who might install your software. If a complex installation has many shell commands, then it may be difficult for an installer to decide to go ahead with the procedure and trust that the shell commands will not do anything harmful. On the other hand, if there are only a few shell commands and everything else are non-shell Pacman atoms (which are always safe to execute), then an installer can proceed with confidence or at least has fewer shell commands to look over.