{ 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.') }If you want to set an environment variable FOO to a value chosen by the installer, simply do
setenv('FOO')and Pacman will ask a question and set FOO appropriately. 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.
% pacman -verifyPacman will report an error if any of the files have been modified.