{ yes('Do you want to print "FOO"?'); message('FOO') OR message('not printing FOO') }shows how to use yes to ask a question and follow the first branch if the answer is 'yes'. Similarly, no is satisfied as a logical condition if the answer to the question is 'no'. You can use choice when there are multiple possibilities as in
{ choice( 'Red','Choose a color','Red','Green','Blue'); message('Red chosen' ) OR choice('Green','Choose a color','Red','Green','Blue'); message('Green chosen') OR choice( 'Blue','Choose a color','Red','Green','Blue'); message('Blue chosen' ) }Use fail(message) to cause an installation to fail with an error message as in
{ yes('OK to make a new directory?'); mkdir('foo') OR fail('No permission to make foo.') }all of these atoms save and remember the answers provided, so that the answers don't have to be repeated when the software is updated or removed and re-installed. The installer can always choose to ignore this saved information by using -ignore-cookies.
package('BU:Python | versionGE(2.2)')The configure atom has the same syntax and differs from package only in inducing the correct behavior when Pacman uninstalls and updates packages. The rule that you should follow is this:
The practical effect of using configure is that packages become linked together in terms of what must be uninstalled and re-installed together.
register('BU','http://atlas.bu.edu/caches','Atlas Tier 2, Boston University','http://physics.bu.edu/~usatlas/','Saul Youssef', 'http://physics.bu.edu/~youssef/')defines the symbolic cache name BU, so that one can refer to BU:Python, for example.
username('root') # requires that only root may install the package userExists('youssef') # requires that a username youssef exists userAdd('youssef','physics','/bin/csh','/home/youssef') # creates a user youssef if necessaryIf the installer doesn't have priviledge to perform these operations, Pacman will provide sensible error messages.
workspace('Job Output','JOBOUTPUT',10000) # makes a 100 G working space workspace('Temporary Working Space','WORK_TMP',10000) # makes a 10 G temporary work spaceAs usual, Pacman takes care of removing such workspaces and their contents unlesss you use the permanent option.
platform('linux-redhat-7.3') # require RedHat Linux version 7.3 # #- Require RedHat version 7.3-9 or any version of cygwin # { platformGE('linux-redhat-7.3'); platformLT('linux-redhat-9') OR platformGE('cygwin') }You can get a list of supported platforms by doing % pacman -platforms.
version('1.1') # this package is version 1.1in package Foo. Then, in another package, you can do
package("Foo | { versionGE('1.0'); versionLT('2.0') OR version('3.0-beta') }")to select particular versions, or, similarly, on the command line
% pacman -get "Foo | { versionGE('1.0'); versionLT('2.0') OR version('3.0-beta') }"In the Pacman browsing functions, if you do -l -d versions or -lc -d version the versions of packages will be displayed.
If you want to test versions of software not in this list, a good option is to use shellOutput, shellOutputLE, etc.
shellOutputGE('wget -v','GNU Wget 1.9')this requires both that wget is available and that the start of the resulting output matches or exceeds the provided string.